02 May, 2018

5 commits

  • commit 5c60300d68da32ca77f7f978039dc72bfc78b06b upstream.

    When out of memory and we can't add ctrl vq buffers,
    probe fails. Unfortunately the error handling is
    out of spec: it calls del_vqs without bothering
    to reset the device first.

    To fix, call the full cleanup function in this case.

    Cc: stable@vger.kernel.org
    Signed-off-by: Michael S. Tsirkin
    Signed-off-by: Greg Kroah-Hartman

    Michael S. Tsirkin
     
  • commit aa44ec867030a72e8aa127977e37dec551d8df19 upstream.

    Will make it reusable for error handling.

    Cc: stable@vger.kernel.org
    Signed-off-by: Michael S. Tsirkin
    Signed-off-by: Greg Kroah-Hartman

    Michael S. Tsirkin
     
  • commit 61a8950c5c5708cf2068b29ffde94e454e528208 upstream.

    We now cleanup all VQs on device removal - no need
    to handle the control VQ specially.

    Cc: stable@vger.kernel.org
    Signed-off-by: Michael S. Tsirkin
    Signed-off-by: Greg Kroah-Hartman

    Michael S. Tsirkin
     
  • commit a7a69ec0d8e4a58be7db88d33cbfa2912807bb2b upstream.

    Console driver is out of spec. The spec says:
    A driver MUST NOT decrement the available idx on a live
    virtqueue (ie. there is no way to “unexpose” buffers).
    and it does exactly that by trying to detach unused buffers
    without doing a device reset first.

    Defer detaching the buffers until device unplug.

    Of course this means we might get an interrupt for
    a vq without an attached port now. Handle that by
    discarding the consumed buffer.

    Reported-by: Tiwei Bie
    Fixes: b3258ff1d6 ("virtio: Decrement avail idx on buffer detach")
    Cc: stable@vger.kernel.org
    Signed-off-by: Michael S. Tsirkin
    Signed-off-by: Greg Kroah-Hartman

    Michael S. Tsirkin
     
  • commit 2855b33514d290c51d52d94e25d3ef942cd4d578 upstream.

    an allocated buffer doesn't need to be tied to a vq -
    only vq->vdev is ever used. Pass the function the
    just what it needs - the vdev.

    Cc: stable@vger.kernel.org
    Signed-off-by: Michael S. Tsirkin
    Signed-off-by: Greg Kroah-Hartman

    Michael S. Tsirkin
     

13 Sep, 2017

1 commit

  • Pull dma-mapping updates from Christoph Hellwig:

    - removal of the old dma_alloc_noncoherent interface

    - remove unused flags to dma_declare_coherent_memory

    - restrict OF DMA configuration to specific physical busses

    - use the iommu mailing list for dma-mapping questions and patches

    * tag 'dma-mapping-4.14' of git://git.infradead.org/users/hch/dma-mapping:
    dma-coherent: fix dma_declare_coherent_memory() logic error
    ARM: imx: mx31moboard: Remove unused 'dma' variable
    dma-coherent: remove an unused variable
    MAINTAINERS: use the iommu list for the dma-mapping subsystem
    dma-coherent: remove the DMA_MEMORY_MAP and DMA_MEMORY_IO flags
    dma-coherent: remove the DMA_MEMORY_INCLUDES_CHILDREN flag
    of: restrict DMA configuration
    dma-mapping: remove dma_alloc_noncoherent and dma_free_noncoherent
    i825xx: switch to switch to dma_alloc_attrs
    au1000_eth: switch to dma_alloc_attrs
    sgiseeq: switch to dma_alloc_attrs
    dma-mapping: reduce dma_mapping_error inline bloat

    Linus Torvalds
     

06 Sep, 2017

