Jiasheng Jiang
eec91694f9
uio: uio_dmem_genirq: Catch the Exception
...
The return value of dma_set_coherent_mask() is not always 0.
To catch the exception in case that dma is not support the mask.
Fixes: 0a0c3b5a24 ("Add new uio device for dynamic memory allocation")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn >
Link: https://lore.kernel.org/r/20211204000326.1592687-1-jiasheng@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-12-05 14:25:00 +01:00
Tianyu Lan
d4dccf353d
Drivers: hv: vmbus: Mark vmbus ring buffer visible to host in Isolation VM
...
Mark vmbus ring buffer visible with set_memory_decrypted() when
establish gpadl handle.
Reviewed-by: Michael Kelley <mikelley@microsoft.com >
Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com >
Link: https://lore.kernel.org/r/20211025122116.264793-5-ltykernel@gmail.com
Signed-off-by: Wei Liu <wei.liu@kernel.org >
2021-10-28 11:22:23 +00:00
Juerg Haefliger
d9eb95845d
uio: Remove leading spaces in Kconfig
...
Remove leading spaces before tabs in Kconfig file(s) by running the
following command:
$ find drivers/uio -name 'Kconfig*' | xargs sed -r -i 's/^[ ]+\t/\t/'
Signed-off-by: Juerg Haefliger <juergh@canonical.com >
Link: https://lore.kernel.org/r/20210517095837.81783-1-juergh@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-21 14:52:37 +02:00
Greg Kroah-Hartman
03e3e31ee5
Merge 50f09a3dd5 ("Merge tag 'char-misc-5.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc") into char-misc-next
...
We want the char/misc driver fixes in here as well
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-21 09:48:31 +02:00
Firas Ashkar
e4e050167f
uio: uio_pci_generic: add memory resource mappings
...
import memory resources from underlying pci device, thus allowing
userspace applications to memory map those resources.
without this change, current implementation, does not populate the
memory maps and are not shown under the corresponding sysfs uio entry:
root@apalis-imx8:~# echo "ad00 0122" > \
/sys/bus/pci/drivers/uio_pci_generic/new_id
[ 55.736433] uio_pci_generic 0000:01:00.0: enabling device (0000 -> 0002)
root@apalis-imx8:~# ls -lsrt /sys/class/uio/uio0/
0 -rw-r--r-- 1 root root 4096 Apr 27 18:52 uevent
0 -r--r--r-- 1 root root 4096 Apr 27 18:52 version
0 -r--r--r-- 1 root root 4096 Apr 27 18:52 suppliers
0 lrwxrwxrwx 1 root root 0 Apr 27 18:52 subsystem
-> ../../../../../../../../../class/uio
0 drwxr-xr-x 2 root root 0 Apr 27 18:52 power
0 -r--r--r-- 1 root root 4096 Apr 27 18:52 name
0 -r--r--r-- 1 root root 4096 Apr 27 18:52 event
0 lrwxrwxrwx 1 root root 0 Apr 27 18:52 device
-> ../../../0000:01:00.0
0 -r--r--r-- 1 root root 4096 Apr 27 18:52 dev
0 -r--r--r-- 1 root root 4096 Apr 27 18:52 consumers
root@apalis-imx8:~#
with the proposed changed, have following instead:
root@apalis-imx8:~# ls -lsrt /sys/class/uio/uio0/
0 -rw-r--r-- 1 root root 4096 Apr 27 19:06 uevent
0 -r--r--r-- 1 root root 4096 Apr 27 19:06 version
0 -r--r--r-- 1 root root 4096 Apr 27 19:06 suppliers
0 lrwxrwxrwx 1 root root 0 Apr 27 19:06 subsystem
-> ../../../../../../../../../class/uio
0 drwxr-xr-x 2 root root 0 Apr 27 19:06 power
0 -r--r--r-- 1 root root 4096 Apr 27 19:06 name
0 drwxr-xr-x 4 root root 0 Apr 27 19:06 maps
0 -r--r--r-- 1 root root 4096 Apr 27 19:06 event
0 lrwxrwxrwx 1 root root 0 Apr 27 19:06 device
-> ../../../0000:01:00.0
0 -r--r--r-- 1 root root 4096 Apr 27 19:06 dev
0 -r--r--r-- 1 root root 4096 Apr 27 19:06 consumers
root@apalis-imx8:~#
root@apalis-imx8:~# ls -lsrt /sys/class/uio/uio0/maps/
0 drwxr-xr-x 2 root root 0 Apr 27 19:07 map1
0 drwxr-xr-x 2 root root 0 Apr 27 19:07 map0
root@apalis-imx8:~#
root@apalis-imx8:~# cat /sys/class/uio/uio0/maps/map1/addr
0x0000000062000000
root@apalis-imx8:~#
root@apalis-imx8:~# cat /sys/class/uio/uio0/maps/map1/size
0x0000000000200000
root@apalis-imx8:~#
tested on AltaData ARINC 429 MiniPCIE module on imx8qm-apalis-ixora-v1.2
Signed-off-by: Firas Ashkar <firas.ashkar@savoirfairelinux.com >
Link: https://lore.kernel.org/r/20210427201046.4005820-1-firas.ashkar@savoirfairelinux.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-14 13:42:11 +02:00
Christophe JAILLET
dccdb2fcd2
uio: uio_aec: Use pci_iounmap instead of iounmap
...
'pci_iomap()' is used in the probe and 'pci_iounmap()' in the error
handling path of the probe.
So keep things consistent and use 'pci_iounmap()' also in the remove
function.
Fixes: 1bafeb378e ("uio: add the uio_aec driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr >
Link: https://lore.kernel.org/r/f6b2a09a45658e8ef552aa34f0b8615dc1c35838.1620546705.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-14 13:39:47 +02:00
Christophe JAILLET
0b0226be3a
uio_hv_generic: Fix another memory leak in error handling paths
...
Memory allocated by 'vmbus_alloc_ring()' at the beginning of the probe
function is never freed in the error handling path.
Add the missing 'vmbus_free_ring()' call.
Note that it is already freed in the .remove function.
Fixes: cdfa835c6e ("uio_hv_generic: defer opening vmbus until first use")
Cc: stable <stable@vger.kernel.org >
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr >
Link: https://lore.kernel.org/r/0d86027b8eeed8e6360bc3d52bcdb328ff9bdca1.1620544055.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-14 13:26:04 +02:00
Christophe JAILLET
3ee098f96b
uio_hv_generic: Fix a memory leak in error handling paths
...
If 'vmbus_establish_gpadl()' fails, the (recv|send)_gpadl will not be
updated and 'hv_uio_cleanup()' in the error handling path will not be
able to free the corresponding buffer.
In such a case, we need to free the buffer explicitly.
Fixes: cdfa835c6e ("uio_hv_generic: defer opening vmbus until first use")
Cc: stable <stable@vger.kernel.org >
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr >
Link: https://lore.kernel.org/r/4fdaff557deef6f0475d02ba7922ddbaa1ab08a6.1620544055.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-14 13:26:01 +02:00
Martin Ågren
156ed0215e
uio/uio_pci_generic: fix return value changed in refactoring
...
Commit ef84928cff ("uio/uio_pci_generic: use device-managed function
equivalents") was able to simplify various error paths thanks to no
longer having to clean up on the way out. Some error paths were dropped,
others were simplified. In one of those simplifications, the return
value was accidentally changed from -ENODEV to -ENOMEM. Restore the old
return value.
Fixes: ef84928cff ("uio/uio_pci_generic: use device-managed function equivalents")
Cc: stable <stable@vger.kernel.org >
Acked-by: Michael S. Tsirkin <mst@redhat.com >
Signed-off-by: Martin Ågren <martin.agren@gmail.com >
Link: https://lore.kernel.org/r/20210422192240.1136373-1-martin.agren@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-14 13:25:27 +02:00
Xu Yilun
bbfb54e7b3
uio: uio_dfl: add userspace i/o driver for DFL bus
...
This patch supports the DFL drivers be written in userspace. This is
realized by exposing the userspace I/O device interfaces.
The driver now only binds the ether group feature, which has no irq. So
the irq support is not implemented yet.
Reviewed-by: Tom Rix <trix@redhat.com >
Signed-off-by: Xu Yilun <yilun.xu@intel.com >
Link: https://lore.kernel.org/r/1615168776-8553-2-git-send-email-yilun.xu@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-28 14:58:18 +02:00
Jie Li
61de21a831
uio: uio_pci_generic: don't fail probe if pdev->irq equals to IRQ_NOTCONNECTED
...
Some devices use 255 as default value of Interrupt Line register, and this
maybe causes pdev->irq is set as IRQ_NOTCONNECTED in some scenarios. For
example, NVMe controller connects to Intel Volume Management Device (VMD).
In this situation, IRQ_NOTCONNECTED means INTx line is not connected, not
fault. If bind uio_pci_generic to these devices, uio frame will return
-ENOTCONN through request_irq.
This patch allows binding uio_pci_generic to device with dev->irq of
IRQ_NOTCONNECTED.
Acked-by: Kyungsan Kim <ks0204.kim@samsung.com >
Signed-off-by: Jie Li <jie6.li@samsung.com >
Link: https://lore.kernel.org/r/1612153559-17028-1-git-send-email-jie6.li@samsung.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-02-09 12:25:32 +01:00
Alexandru Ardelean
74e71964b1
uio: uio_hv_generic: use devm_kzalloc() for private data alloc
...
This is a minor cleanup for the management of the private object of this
driver. The allocation can be tied to the life-time of the hv_device
object.
This cleans up a bit the exit & error paths, since the object doesn't need
to be explicitly free'd anymore.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com >
Link: https://lore.kernel.org/r/20201119154903.82099-4-alexandru.ardelean@analog.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-12-09 19:59:00 +01:00
Alexandru Ardelean
d57801c45f
uio: uio_fsl_elbc_gpcm: use device-managed allocators
...
This change moves all the simple allocations to use device-managed
allocator functions. This way their life-time is tied to the
platform_device object, so when this gets free'd these allocations also get
cleaned up.
The final effect is that error & exit paths get cleaned up a bit.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com >
Link: https://lore.kernel.org/r/20201119154903.82099-3-alexandru.ardelean@analog.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-12-09 19:59:00 +01:00
Alexandru Ardelean
16d546c42d
uio: uio_aec: use devm_kzalloc() for uio_info object
...
The uio_info object is free'd last, so it's life-time is tied PCI device
object. Using devm_kzalloc() cleans up the error path a bit and the exit
path.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com >
Link: https://lore.kernel.org/r/20201119154903.82099-2-alexandru.ardelean@analog.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-12-09 19:59:00 +01:00
Alexandru Ardelean
0a4ade5397
uio: uio_cif: use devm_kzalloc() for uio_info object
...
The uio_info object is free'd last, so it's life-time is tied PCI device
object. Using devm_kzalloc() cleans up the error path a bit and the exit
path.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com >
Link: https://lore.kernel.org/r/20201119154903.82099-1-alexandru.ardelean@analog.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-12-09 19:59:00 +01:00
Alexandru Ardelean
c3a7477911
uio: uio_netx: use devm_kzalloc() for or uio_info object
...
This change uses the devm_kzalloc() function to tie the life-time of the
uio_info object to PCI device. This cleans up the exit & error path a bit.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com >
Link: https://lore.kernel.org/r/20201120084207.50736-3-alexandru.ardelean@analog.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-12-09 19:58:54 +01:00
Alexandru Ardelean
6b76c98b96
uio: uio_mf624: use devm_kzalloc() for uio_info object
...
This change uses the devm_kzalloc() function to tie the life-time of the
uio_info object to PCI device. This cleans up the exit & error path a bit.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com >
Link: https://lore.kernel.org/r/20201120084207.50736-2-alexandru.ardelean@analog.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-12-09 19:58:54 +01:00
Alexandru Ardelean
023c9c6dc2
uio: uio_sercos3: use device-managed functions for simple allocs
...
This change converts the simple allocations [kzalloc()] to devm_kzalloc()
tying the life-time of these objects to the PCI device object.
It cleans up the error and exit path and bit, and does a minor correction
that -ENOMEM is returned (vs -ENODEV) in case the 'priv' object cannot be
allocated.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com >
Link: https://lore.kernel.org/r/20201120084207.50736-1-alexandru.ardelean@analog.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-12-09 19:58:54 +01:00
Alexandru Ardelean
ba022851f3
uio: uio_dmem_genirq: finalize conversion of probe to devm_ handlers
...
This moves move pm_runtime_disable on a devm_add_action_or_reset() handler.
And with the use of the devm_uio_register_device() function, the remove
hook is no longer required.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com >
Link: https://lore.kernel.org/r/20201120075625.12272-2-alexandru.ardelean@analog.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-12-09 19:58:22 +01:00
Alexandru Ardelean
44dccc4a2b
uio: uio_dmem_genirq: convert simple allocations to device-managed
...
This change converts the simple allocations in the driver to used
device-managed allocation functions.
This removes the error path entirely in the probe function, and reduces
some code in the remove function.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com >
Link: https://lore.kernel.org/r/20201120075625.12272-1-alexandru.ardelean@analog.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-12-09 19:58:22 +01:00
Alexandru Ardelean
4849e0eda3
uio/uio_pci_generic: remove unneeded pci_set_drvdata()
...
The pci_get_drvdata() was moved during commit ef84928cff
("uio/uio_pci_generic: use device-managed function equivalents").
Storing a private object with pci_set_drvdata() doesn't make sense
since that change, since there is no more pci_get_drvdata() call in the
driver to retrieve the information.
This change removes it.
Fixes: ef84928cff ("uio/uio_pci_generic: use device-managed function equivalents")
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com >
Link: https://lore.kernel.org/r/20201123143447.16829-1-alexandru.ardelean@analog.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-12-09 19:57:20 +01:00
Alexandru Ardelean
68d6211971
uio: pruss: use devm_clk_get() for clk init
...
This change uses devm_clk_get() to obtain a reference to the clock. It has
the benefit that clk_put() is no longer required, and cleans up the exit &
error path.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com >
Link: https://lore.kernel.org/r/20201119145059.48326-1-alexandru.ardelean@analog.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-12-09 19:57:03 +01:00
Greg Kroah-Hartman
93c69b2d17
Merge 5.10-rc4 into char-misc-next
...
We need the char/misc fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-11-16 09:18:46 +01:00
Alexandru Ardelean
ef84928cff
uio/uio_pci_generic: use device-managed function equivalents
...
This driver can be easily converted to use the device-managed allocator
function and the PCI managed enable function.
With these conversions the probe error paths are no longer needed and
neither is the remove function.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com >
Link: https://lore.kernel.org/r/20201111113828.64992-1-alexandru.ardelean@analog.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-11-14 00:24:45 +01:00
Alexandru Ardelean
cfd3443e2d
uio: pruss: move simple allocations to dem_ equivalents
...
This change moves the simple allocations to their device-managed
equivalents.
This cleans up some error/exit paths.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com >
Link: https://lore.kernel.org/r/20201111112242.62116-1-alexandru.ardelean@analog.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-11-13 16:37:06 +01:00