01 Sep, 2023

2 commits


29 Aug, 2023

1 commit

  • Create an own procfs "runway" root entry for the CCIO driver.
    No need to share it with the sba_iommu driver, as only one
    of those busses can be active in one machine anyway.

    Signed-off-by: Helge Deller
    Reported-by: kernel test robot
    Fixes: 547259580dfa ("parisc: Move proc_mckinley_root and proc_runway_root to sba_iommu")
    Cc: # v6.5

    Helge Deller
     

27 Aug, 2023

1 commit


11 Aug, 2023

1 commit


30 Jun, 2023

2 commits


10 Sep, 2022

1 commit

  • The parisc was using some readq/writeq accessors without special
    considerations as to what will happen on 32bit CPUs if you do
    this. Maybe we have been lucky that it "just worked" on 32bit
    due to the compiler behaviour, or the code paths were never
    executed.

    Fix the two offending code sites like this:

    arch/parisc/lib/iomap.c:

    - Put ifdefs around the 64bit accessors and make sure
    that ioread64, ioread64be, iowrite64 and iowrite64be
    are not available on 32bit builds.

    - Also fold in a bug fix where 64bit access was by
    mistake using 32bit writel() accessors rather
    than 64bit writeq().

    drivers/parisc/sba_iommu.c:

    - Access any 64bit registers using _lo_hi-semantics by way
    of the readq and writeq operations provided by

    Signed-off-by: Linus Walleij
    Reviewed-by: Arnd Bergmann
    Cc: James E.J. Bottomley
    Cc: Helge Deller
    Cc: linux-parisc@vger.kernel.org
    Cc: linux-arch@vger.kernel.org
    Cc: Arnd Bergmann
    Cc: John David Anglin
    Signed-off-by: Arnd Bergmann

    Linus Walleij
     

28 Jan, 2022

