10 Sep, 2020

1 commit

  • The Documentation/DMA-API-HOWTO.txt states that the dma_map_sg() function
    returns the number of the created entries in the DMA address space.
    However the subsequent calls to the dma_sync_sg_for_{device,cpu}() and
    dma_unmap_sg must be called with the original number of the entries
    passed to the dma_map_sg().

    struct sg_table is a common structure used for describing a non-contiguous
    memory buffer, used commonly in the DRM and graphics subsystems. 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 DMA-mapping functions with a wrong number of entries or
    ignoring the number of mapped entries returned by the dma_map_sg()
    function.

    To avoid such issues, lets use a common dma-mapping wrappers operating
    directly on the struct sg_table objects and use scatterlist page
    iterators where possible. This, almost always, hides references to the
    nents and orig_nents entries, making the code robust, easier to follow
    and copy/paste safe.

    While touching this code, also add missing call to dma_unmap_sgtable.

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

    Marek Szyprowski
     

10 Jul, 2020

1 commit

  • Instead of duplicating the PCI_VENDOR_ID_REDHAT definition everywhere, move
    it to include/linux/pci_ids.h.

    [bhelgaas: also update MDPY_PCI_VENDOR_ID]
    Link: https://lore.kernel.org/r/1594195170-11119-1-git-send-email-chenhc@lemote.com
    Signed-off-by: Huacai Chen
    Signed-off-by: Bjorn Helgaas
    Acked-by: Gerd Hoffmann

    Huacai Chen
     

22 Apr, 2020