1 commit

  • Pull char/misc driver updates from Greg KH:
    "Here is the big char/misc driver update for 4.14-rc1.

    Lots of different stuff in here, it's been an active development cycle
    for some reason. Highlights are:

    - updated binder driver, this brings binder up to date with what
    shipped in the Android O release, plus some more changes that
    happened since then that are in the Android development trees.

    - coresight updates and fixes

    - mux driver file renames to be a bit "nicer"

    - intel_th driver updates

    - normal set of hyper-v updates and changes

    - small fpga subsystem and driver updates

    - lots of const code changes all over the driver trees

    - extcon driver updates

    - fmc driver subsystem upadates

    - w1 subsystem minor reworks and new features and drivers added

    - spmi driver updates

    Plus a smattering of other minor driver updates and fixes.

    All of these have been in linux-next with no reported issues for a
    while"

    * tag 'char-misc-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (244 commits)
    ANDROID: binder: don't queue async transactions to thread.
    ANDROID: binder: don't enqueue death notifications to thread todo.
    ANDROID: binder: Don't BUG_ON(!spin_is_locked()).
    ANDROID: binder: Add BINDER_GET_NODE_DEBUG_INFO ioctl
    ANDROID: binder: push new transactions to waiting threads.
    ANDROID: binder: remove proc waitqueue
    android: binder: Add page usage in binder stats
    android: binder: fixup crash introduced by moving buffer hdr
    drivers: w1: add hwmon temp support for w1_therm
    drivers: w1: refactor w1_slave_show to make the temp reading functionality separate
    drivers: w1: add hwmon support structures
    eeprom: idt_89hpesx: Support both ACPI and OF probing
    mcb: Fix an error handling path in 'chameleon_parse_cells()'
    MCB: add support for SC31 to mcb-lpc
    mux: make device_type const
    char: virtio: constify attribute_group structures.
    Documentation/ABI: document the nvmem sysfs files
    lkdtm: fix spelling mistake: "incremeted" -> "incremented"
    perf: cs-etm: Fix ETMv4 CONFIGR entry in perf.data file
    nvmem: include linux/err.h from header
    ...

    Linus Torvalds
     

01 Sep, 2017

1 commit


28 Aug, 2017

1 commit


24 Aug, 2017

1 commit

  • Lguest seems to be rather unused these days. It has seen only patches
    ensuring it still builds the last two years and its official state is
    "Odd Fixes".

    Remove it in order to be able to clean up the paravirt code.

    Signed-off-by: Juergen Gross
    Acked-by: Rusty Russell
    Acked-by: Thomas Gleixner
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: boris.ostrovsky@oracle.com
    Cc: lguest@lists.ozlabs.org
    Cc: rusty@rustcorp.com.au
    Cc: xen-devel@lists.xenproject.org
    Link: http://lkml.kernel.org/r/20170816173157.8633-3-jgross@suse.com
    Signed-off-by: Ingo Molnar

    Juergen Gross
     

11 May, 2017

1 commit

  • Pull virtio updates from Michael Tsirkin:
    "Fixes, cleanups, performance

    A bunch of changes to virtio, most affecting virtio net. Also ptr_ring
    batched zeroing - first of batching enhancements that seems ready."

    * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
    s390/virtio: change maintainership
    tools/virtio: fix spelling mistake: "wakeus" -> "wakeups"
    virtio_net: tidy a couple debug statements
    ptr_ring: support testing different batching sizes
    ringtest: support test specific parameters
    ptr_ring: batch ring zeroing
    virtio: virtio_driver doc
    virtio_net: don't reset twice on XDP on/off
    virtio_net: fix support for small rings
    virtio_net: reduce alignment for buffers
    virtio_net: rework mergeable buffer handling
    virtio_net: allow specifying context for rx
    virtio: allow extra context per descriptor
    tools/virtio: fix build breakage
    virtio: add context flag to find vqs
    virtio: wrap find_vqs
    ringtest: fix an assert statement

    Linus Torvalds
     

05 May, 2017

1 commit

  • Pull char/misc driver updates from Greg KH:
    "Here is the big set of new char/misc driver drivers and features for
    4.12-rc1.

    There's lots of new drivers added this time around, new firmware
    drivers from Google, more auxdisplay drivers, extcon drivers, fpga
    drivers, and a bunch of other driver updates. Nothing major, except if
    you happen to have the hardware for these drivers, and then you will
    be happy :)

    All of these have been in linux-next for a while with no reported
    issues"

    * tag 'char-misc-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (136 commits)
    firmware: google memconsole: Fix return value check in platform_memconsole_init()
    firmware: Google VPD: Fix return value check in vpd_platform_init()
    goldfish_pipe: fix build warning about using too much stack.
    goldfish_pipe: An implementation of more parallel pipe
    fpga fr br: update supported version numbers
    fpga: region: release FPGA region reference in error path
    fpga altera-hps2fpga: disable/unprepare clock on error in alt_fpga_bridge_probe()
    mei: drop the TODO from samples
    firmware: Google VPD sysfs driver
    firmware: Google VPD: import lib_vpd source files
    misc: lkdtm: Add volatile to intentional NULL pointer reference
    eeprom: idt_89hpesx: Add OF device ID table
    misc: ds1682: Add OF device ID table
    misc: tsl2550: Add OF device ID table
    w1: Remove unneeded use of assert() and remove w1_log.h
    w1: Use kernel common min() implementation
    uio_mf624: Align memory regions to page size and set correct offsets
    uio_mf624: Refactor memory info initialization
    uio: Allow handling of non page-aligned memory regions
    hangcheck-timer: Fix typo in comment
    ...

    Linus Torvalds
     