1 commit

  • Rolf Eike Beer reported the following bug:

    [1274934.746891] Bad Address (null pointer deref?): Code=15 (Data TLB miss fault) at addr 0000004140000018
    [1274934.746891] CPU: 3 PID: 5549 Comm: cmake Not tainted 5.15.4-gentoo-parisc64 #4
    [1274934.746891] Hardware name: 9000/785/C8000
    [1274934.746891]
    [1274934.746891] YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI
    [1274934.746891] PSW: 00001000000001001111111000001110 Not tainted
    [1274934.746891] r00-03 000000ff0804fe0e 0000000040bc9bc0 00000000406760e4 0000004140000000
    [1274934.746891] r04-07 0000000040b693c0 0000004140000000 000000004a2b08b0 0000000000000001
    [1274934.746891] r08-11 0000000041f98810 0000000000000000 000000004a0a7000 0000000000000001
    [1274934.746891] r12-15 0000000040bddbc0 0000000040c0cbc0 0000000040bddbc0 0000000040bddbc0
    [1274934.746891] r16-19 0000000040bde3c0 0000000040bddbc0 0000000040bde3c0 0000000000000007
    [1274934.746891] r20-23 0000000000000006 000000004a368950 0000000000000000 0000000000000001
    [1274934.746891] r24-27 0000000000001fff 000000000800000e 000000004a1710f0 0000000040b693c0
    [1274934.746891] r28-31 0000000000000001 0000000041f988b0 0000000041f98840 000000004a171118
    [1274934.746891] sr00-03 00000000066e5800 0000000000000000 0000000000000000 00000000066e5800
    [1274934.746891] sr04-07 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    [1274934.746891]
    [1274934.746891] IASQ: 0000000000000000 0000000000000000 IAOQ: 00000000406760e8 00000000406760ec
    [1274934.746891] IIR: 48780030 ISR: 0000000000000000 IOR: 0000004140000018
    [1274934.746891] CPU: 3 CR30: 00000040e3a9c000 CR31: ffffffffffffffff
    [1274934.746891] ORIG_R28: 0000000040acdd58
    [1274934.746891] IAOQ[0]: sba_unmap_sg+0xb0/0x118
    [1274934.746891] IAOQ[1]: sba_unmap_sg+0xb4/0x118
    [1274934.746891] RP(r2): sba_unmap_sg+0xac/0x118
    [1274934.746891] Backtrace:
    [1274934.746891] [] dma_unmap_sg_attrs+0x6c/0x70
    [1274934.746891] [] scsi_dma_unmap+0x54/0x60
    [1274934.746891] [] mptscsih_io_done+0x150/0xd70
    [1274934.746891] [] mpt_interrupt+0x168/0xa68
    [1274934.746891] [] __handle_irq_event_percpu+0xc8/0x278
    [1274934.746891] [] handle_irq_event_percpu+0x3c/0xd8
    [1274934.746891] [] handle_percpu_irq+0xb4/0xf0
    [1274934.746891] [] generic_handle_irq+0x50/0x70
    [1274934.746891] [] call_on_stack+0x18/0x24
    [1274934.746891]
    [1274934.746891] Kernel panic - not syncing: Bad Address (null pointer deref?)

    The bug is caused by overrunning the sglist and incorrectly testing
    sg_dma_len(sglist) before nents. Normally this doesn't cause a crash,
    but in this case sglist crossed a page boundary. This occurs in the
    following code:

    while (sg_dma_len(sglist) && nents--) {

    The fix is simply to test nents first and move the decrement of nents
    into the loop.

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

    John David Anglin
     

09 Aug, 2021

1 commit


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 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
     

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
     

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
     

31 May, 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 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
     

22 Feb, 2019

1 commit


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

1 commit


17 Oct, 2018

1 commit

  • 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
     

05 Jun, 2018

1 commit

  • Pull dma-mapping updates from Christoph Hellwig:

    - replace the force_dma flag with a dma_configure bus method. (Nipun
    Gupta, although one patch is іncorrectly attributed to me due to a
    git rebase bug)

    - use GFP_DMA32 more agressively in dma-direct. (Takashi Iwai)

    - remove PCI_DMA_BUS_IS_PHYS and rely on the dma-mapping API to do the
    right thing for bounce buffering.

    - move dma-debug initialization to common code, and apply a few
    cleanups to the dma-debug code.

    - cleanup the Kconfig mess around swiotlb selection

    - swiotlb comment fixup (Yisheng Xie)

    - a trivial swiotlb fix. (Dan Carpenter)

    - support swiotlb on RISC-V. (based on a patch from Palmer Dabbelt)

    - add a new generic dma-noncoherent dma_map_ops implementation and use
    it for arc, c6x and nds32.

    - improve scatterlist validity checking in dma-debug. (Robin Murphy)

    - add a struct device quirk to limit the dma-mask to 32-bit due to
    bridge/system issues, and switch x86 to use it instead of a local
    hack for VIA bridges.

    - handle devices without a dma_mask more gracefully in the dma-direct
    code.

    * tag 'dma-mapping-4.18' of git://git.infradead.org/users/hch/dma-mapping: (48 commits)
    dma-direct: don't crash on device without dma_mask
    nds32: use generic dma_noncoherent_ops
    nds32: implement the unmap_sg DMA operation
    nds32: consolidate DMA cache maintainance routines
    x86/pci-dma: switch the VIA 32-bit DMA quirk to use the struct device flag
    x86/pci-dma: remove the explicit nodac and allowdac option
    x86/pci-dma: remove the experimental forcesac boot option
    Documentation/x86: remove a stray reference to pci-nommu.c
    core, dma-direct: add a flag 32-bit dma limits
    dma-mapping: remove unused gfp_t parameter to arch_dma_alloc_attrs
    dma-debug: check scatterlist segments
    c6x: use generic dma_noncoherent_ops
    arc: use generic dma_noncoherent_ops
    arc: fix arc_dma_{map,unmap}_page
    arc: fix arc_dma_sync_sg_for_{cpu,device}
    arc: simplify arc_dma_sync_single_for_{cpu,device}
    dma-mapping: provide a generic dma-noncoherent implementation
    dma-mapping: simplify Kconfig dependencies
    riscv: add swiotlb support
    riscv: only enable ZONE_DMA32 for 64-bit
    ...

    Linus Torvalds
     

16 May, 2018

1 commit


07 May, 2018

1 commit

  • This was used by the ide, scsi and networking code in the past to
    determine if they should bounce payloads. Now that the dma mapping
    always have to support dma to all physical memory (thanks to swiotlb
    for non-iommu systems) there is no need to this crude hack any more.

    Signed-off-by: Christoph Hellwig
    Acked-by: Palmer Dabbelt (for riscv)
    Reviewed-by: Jens Axboe

    Christoph Hellwig
     

22 Aug, 2017

1 commit


06 Jul, 2017

1 commit

  • DMA_ERROR_CODE already went away in linux-next, but parisc unfortunately
    added a new instance of it without any review as far as I can tell.

    Move the two iommu drivers to report errors through ->mapping_error.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Helge Deller

    Christoph Hellwig
     

03 Jul, 2017

1 commit

  • Enabling parport pc driver on a B2600 (and probably other 64bit PARISC
    systems) produced following BUG:

    CPU: 0 PID: 1 Comm: swapper Not tainted 4.12.0-rc5-30198-g1132d5e #156
    task: 000000009e050000 task.stack: 000000009e04c000

    YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI
    PSW: 00001000000001101111111100001111 Not tainted
    r00-03 000000ff0806ff0f 000000009e04c990 0000000040871b78 000000009e04cac0
    r04-07 0000000040c14de0 ffffffffffffffff 000000009e07f098 000000009d82d200
    r08-11 000000009d82d210 0000000000000378 0000000000000000 0000000040c345e0
    r12-15 0000000000000005 0000000040c345e0 0000000000000000 0000000040c9d5e0
    r16-19 0000000040c345e0 00000000f00001c4 00000000f00001bc 0000000000000061
    r20-23 000000009e04ce28 0000000000000010 0000000000000010 0000000040b89e40
    r24-27 0000000000000003 0000000000ffffff 000000009d82d210 0000000040c14de0
    r28-31 0000000000000000 000000009e04ca90 000000009e04cb40 0000000000000000
    sr00-03 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    sr04-07 0000000000000000 0000000000000000 0000000000000000 0000000000000000

    IASQ: 0000000000000000 0000000000000000 IAOQ: 00000000404aece0 00000000404aece4
    IIR: 03ffe01f ISR: 0000000010340000 IOR: 000001781304cac8
    CPU: 0 CR30: 000000009e04c000 CR31: 00000000e2976de2
    ORIG_R28: 0000000000000200
    IAOQ[0]: sba_dma_supported+0x80/0xd0
    IAOQ[1]: sba_dma_supported+0x84/0xd0
    RP(r2): parport_pc_probe_port+0x178/0x1200

    Cause is a call to dma_coerce_mask_and_coherenet in parport_pc_probe_port,
    which PARISC DMA API doesn't handle very nicely. This commit gives back
    DMA_ERROR_CODE for DMA API calls, if device isn't capable of DMA
    transaction.

    Cc: # v3.13+
    Signed-off-by: Thomas Bogendoerfer
    Signed-off-by: Helge Deller

    Thomas Bogendoerfer
     

25 Jan, 2017

1 commit

  • Most dma_map_ops structures are never modified. Constify these
    structures such that these can be write-protected. This patch
    has been generated as follows:

    git grep -l 'struct dma_map_ops' |
    xargs -d\\n sed -i \
    -e 's/struct dma_map_ops/const struct dma_map_ops/g' \
    -e 's/const struct dma_map_ops {/struct dma_map_ops {/g' \
    -e 's/^const struct dma_map_ops;$/struct dma_map_ops;/' \
    -e 's/const const struct dma_map_ops /const struct dma_map_ops /g';
    sed -i -e 's/const \(struct dma_map_ops intel_dma_ops\)/\1/' \
    $(git grep -l 'struct dma_map_ops intel_dma_ops');
    sed -i -e 's/const \(struct dma_map_ops dma_iommu_ops\)/\1/' \
    $(git grep -l 'struct dma_map_ops' | grep ^arch/powerpc);
    sed -i -e '/^struct vmd_dev {$/,/^};$/ s/const \(struct dma_map_ops[[:blank:]]dma_ops;\)/\1/' \
    -e '/^static void vmd_setup_dma_ops/,/^}$/ s/const \(struct dma_map_ops \*dest\)/\1/' \
    -e 's/const \(struct dma_map_ops \*dest = \&vmd->dma_ops\)/\1/' \
    drivers/pci/host/*.c
    sed -i -e '/^void __init pci_iommu_alloc(void)$/,/^}$/ s/dma_ops->/intel_dma_ops./' arch/ia64/kernel/pci-dma.c
    sed -i -e 's/static const struct dma_map_ops sn_dma_ops/static struct dma_map_ops sn_dma_ops/' arch/ia64/sn/pci/pci_dma.c
    sed -i -e 's/(const struct dma_map_ops \*)//' drivers/misc/mic/bus/vop_bus.c

    Signed-off-by: Bart Van Assche
    Reviewed-by: Christoph Hellwig
    Cc: Benjamin Herrenschmidt
    Cc: Boris Ostrovsky
    Cc: David Woodhouse
    Cc: Juergen Gross
    Cc: H. Peter Anvin
    Cc: Ingo Molnar
    Cc: linux-arch@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Cc: Russell King
    Cc: x86@kernel.org
    Signed-off-by: Doug Ledford

    Bart Van Assche
     

04 Aug, 2016

1 commit

  • The dma-mapping core and the implementations do not change the DMA
    attributes passed by pointer. Thus the pointer can point to const data.
    However the attributes do not have to be a bitfield. Instead unsigned
    long will do fine:

    1. This is just simpler. Both in terms of reading the code and setting
    attributes. Instead of initializing local attributes on the stack
    and passing pointer to it to dma_set_attr(), just set the bits.

    2. It brings safeness and checking for const correctness because the
    attributes are passed by value.

    Semantic patches for this change (at least most of them):

    virtual patch
    virtual context

    @r@
    identifier f, attrs;

    @@
    f(...,
    - struct dma_attrs *attrs
    + unsigned long attrs
    , ...)
    {
    ...
    }

    @@
    identifier r.f;
    @@
    f(...,
    - NULL
    + 0
    )

    and

    // Options: --all-includes
    virtual patch
    virtual context

    @r@
    identifier f, attrs;
    type t;

    @@
    t f(..., struct dma_attrs *attrs);

    @@
    identifier r.f;
    @@
    f(...,
    - NULL
    + 0
    )

    Link: http://lkml.kernel.org/r/1468399300-5399-2-git-send-email-k.kozlowski@samsung.com
    Signed-off-by: Krzysztof Kozlowski
    Acked-by: Vineet Gupta
    Acked-by: Robin Murphy
    Acked-by: Hans-Christian Noren Egtvedt
    Acked-by: Mark Salter [c6x]
    Acked-by: Jesper Nilsson [cris]
    Acked-by: Daniel Vetter [drm]
    Reviewed-by: Bart Van Assche
    Acked-by: Joerg Roedel [iommu]
    Acked-by: Fabien Dessenne [bdisp]
    Reviewed-by: Marek Szyprowski [vb2-core]
    Acked-by: David Vrabel [xen]
    Acked-by: Konrad Rzeszutek Wilk [xen swiotlb]
    Acked-by: Joerg Roedel [iommu]
    Acked-by: Richard Kuo [hexagon]
    Acked-by: Geert Uytterhoeven [m68k]
    Acked-by: Gerald Schaefer [s390]
    Acked-by: Bjorn Andersson
    Acked-by: Hans-Christian Noren Egtvedt [avr32]
    Acked-by: Vineet Gupta [arc]
    Acked-by: Robin Murphy [arm64 and dma-iommu]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Krzysztof Kozlowski
     

21 Jan, 2016

1 commit


11 Sep, 2015

1 commit

  • Instead of custom approach let's use recently introduced seq_hex_dump()
    helper.

    In one case it changes the output from
    1111111122222222333333334444444455555555666666667777777788888888
    to
    11111111 22222222 33333333 44444444 55555555 66666666 77777777 88888888

    though it seems it prints same data (by meaning) in both cases. I decide
    to choose to use the space divided one.

    Signed-off-by: Andy Shevchenko
    Acked-by: Helge Deller
    Cc: Alexander Viro
    Cc: Joe Perches
    Cc: Tadeusz Struk
    Cc: Ingo Tuchscherer
    Cc: Catalin Marinas
    Cc: Vladimir Kondratiev
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Shevchenko
     

22 Apr, 2015

1 commit

  • The only reason to keep parisc's private asm/scatterlist.h was that it
    had the macro sg_virt_addr(). Convert all callers to use something else
    (sometimes just sg->offset was enough, others should use sg_virt()), and
    we can just use the asm-generic scatterlist.h instead.

    Signed-off-by: Matthew Wilcox
    Signed-off-by: Dave Anglin
    Signed-off-by: Helge Deller

    Matthew Wilcox