1 commit

  • remap_vmalloc_range() has had various issues with the bounds checks it
    promises to perform ("This function checks that addr is a valid
    vmalloc'ed area, and that it is big enough to cover the vma") over time,
    e.g.:

    - not detecting pgoff<<<<
    Signed-off-by: Andrew Morton
    Cc: stable@vger.kernel.org
    Cc: Alexei Starovoitov
    Cc: Daniel Borkmann
    Cc: Martin KaFai Lau
    Cc: Song Liu
    Cc: Yonghong Song
    Cc: Andrii Nakryiko
    Cc: John Fastabend
    Cc: KP Singh
    Link: http://lkml.kernel.org/r/20200415222312.236431-1-jannh@google.com
    Signed-off-by: Linus Torvalds

    Jann Horn
     

10 Dec, 2019

1 commit

  • Now that the fbops member of struct fb_info is const, we can start
    making the ops const as well.

    v2: fix typo (Christophe de Dinechin)

    Cc: Kirti Wankhede
    Cc: kvm@vger.kernel.org
    Reviewed-by: Daniel Vetter
    Acked-by: Kirti Wankhede
    Signed-off-by: Jani Nikula
    Link: https://patchwork.freedesktop.org/patch/msgid/ddb10df1316ef585930cda7718643a580f4fe37b.1575390741.git.jani.nikula@intel.com

    Jani Nikula
     

26 Nov, 2019

1 commit


20 Aug, 2019

1 commit

  • While generating interrupt, mdev_state is already available for which
    interrupt is generated.
    Instead of doing indirect way from state->device->uuid-> to searching
    state linearly in linked list on every interrupt generation,
    directly use the available state.

    Hence, simplify the code to use mdev_state and remove unused helper
    function with that.

    Reviewed-by: Cornelia Huck
    Signed-off-by: Parav Pandit
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Alex Williamson

    Parav Pandit
     

25 Jul, 2019

1 commit

  • The "WITH Linux-syscall-note" exception exists for headers exported to
    user space. It is strange to add it to non-exported headers.

    Commit 687a3e4d8e61 ("treewide: remove SPDX "WITH Linux-syscall-note"
    from kernel-space headers") did cleanups some months ago, but it looks
    like we need to do this periodically.

    This patch was generated by the following script:

    git grep -l -e Linux-syscall-note \
    -- :*.h :^arch/*/include/uapi/asm/*.h :^include/uapi/ :^tools |
    while read file
    do
    sed -i -e 's/(\(GPL-[^[:space:]]*\) WITH Linux-syscall-note)/\1/g' \
    -e 's/ WITH Linux-syscall-note//g' $file
    done

    I did not commit drivers/staging/android/uapi/ion.h . This header is
    not currently exported, but somebody may plan to move it to include/uapi/
    when the time comes. I am not sure. Anyway, it will be better to check
    the license inconsistency in drivers/staging/android/uapi/.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Masahiro Yamada
     

03 Jul, 2019

2 commits

  • Fixes gcc '-Wunused-but-set-variable' warning:

    samples/vfio-mdev/mbochs.c: In function mbochs_ioctl:
    samples/vfio-mdev/mbochs.c:1188:21: warning: variable mdev_state set but not used [-Wunused-but-set-variable]

    It's not used any more since commit 104c7405a64d ("vfio:
    add edid support to mbochs sample driver")

    Signed-off-by: YueHaibing
    Signed-off-by: Alex Williamson

    YueHaibing
     
  • Make some structs and functions static to fix build warning, parts of
    warning shown below,

    samples/vfio-mdev/mtty.c:730:5: warning: symbol 'mtty_create' was not declared. Should it be static?
    samples/vfio-mdev/mtty.c:780:5: warning: symbol 'mtty_remove' was not declared. Should it be static?
    samples/vfio-mdev/mtty.c:802:5: warning: symbol 'mtty_reset' was not declared. Should it be static?
    samples/vfio-mdev/mtty.c:818:9: warning: symbol 'mtty_read' was not declared. Should it be static?
    samples/vfio-mdev/mtty.c:877:9: warning: symbol 'mtty_write' was not declared. Should it be static?
    samples/vfio-mdev/mtty.c:1070:5: warning: symbol 'mtty_get_region_info' was not declared. Should it be static?
    samples/vfio-mdev/mtty.c:1119:5: warning: symbol 'mtty_get_irq_info' was not declared. Should it be static?
    samples/vfio-mdev/mtty.c:1143:5: warning: symbol 'mtty_get_device_info' was not declared. Should it be static?
    samples/vfio-mdev/mtty.c:1275:5: warning: symbol 'mtty_open' was not declared. Should it be static?
    samples/vfio-mdev/mtty.c:1281:6: warning: symbol 'mtty_close' was not declared. Should it be static?
    samples/vfio-mdev/mtty.c:1305:30: warning: symbol 'mtty_dev_groups' was not declared. Should it be static?

    Cc: Andy Shevchenko
    Cc: Alex Williamson
    Cc: Kirti Wankhede
    Reported-by: Hulk Robot
    Signed-off-by: Kefeng Wang
    Reviewed-by: Andy Shevchenko
    [aw: wrap long lines]
    Signed-off-by: Alex Williamson

    Kefeng Wang
     

19 Jun, 2019

1 commit

  • Based on 2 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 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 #

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

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

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

    Thomas Gleixner
     

21 May, 2019

1 commit


13 Feb, 2019

3 commits


06 Feb, 2019

1 commit

  • There are new types and helpers that are supposed to be used in new code.

    As a preparation to get rid of legacy types and API functions do
    the conversion here.

    Cc: Kirti Wankhede
    Cc: Alex Williamson
    Signed-off-by: Andy Shevchenko
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Alex Williamson

    Andy Shevchenko
     

18 Dec, 2018

1 commit

  • Clang warns:

    samples/vfio-mdev/mtty.c:592:39: warning: implicit conversion from 'int'
    to 'char' changes value from 162 to -94 [-Wconstant-conversion]
    *buf = UART_MSR_DSR | UART_MSR_DDSR | UART_MSR_DCD;
    ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
    1 warning generated.

    Turns out that all uses of buf in this function ultimately end up stored
    or cast to an unsigned type. Just use u8, which has the same number of
    bits but can store this larger number so Clang no longer warns.

    Signed-off-by: Nathan Chancellor
    Signed-off-by: Alex Williamson

    Nathan Chancellor
     

12 Oct, 2018

1 commit


12 Jul, 2018

1 commit


05 Jul, 2018

1 commit


26 Jun, 2018

2 commits


09 Jun, 2018

3 commits


23 Mar, 2018

1 commit

  • When FIFO mode is enabled, the receive data available interrupt
    (UART_IIR_RDI in code) should be triggered when the number of data
    in FIFO is equal or larger than interrupt trigger level.

    This patch changes the trigger level check to ensure multiple bytes
    received from upper layer can trigger RDI interrupt correctly.

    Cc: Joey Zheng
    Signed-off-by: Shunyong Yang
    Reviewed by: Kirti Wankhede
    Signed-off-by: Alex Williamson

    Shunyong Yang
     

03 Oct, 2017

1 commit


12 Jan, 2017

3 commits

  • We set info.count to 1 in mtty_get_irq_info() so static checkers
    complain that, "Why do we have impossible conditions?" The answer is
    that it seems to be left over dead code that can be safely removed.

    Signed-off-by: Dan Carpenter
    Reviewed-by: Kirti Wankhede
    Signed-off-by: Alex Williamson

    Dan Carpenter
     
  • This is a sample driver for documentation so the impact is probably
    pretty low. But we should check that bar_index is valid so we
    don't write beyond the end of the mdev_state->region_info[] array.

    Fixes: 9d1a546c53b4 ("docs: Sample driver to demonstrate how to use Mediated device framework.")
    Signed-off-by: Dan Carpenter
    Reviewed-by: Kirti Wankhede
    Signed-off-by: Alex Williamson

    Dan Carpenter
     
  • The copy_to_user() function returns the number of bytes which it wasn't
    able to copy but we want to return a negative error code.

    Fixes: 9d1a546c53b4 ("docs: Sample driver to demonstrate how to use Mediated device framework.")
    Signed-off-by: Dan Carpenter
    Reviewed-by: Kirti Wankhede
    Signed-off-by: Alex Williamson

    Dan Carpenter
     

04 Jan, 2017

1 commit


30 Dec, 2016

4 commits


18 Nov, 2016

1 commit