03 May, 2017

1 commit


07 Apr, 2017

1 commit


17 Mar, 2017

1 commit


02 Mar, 2017

1 commit

  • put_chars() stuffs the buffer it gets into an sg, but that buffer may be
    on the stack. This breaks with CONFIG_VMAP_STACK=y (for me, it
    manifested as printks getting turned into NUL bytes).

    Signed-off-by: Omar Sandoval
    Signed-off-by: Michael S. Tsirkin
    Reviewed-by: Amit Shah

    Omar Sandoval
     

28 Feb, 2017

1 commit

  • Add a struct irq_affinity pointer to the find_vqs methods, which if set
    is used to tell the PCI layer to create the MSI-X vectors for our I/O
    virtqueues with the proper affinity from the start. Compared to after
    the fact affinity hints this gives us an instantly working setup and
    allows to allocate the irq descritors node-local and avoid interconnect
    traffic. Last but not least this will allow blk-mq queues are created
    based on the interrupt affinity for storage drivers.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Jason Wang
    Signed-off-by: Michael S. Tsirkin

    Christoph Hellwig
     

20 Jan, 2017

1 commit

  • Using control_work instead of config_work as the 3rd argument to
    container_of results in an invalid portdev pointer. Indeed, the work
    structure is initialized as below:

    INIT_WORK(&portdev->config_work, &config_work_handler);

    It leads to a crash when portdev->vdev is dereferenced later. This
    bug
    is triggered when the guest uses a virtio-console without multiport
    feature and receives a config_changed virtio interrupt.

    Signed-off-by: G. Campana
    Reviewed-by: Amit Shah
    Signed-off-by: Michael S. Tsirkin

    G. Campana
     

15 Dec, 2016

1 commit

  • struct ports_device includes a config field including the whole
    virtio_console_config, but only max_nr_ports in there is ever updated or
    used. The rest is unused and in fact does not even mirror the
    device config. Drop everything except max_nr_ports,
    saving some memory.

    Signed-off-by: Michael S. Tsirkin
    Reviewed-by: Jason Wang

    Michael S. Tsirkin
     

31 Oct, 2016

