22 May, 2017

1 commit


18 May, 2017

1 commit

  • Some userspace drivers and frameworks only poll and do not
    require interrupts to be available and enabled on the
    PCI device. So remove the requirement that an IRQ is
    assigned. If an IRQ is not assigned and a userspace
    driver tries to read()/write(), the generic uio
    framework will just return -EIO.

    This allows binding uio_pci_generic to devices which
    cannot get an IRQ assigned, such as an NVMe controller
    behind Intel Volume Management Device (VMD), since VMD
    does not support INTx interrupts.

    Signed-off-by: Jim Harris
    Acked-by: Michael S. Tsirkin
    Signed-off-by: Greg Kroah-Hartman

    Jim Harris
     

17 May, 2017

1 commit

  • Commit 75f0aef6220d ("uio: fix memory leak") has fixed up some
    memory leaks during the failure paths of the addition of uio
    attributes, but still is not correct entirely. A kobject_uevent()
    failure still needs a kobject_put() and the kobject container
    structure allocation failure before the kobject_init() doesn't
    need a kobject_put(). Fix this properly.

    Fixes: 75f0aef6220d ("uio: fix memory leak")
    Signed-off-by: Suman Anna
    Signed-off-by: Greg Kroah-Hartman

    Suman Anna
     

09 Apr, 2017

