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
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
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
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
26 Nov, 2019
1 commit
-
No in-tree users left.
Acked-by: Sumit Semwal
Acked-by: Gerd Hoffmann
Signed-off-by: Daniel Vetter
Cc: Kirti Wankhede
Cc: kvm@vger.kernel.org
Link: https://patchwork.freedesktop.org/patch/msgid/20191118103536.17675-15-daniel.vetter@ffwll.ch
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
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
doneI 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
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 -
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
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 foundationthis 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
21 May, 2019
1 commit
-
Add SPDX license identifiers to all Make/Kconfig files which:
- Have no license information of any form
These files fall under the project license, GPL v2 only. The resulting SPDX
license identifier is:GPL-2.0-only
Signed-off-by: Thomas Gleixner
Signed-off-by: Greg Kroah-Hartman
13 Feb, 2019
3 commits
-
Actually, total amount of available minor number
for a single major is MINORMARK + 1. So expand
minor range when registering chrdev region.Signed-off-by: Chengguang Xu
Signed-off-by: Alex Williamson -
Actually, total amount of available minor number
for a single major is MINORMARK + 1. So expand
minor range when registering chrdev region.Signed-off-by: Chengguang Xu
Signed-off-by: Alex Williamson -
Actually, total amount of available minor number
for a single major is MINORMARK + 1. So expand
minor range when registering chrdev region.Signed-off-by: Chengguang Xu
Signed-off-by: Alex Williamson
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
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
12 Oct, 2018
1 commit
-
Signed-off-by: Gerd Hoffmann
Signed-off-by: Alex Williamson
12 Jul, 2018
1 commit
-
mdev_access() calls mbochs_get_page() with mdev_state->ops_lock held,
while mbochs_get_page() locks the mutex by itself.
It leads to unavoidable deadlock.Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov
Signed-off-by: Alex Williamson
05 Jul, 2018
1 commit
-
convert mbochs_region_vm_fault and mbochs_dmabuf_vm_fault
to return vm_fault_t type.Signed-off-by: Souptick Joarder
Signed-off-by: Alex Williamson
26 Jun, 2018
2 commits
-
There is no default implementation for dma_buf_ops->unmap.
So add a function unmapping the page, otherwise we'll leak them.Signed-off-by: Gerd Hoffmann
Signed-off-by: Alex Williamson -
Atomic mapping interface for dmabufs will be removed.
Signed-off-by: Gerd Hoffmann
Signed-off-by: Alex Williamson
09 Jun, 2018
3 commits
-
Display device, demo-ing the vfio dmabuf display interface
(VFIO_GFX_PLANE_TYPE_DMABUF). Compatible enough to qemu stdvga
that bochs-drm.ko can be used as guest driver.Signed-off-by: Gerd Hoffmann
Signed-off-by: Alex Williamson -
Guest fbdev driver for CONFIG_SAMPLE_VFIO_MDEV_MDPY.
Signed-off-by: Gerd Hoffmann
Signed-off-by: Alex Williamson -
Simple framebuffer display, demo-ing the vfio region display interface
(VFIO_GFX_PLANE_TYPE_REGION).Signed-off-by: Gerd Hoffmann
Signed-off-by: Alex Williamson
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
03 Oct, 2017
1 commit
-
Make this const as it is only passed to a const argument of the function
mdev_register_device. Make it static as it is not referenced in any
other file.Structure found using Coccinelle and changes done by hand.
Signed-off-by: Bhumika Goyal
Signed-off-by: Alex Williamson
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 -
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 -
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
04 Jan, 2017
1 commit
-
This is just sample code. We forget to set the error codes in a couple
places.Signed-off-by: Dan Carpenter
Reported-by: Alexey Khoroshilov
Signed-off-by: Alex Williamson
30 Dec, 2016
4 commits
-
Abstract access to mdev_device so that we can define which interfaces
are public rather than relying on comments in the structure.Cc: Zhenyu Wang
Cc: Zhi Wang
Signed-off-by: Alex Williamson
Reviewed-by: Jike Song
Reviewed by: Kirti Wankhede -
Rather than hoping for good behavior by marking some elements
internal, enforce it by making the entire structure private and
creating an accessor function for the one useful external field.Cc: Zhenyu Wang
Cc: Zhi Wang
Cc: Jike Song
Signed-off-by: Alex Williamson
Reviewed by: Kirti Wankhede -
Add an mdev_ prefix so we're not poluting the namespace so much.
Cc: Zhenyu Wang
Cc: Zhi Wang
Cc: Jike Song
Signed-off-by: Alex Williamson
Reviewed by: Kirti Wankhede -
This sample driver was originally under Documentation/ and was moved
to samples, but build support was never adjusted for the new location.Signed-off-by: Alex Williamson
Reviewed-by: Eric Auger
Tested-by: Eric Auger
Reviewed-by: Kirti Wankhede
18 Nov, 2016
1 commit
-
The Sample driver creates mdev device that simulates serial port over PCI
card.Signed-off-by: Kirti Wankhede
Signed-off-by: Neo Jia
Signed-off-by: Alex Williamson