1 commit

  • Commit c6017e793b93 ("virtio: console: add locks around buffer removal
    in port unplug path") added locking around the freeing of buffers in the
    vq. However, when free_buf() is called with can_sleep = true and rproc
    is enabled, it calls dma_free_coherent() directly, requiring interrupts
    to be enabled. Currently a WARNING is triggered due to the spin locking
    around free_buf, with a call stack like this:

    WARNING: CPU: 3 PID: 121 at ./include/linux/dma-mapping.h:433
    free_buf+0x1a8/0x288
    Call Trace:
    [] show_stack+0x74/0xc0
    [] dump_stack+0xd0/0x110
    [] __warn+0xfc/0x130
    [] warn_slowpath_null+0x2c/0x3c
    [] free_buf+0x1a8/0x288
    [] remove_port_data+0x50/0xac
    [] unplug_port+0xb4/0x1bc
    [] virtcons_remove+0xb0/0xfc
    [] virtio_dev_remove+0x58/0xc0
    [] __device_release_driver+0xac/0x134
    [] device_release_driver+0x38/0x50
    [] bus_remove_device+0xfc/0x130
    [] device_del+0x17c/0x21c
    [] device_unregister+0x24/0x38
    [] unregister_virtio_device+0x28/0x44

    Fix this by restructuring the loops to allow the locks to only be taken
    where it is necessary to protect the vqs, and release it while the
    buffer is being freed.

    Fixes: c6017e793b93 ("virtio: console: add locks around buffer removal in port unplug path")
    Cc: stable@vger.kernel.org
    Signed-off-by: Matt Redfearn
    Signed-off-by: Michael S. Tsirkin

    Matt Redfearn
     

12 Oct, 2016

1 commit

  • Kernel source files need not include explicitly
    because the top Makefile forces to include it with:

    -include $(srctree)/include/linux/kconfig.h

    This commit removes explicit includes except the following:

    * arch/s390/include/asm/facilities_src.h
    * tools/testing/radix-tree/linux/kernel.h

    These two are used for host programs.

    Link: http://lkml.kernel.org/r/1473656164-11929-1-git-send-email-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     

06 Oct, 2016

1 commit


10 Sep, 2016

1 commit

  • virtio_console uses a small DMA buffer for control requests. Move
    that buffer into heap memory.

    Doing virtio DMA on the stack is normally okay on non-DMA-API virtio
    systems (which is currently most of them), but it breaks completely
    if the stack is virtually mapped.

    Tested by typing both directions using picocom aimed at /dev/hvc0.

    Signed-off-by: Andy Lutomirski
    Signed-off-by: Michael S. Tsirkin
    Reviewed-by: Amit Shah

    Andy Lutomirski
     

25 May, 2015

1 commit


03 Apr, 2015

1 commit


05 Mar, 2015

2 commits


11 Feb, 2015

1 commit


21 Jan, 2015

1 commit


09 Dec, 2014

4 commits

  • CHECK drivers/char/virtio_console.c
    drivers/char/virtio_console.c:687:36: warning: incorrect type in
    argument 1 (different address spaces)
    drivers/char/virtio_console.c:687:36: expected void [noderef]
    *to
    drivers/char/virtio_console.c:687:36: got char *out_buf
    drivers/char/virtio_console.c:790:35: warning: incorrect type in
    argument 2 (different address spaces)
    drivers/char/virtio_console.c:790:35: expected char *out_buf
    drivers/char/virtio_console.c:790:35: got char [noderef]
    *ubuf

    fill_readbuf is reused with both kernel and userspace pointers,
    depending on value of to_user flag.

    Tag address parameter as __user, and cast to/from regular pointer type
    when we know it's safe.

    Signed-off-by: Michael S. Tsirkin

    Michael S. Tsirkin
     
  • Core activates this bit automatically now,
    drop it from drivers that set it explicitly.

    Signed-off-by: Michael S. Tsirkin

    Michael S. Tsirkin
     
  • Pretty straight-forward, just use accessors for all fields.

    Signed-off-by: Michael S. Tsirkin

    Michael S. Tsirkin
     
  • It seemed like a good idea to use bitmap for features
    in struct virtio_device, but it's actually a pain,
    and seems to become even more painful when we get more
    than 32 feature bits. Just change it to a u32 for now.

    Based on patch by Rusty.

    Suggested-by: David Hildenbrand
    Signed-off-by: Rusty Russell
    Signed-off-by: Cornelia Huck
    Signed-off-by: Michael S. Tsirkin
    Reviewed-by: Cornelia Huck

    Michael S. Tsirkin
     

13 Nov, 2014

1 commit

  • Commit f5866db6 (virtio_console: enable VQs early) tried to make
    sure that DRIVER_OK was set when virtio_console started using its
    virtqueues. Doing this in add_port(), however, means that we try
    to set DRIVER_OK again when when a port is dynamically added after
    the probe function is done.

    Let's move virtio_device_ready() to the probe function just before
    trying to use the virtqueues instead. This is fine as nothing can
    fail inbetween.

    Reported-by: Thomas Graf
    Reviewed-by: Michael S. Tsirkin
    Signed-off-by: Cornelia Huck

    Signed-off-by: Michael S. Tsirkin

    Cornelia Huck
     

15 Oct, 2014

2 commits

  • virtio spec requires drivers to set DRIVER_OK before using VQs.
    This is set automatically after resume returns, virtio console violated this
    rule by adding inbufs, which causes the VQ to be used directly within
    restore.

    To fix, call virtio_device_ready before using VQs.

    Signed-off-by: Michael S. Tsirkin
    Signed-off-by: Rusty Russell

    Michael S. Tsirkin
     
  • virtio spec requires drivers to set DRIVER_OK before using VQs.
    This is set automatically after probe returns, virtio console violated this
    rule by adding inbufs, which causes the VQ to be used directly within
    probe.

    To fix, call virtio_device_ready before using VQs.

    Signed-off-by: Michael S. Tsirkin
    Signed-off-by: Rusty Russell

    Michael S. Tsirkin
     

27 Jul, 2014

1 commit


02 Apr, 2014

1 commit


10 Feb, 2014

1 commit

  • While we are at it, don't do kmap() under kmap_atomic(), *especially*
    for a page we'd allocated with GFP_KERNEL. It's spelled "page_address",
    and had that been more than that, we'd have a real trouble - kmap_high()
    can block, and doing that while holding kmap_atomic() is a Bad Idea(tm).

    Signed-off-by: Al Viro

    Al Viro
     

29 Oct, 2013

1 commit