3 commits

  • mf624 card has its registers not aligned to pages. Since commit
    b65502879556 ("uio: we cannot mmap unaligned page contents") mmap()ing
    mf624 registers fails, because now the uio drivers must set
    uio_mem->addr to be page-aligned.

    We align the address here and set the newly introduced offs field to
    the offset of the mf264 registers within the page so that userspace
    can find the address of the mmap()ed register by reading
    /sys/class/uio/uio?/maps/map?/offset.

    Tested with real mf624 card.

    Signed-off-by: Michal Sojka
    Signed-off-by: Greg Kroah-Hartman

    Michal Sojka
     
  • No functional changes. Move initialization of struct uio_mem to a
    function. This will allow the next commit to change the initialization
    code at a single place rather that at three different places.

    Signed-off-by: Michal Sojka
    Signed-off-by: Greg Kroah-Hartman

    Michal Sojka
     
  • Since commit b65502879556 ("uio: we cannot mmap unaligned page
    contents") addresses and sizes of UIO memory regions must be
    page-aligned. If the address in the BAR register is not
    page-aligned (which is the case of the mf264 card), the mentioned
    commit forces the UIO driver to round the address down to the page
    size. Then, there is no easy way for user-space to learn the offset of
    the actual memory region within the page, because the offset seen in
    /sys/class/uio/uio?/maps/map?/offset is calculated from the rounded
    address and thus it is always zero.

    Fix that problem by including the offset in struct uio_mem. UIO
    drivers can set this field and userspace can read its value from
    /sys/class/uio/uio?/maps/map?/offset.

    The following commits update the uio_mf264 driver to set this new offs
    field.

    Drivers for hardware with page-aligned BARs need not to be modified
    provided that they initialize struct uio_info (which contains uio_mem)
    with zeros.

    Signed-off-by: Michal Sojka
    Signed-off-by: Greg Kroah-Hartman

    Michal Sojka
     

02 Mar, 2017

1 commit


25 Feb, 2017

1 commit

  • ->fault(), ->page_mkwrite(), and ->pfn_mkwrite() calls do not need to
    take a vma and vmf parameter when the vma already resides in vmf.

    Remove the vma parameter to simplify things.

    [arnd@arndb.de: fix ARM build]
    Link: http://lkml.kernel.org/r/20170125223558.1451224-1-arnd@arndb.de
    Link: http://lkml.kernel.org/r/148521301778.19116.10840599906674778980.stgit@djiang5-desk3.ch.intel.com
    Signed-off-by: Dave Jiang
    Signed-off-by: Arnd Bergmann
    Reviewed-by: Ross Zwisler
    Cc: Theodore Ts'o
    Cc: Darrick J. Wong
    Cc: Matthew Wilcox
    Cc: Dave Hansen
    Cc: Christoph Hellwig
    Cc: Jan Kara
    Cc: Dan Williams
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Jiang
     

15 Feb, 2017

1 commit

  • Change the simple boolean batched_reading into a tri-value.
    For future NAPI support in netvsc driver, the callback needs to
    occur directly in interrupt handler.

    Batched mode is also changed to disable host interrupts immediately
    in interrupt routine (to avoid unnecessary host signals), and the
    tasklet is rescheduled if more data is detected.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: K. Y. Srinivasan
    Signed-off-by: Greg Kroah-Hartman

    Stephen Hemminger
     

10 Dec, 2016

1 commit

  • gcc warns about the newly added driver when phys_addr_t is wider than
    a pointer:

    drivers/uio/uio_hv_generic.c: In function 'hv_uio_mmap':
    drivers/uio/uio_hv_generic.c:71:17: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
    virt_to_phys((void *)info->mem[mi].addr) >> PAGE_SHIFT,
    drivers/uio/uio_hv_generic.c: In function 'hv_uio_probe':
    drivers/uio/uio_hv_generic.c:140:5: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
    = (phys_addr_t)dev->channel->ringbuffer_pages;
    drivers/uio/uio_hv_generic.c:147:3: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
    (phys_addr_t)vmbus_connection.int_page;
    drivers/uio/uio_hv_generic.c:153:3: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
    (phys_addr_t)vmbus_connection.monitor_pages[1];

    I can't see why we store a virtual address in a phys_addr_t here,
    as the only user of that variable converts it into a physical
    address anyway, so this moves the conversion to where it logically
    fits according to the types.

    Fixes: 95096f2fbd10 ("uio-hv-generic: new userspace i/o driver for VMBus")
    Signed-off-by: Arnd Bergmann
    Acked-by: Stephen Hemminger
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     

06 Dec, 2016

1 commit


30 Nov, 2016

1 commit

  • pruss_probe() enables gdev->pruss_clk, but there is no clk_disable()
    in the driver.

    The patch adds clk_disable() to pruss_cleanup() and error handling for
    clk_enable().

    Found by Linux Driver Verification project (linuxtesting.org).

    Signed-off-by: Alexey Khoroshilov
    Signed-off-by: Greg Kroah-Hartman

    Alexey Khoroshilov
     

31 Aug, 2016

1 commit

  • The variable i contains a total number of resources (including
    IORESOURCE_IRQ). However, we want the dmem_region_start to point
    after the last resource of type IORESOURCE_MEM. The original behaviour
    leads (very likely) to skipping several UIO mapping regions and makes
    them useless. Fix this by computing dmem_region_start from the uiomem
    which points to the last used UIO mapping.

    Fixes: 0a0c3b5a24bd ("Add new uio device for dynamic memory allocation")

    Signed-off-by: Jan Viktorin
    Signed-off-by: Greg Kroah-Hartman

    Jan Viktorin
     

02 May, 2016

1 commit

  • My static checker complains that "ret" could be uninitialized at the
    end, which is true but it's more likely that it would be set to zero.

    Signed-off-by: Dan Carpenter
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter
     

04 Oct, 2015

2 commits

  • Andy has reported a __might_sleep warning
    [ 5174.883617] WARNING: CPU: 0 PID: 1532 at
    /home/agrover/git/kernel/kernel/sched/core.c:7389 __might_sleep+0x7d/0x90()
    [ 5174.884407] do not call blocking ops when !TASK_RUNNING; state=1 set at [] uio_read+0x91/0x170 [uio]
    [ 5174.885198] Modules linked in: tcm_loop target_core_user uio target_core_pscsi target_core_file target_core_iblock iscsi_target_mod target_core_mod uinput fuse nfsv3 nfs_acl nfs lockd grace fscache sunrpc microcode i2c_piix4 virtio_balloon i2c_core xfs libcrc32c crc32c_intel virtio_net virtio_blk
    [ 5174.887351] CPU: 0 PID: 1532 Comm: tcmu-runner Not tainted 4.2.0-rc7+
    [ 5174.887853] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
    BIOS 1.8.1-20150318_183358- 04/01/2014
    [ 5174.888633] ffffffff81a3b870 ffff880045393ca8 ffffffff817afaae
    0000000000000000
    [ 5174.889224] ffff880045393cf8 ffff880045393ce8 ffffffff8109a846
    ffff880045393cd8
    [ 5174.889793] ffffffffa02a7150 00000000000002dc 0000000000000000
    ffff880045008000
    [ 5174.890375] Call Trace:
    [ 5174.890562] [] dump_stack+0x4c/0x65
    [ 5174.890938] [] warn_slowpath_common+0x86/0xc0
    [ 5174.891388] [] warn_slowpath_fmt+0x46/0x50
    [ 5174.891808] [] ? uio_read+0x91/0x170 [uio]
    [ 5174.892237] [] ? uio_read+0x91/0x170 [uio]
    [ 5174.892653] [] __might_sleep+0x7d/0x90
    [ 5174.893055] [] __might_fault+0x43/0xa0
    [ 5174.893448] [] ? schedule+0x3e/0x90
    [ 5174.893820] [] uio_read+0x132/0x170 [uio]
    [ 5174.894240] [] ? wake_up_q+0x70/0x70
    [ 5174.894620] [] __vfs_read+0x28/0xe0
    [ 5174.894993] [] ? security_file_permission+0xa3/0xc0
    [ 5174.895541] [] ? rw_verify_area+0x4f/0xf0
    [ 5174.896006] [] vfs_read+0x8a/0x140
    [ 5174.896391] [] ? __schedule+0x425/0xcc0
    [ 5174.896788] [] SyS_read+0x49/0xb0

    The warning is a false positive because uio_read doesn't depent on
    TASK_INTERRUPTIBLE after copy_to_user so it is safe to silence the
    warning by an explicit setting the state to TASK_RUNNING in the path
    which might call into TASK_RUNNING.

    Reported-by: Andy Grover
    Signed-off-by: Michal Hocko
    Signed-off-by: Greg Kroah-Hartman

    Michal Hocko
     
  • This platform driver has a OF device ID table but the OF module
    alias information is not created so module autoloading won't work.

    Signed-off-by: Luis de Bethencourt
    Signed-off-by: Greg Kroah-Hartman

    Luis de Bethencourt
     

06 Aug, 2015

3 commits

  • If NO_DMA=y:

    ERROR: "dma_alloc_coherent" [drivers/uio/uio_pruss.ko] undefined!
    ERROR: "dma_free_coherent" [drivers/uio/uio_pruss.ko] undefined!

    Add a dependency on HAS_DMA to fix this.

    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Greg Kroah-Hartman

    Geert Uytterhoeven
     
  • Use module_platform_driver for drivers whose init and exit functions
    only register and unregister, respectively.

    A simplified version of the Coccinelle semantic patch that performs
    this transformation is as follows:

    @a@
    identifier f, x;
    @@
    -static f(...) { return platform_driver_register(&x); }

    @b depends on a@
    identifier e, a.x;
    @@
    -static e(...) { platform_driver_unregister(&x); }

    @c depends on a && b@
    identifier a.f;
    declarer name module_init;
    @@
    -module_init(f);

    @d depends on a && b && c@
    identifier b.e, a.x;
    declarer name module_exit;
    declarer name module_platform_driver;
    @@
    -module_exit(e);
    +module_platform_driver(x);

    Signed-off-by: Vaishali Thakkar
    Signed-off-by: Greg Kroah-Hartman

    Vaishali Thakkar
     
  • Destroy uio_idr on module exit, reclaiming the allocated memory.

    This was detected by the following semantic patch (written by Luis Rodriguez
    )

    @ defines_module_init @
    declarer name module_init, module_exit;
    declarer name DEFINE_IDR;
    identifier init;
    @@

    module_init(init);

    @ defines_module_exit @
    identifier exit;
    @@

    module_exit(exit);

    @ declares_idr depends on defines_module_init && defines_module_exit @
    identifier idr;
    @@

    DEFINE_IDR(idr);

    @ on_exit_calls_destroy depends on declares_idr && defines_module_exit @
    identifier declares_idr.idr, defines_module_exit.exit;
    @@

    exit(void)
    {
    ...
    idr_destroy(&idr);
    ...
    }

    @ missing_module_idr_destroy depends on declares_idr && defines_module_exit && !on_exit_calls_destroy @
    identifier declares_idr.idr, defines_module_exit.exit;
    @@

    exit(void)
    {
    ...
    +idr_destroy(&idr);
    }

    Signed-off-by: Johannes Thumshirn
    Signed-off-by: Greg Kroah-Hartman

    Johannes Thumshirn
     

13 Jun, 2015

3 commits


25 May, 2015

1 commit

  • UIO base driver should only free_irq that it has requested.
    UIO supports drivers without interrupts (irq == 0) or custom handlers.

    This fixes warnings like:

    WARNING: CPU: 1 PID: 5478 at kernel/irq/manage.c:1244 __free_irq+0xa9/0x1e0()
    Trying to free already-free IRQ 0

    Signed-off-by: Stephen Hemminger
    Signed-off-by: Greg Kroah-Hartman

    Stephen Hemminger
     

03 Apr, 2015

1 commit


25 Mar, 2015

1 commit


20 Mar, 2015

1 commit

  • Separate irq request/free from the device lifecycle.
    After device unregister the parent module can call pci_disable_msi.
    >From the PCI MSI how to:

    "Before calling this function, a device driver must always call free_irq()
    on any interrupt for which it previously called request_irq().
    Failure to do so results in a BUG_ON(), leaving the device with
    MSI enabled and thus leaking its vector."

    So we need to separately free the irq at unregister to allow the device
    to be kept around in the case of it still having open FDs.

    Signed-off-by: Brian Russell
    Signed-off-by: Greg Kroah-Hartman

    Brian Russell
     

12 Jan, 2015

2 commits


15 Dec, 2014

1 commit

  • Pull char/misc driver updates from Greg KH:
    "Here's the big char/misc driver update for 3.19-rc1

    Lots of little things all over the place in different drivers, and a
    new subsystem, "coresight" has been added. Full details are in the
    shortlog"

    * tag 'char-misc-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (73 commits)
    parport: parport_pc, do not remove parent devices early
    spmi: Remove shutdown/suspend/resume kernel-doc
    carma-fpga-program: drop videobuf dependency
    carma-fpga: drop videobuf dependency
    carma-fpga-program.c: fix compile errors
    i8k: Fix temperature bug handling in i8k_get_temp()
    cxl: Name interrupts in /proc/interrupt
    CXL: Return error to PSL if IRQ demultiplexing fails & print clearer warning
    coresight-replicator: remove .owner field for driver
    coresight: fixed comments in coresight.h
    coresight: fix typo in comment in coresight-priv.h
    coresight: bindings for coresight drivers
    coresight: Adding ABI documentation
    w1: support auto-load of w1_bq27000 module.
    w1: avoid potential u16 overflow
    cn: verify msg->len before making callback
    mei: export fw status registers through sysfs
    mei: read and print all six FW status registers
    mei: txe: add cherrytrail device id
    mei: kill cached host and me csr values
    ...

    Linus Torvalds
     

08 Nov, 2014

1 commit


04 Nov, 2014

1 commit


20 Oct, 2014

1 commit


03 Oct, 2014

1 commit

  • In order to prevent a O(n) search of the filesystem to link up its uio
    node with its target configuration, TCMU needs to know the minor number
    that UIO assigned. Expose the definition of this struct so TCMU can
    access this field.

    Signed-off-by: Andy Grover
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     

14 Jul, 2014

1 commit


10 Jul, 2014

1 commit


18 Jun, 2014

1 commit

  • This reverts commit ddb09754e6c7239e302c7b675df9bbd415f8de5d.

    Linus objected to this originally, I can see why it might be needed, but
    given that no one spoke up defending this patch, I'm going to revert it.

    If you have hardware that requires this change, please speak up in the
    future and defend the patch.

    Reported-by: Linus Torvalds
    Cc: Bin Wang
    Cc: Nobuhiro Iwamatsu
    Cc: Norbert Ciosek
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

28 May, 2014

2 commits

  • the vma range size is always page size aligned in mmap, while the
    real io space range may not be page aligned, thus leading to range
    check failure in the uio_mmap_physical().

    for example, in a case of io range size "mem->size == 1KB", and we
    have (vma->vm_end - vma->vm_start) == 4KB, due to "len" is aligned
    to page size in do_mmap_pgoff().

    now fix this issue by align mem->size to page size in the check.

    Signed-off-by: Bin Wang
    Signed-off-by: Nobuhiro Iwamatsu
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Bin Wang
     
  • When platform_get_irq() is failed after "priv" allocated,
    it need to free "priv". But the label of bad0 doesn't try
    to free about "priv". So this patch changes that lable to "bad1".
    But "bad1" has pm_runtime_disable() call, this function should
    be called when uio_register_device() is failed. So it is moved
    into handling error for uio_register_device().

    Signed-off-by: Daeseok Youn
    Signed-off-by: Hans J. Koch
    Signed-off-by: Greg Kroah-Hartman

    Daeseok Youn
     

21 Dec, 2013

1 commit

  • Commit e6789cd3dfb553077606ccafeb05e0043f072481 (uio: Simplify uio error
    path by using devres functions) converted uio to use devm_request_irq().
    This introduced a change in behaviour since the IRQ is associated with
    the parent device instead of the created UIO device. The IRQ will remain
    active after uio_unregister_device() is called, and some drivers will
    crash because of this. The patch fixes this.

    Signed-off-by: Aaro Koskinen
    Cc: stable # 3.13
    Signed-off-by: Greg Kroah-Hartman

    Aaro Koskinen
     

17 Dec, 2013

1 commit