1. 17 Nov, 2016 12 commits
    • Kirti Wankhede's avatar
      vfio: Introduce common function to add capabilities · b3c0a866
      Kirti Wankhede authored
      Vendor driver using mediated device framework should use
      vfio_info_add_capability() to add capabilities.
      Introduced this function to reduce code duplication in vendor drivers.
      
      vfio_info_cap_shift() manipulated a data buffer to add an offset to each
      element in a chain. This data buffer is documented in a uapi header.
      Changing vfio_info_cap_shift symbol to be available to all drivers.
      Signed-off-by: default avatarKirti Wankhede <kwankhede@nvidia.com>
      Signed-off-by: default avatarNeo Jia <cjia@nvidia.com>
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      b3c0a866
    • Kirti Wankhede's avatar
      vfio iommu: Add blocking notifier to notify DMA_UNMAP · c086de81
      Kirti Wankhede authored
      Added blocking notifier to IOMMU TYPE1 driver to notify vendor drivers
      about DMA_UNMAP.
      Exported two APIs vfio_register_notifier() and vfio_unregister_notifier().
      Notifier should be registered, if external user wants to use
      vfio_pin_pages()/vfio_unpin_pages() APIs to pin/unpin pages.
      Vendor driver should use VFIO_IOMMU_NOTIFY_DMA_UNMAP action to invalidate
      mappings.
      Signed-off-by: default avatarKirti Wankhede <kwankhede@nvidia.com>
      Signed-off-by: default avatarNeo Jia <cjia@nvidia.com>
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      c086de81
    • Kirti Wankhede's avatar
      vfio iommu type1: Add support for mediated devices · a54eb550
      Kirti Wankhede authored
      VFIO IOMMU drivers are designed for the devices which are IOMMU capable.
      Mediated device only uses IOMMU APIs, the underlying hardware can be
      managed by an IOMMU domain.
      
      Aim of this change is:
      - To use most of the code of TYPE1 IOMMU driver for mediated devices
      - To support direct assigned device and mediated device in single module
      
      This change adds pin and unpin support for mediated device to TYPE1 IOMMU
      backend module. More details:
      - Domain for external user is tracked separately in vfio_iommu structure.
        It is allocated when group for first mdev device is attached.
      - Pages pinned for external domain are tracked in each vfio_dma structure
        for that iova range.
      - Page tracking rb-tree in vfio_dma keeps <iova, pfn, ref_count>. Key of
        rb-tree is iova, but it actually aims to track pfns.
      - On external pin request for an iova, page is pinned once, if iova is
        already pinned and tracked, ref_count is incremented.
      - External unpin request unpins pages only when ref_count is 0.
      - Pinned pages list is used to find pfn from iova and then unpin it.
        WARN_ON is added if there are entires in pfn_list while detaching the
        group and releasing the domain.
      - Page accounting is updated to account in its address space where the
        pages are pinned/unpinned, i.e dma->task
      -  Accouting for mdev device is only done if there is no iommu capable
        domain in the container. When there is a direct device assigned to the
        container and that domain is iommu capable, all pages are already pinned
        during DMA_MAP.
      - Page accouting is updated on hot plug and unplug mdev device and pass
        through device.
      
      Tested by assigning below combinations of devices to a single VM:
      - GPU pass through only
      - vGPU device only
      - One GPU pass through and one vGPU device
      - Linux VM hot plug and unplug vGPU device while GPU pass through device
        exist
      - Linux VM hot plug and unplug GPU pass through device while vGPU device
        exist
      Signed-off-by: default avatarKirti Wankhede <kwankhede@nvidia.com>
      Signed-off-by: default avatarNeo Jia <cjia@nvidia.com>
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      a54eb550
    • Kirti Wankhede's avatar
      vfio iommu type1: Add task structure to vfio_dma · 8f0d5bb9
      Kirti Wankhede authored
      Add task structure to vfio_dma structure. Task structure is used for:
      - During DMA_UNMAP, same task who mapped it or other task who shares same
      address space is allowed to unmap, otherwise unmap fails.
      QEMU maps few iova ranges initially, then fork threads and from the child
      thread calls DMA_UNMAP on previously mapped iova. Since child shares same
      address space, DMA_UNMAP is successful.
      - Avoid accessing struct mm while process is exiting by acquiring
      reference of task's mm during page accounting.
      - It is also used to get task mlock capability and rlimit for mlock.
      Signed-off-by: default avatarKirti Wankhede <kwankhede@nvidia.com>
      Signed-off-by: default avatarNeo Jia <cjia@nvidia.com>
      Reviewed-by: default avatarDong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      8f0d5bb9
    • Kirti Wankhede's avatar
      7896c998
    • Kirti Wankhede's avatar
      vfio iommu type1: Update argument of vaddr_get_pfn() · ea85cf35
      Kirti Wankhede authored
      Update arguments of vaddr_get_pfn() to take struct mm_struct *mm as input
      argument.
      Signed-off-by: default avatarKirti Wankhede <kwankhede@nvidia.com>
      Signed-off-by: default avatarNeo Jia <cjia@nvidia.com>
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      ea85cf35
    • Kirti Wankhede's avatar
      vfio iommu type1: Update arguments of vfio_lock_acct · 3624a248
      Kirti Wankhede authored
      Added task structure as input argument to vfio_lock_acct() function.
      Signed-off-by: default avatarKirti Wankhede <kwankhede@nvidia.com>
      Signed-off-by: default avatarNeo Jia <cjia@nvidia.com>
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      3624a248
    • Kirti Wankhede's avatar
      vfio iommu: Added pin and unpin callback functions to vfio_iommu_driver_ops · 2169037d
      Kirti Wankhede authored
      Added APIs for pining and unpining set of pages. These call back into
      backend iommu module to actually pin and unpin pages.
      Added two new callback functions to struct vfio_iommu_driver_ops. Backend
      IOMMU module that supports pining and unpinning pages for mdev devices
      should provide these functions.
      
      Renamed static functions in vfio_type1_iommu.c to resolve conflicts
      Signed-off-by: default avatarKirti Wankhede <kwankhede@nvidia.com>
      Signed-off-by: default avatarNeo Jia <cjia@nvidia.com>
      Reviewed-by: default avatarDong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      2169037d
    • Kirti Wankhede's avatar
      vfio: Common function to increment container_users · 32f55d83
      Kirti Wankhede authored
      This change rearrange functions to have common function to increment
      container_users
      Signed-off-by: default avatarKirti Wankhede <kwankhede@nvidia.com>
      Signed-off-by: default avatarNeo Jia <cjia@nvidia.com>
      Reviewed-by: default avatarJike Song <jike.song@intel.com>
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      32f55d83
    • Kirti Wankhede's avatar
      vfio: Rearrange functions to get vfio_group from dev · 7ed3ea8a
      Kirti Wankhede authored
      This patch rearranges functions to get vfio_group from device
      Signed-off-by: default avatarKirti Wankhede <kwankhede@nvidia.com>
      Signed-off-by: default avatarNeo Jia <cjia@nvidia.com>
      Reviewed-by: default avatarJike Song <jike.song@intel.com>
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      7ed3ea8a
    • Kirti Wankhede's avatar
      vfio: VFIO based driver for Mediated devices · fa3da00c
      Kirti Wankhede authored
      vfio_mdev driver registers with mdev core driver.
      mdev core driver creates mediated device and calls probe routine of
      vfio_mdev driver for each device.
      Probe routine of vfio_mdev driver adds mediated device to VFIO core module
      
      This driver forms a shim layer that pass through VFIO devices operations
      to vendor driver for mediated devices.
      Signed-off-by: default avatarKirti Wankhede <kwankhede@nvidia.com>
      Signed-off-by: default avatarNeo Jia <cjia@nvidia.com>
      Reviewed-by: default avatarJike Song <jike.song@intel.com>
      Reviewed-by: default avatarDong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      fa3da00c
    • Kirti Wankhede's avatar
      vfio: Mediated device Core driver · 7b96953b
      Kirti Wankhede authored
      Design for Mediated Device Driver:
      Main purpose of this driver is to provide a common interface for mediated
      device management that can be used by different drivers of different
      devices.
      
      This module provides a generic interface to create the device, add it to
      mediated bus, add device to IOMMU group and then add it to vfio group.
      
      Below is the high Level block diagram, with Nvidia, Intel and IBM devices
      as example, since these are the devices which are going to actively use
      this module as of now.
      
       +---------------+
       |               |
       | +-----------+ |  mdev_register_driver() +--------------+
       | |           | +<------------------------+ __init()     |
       | |  mdev     | |                         |              |
       | |  bus      | +------------------------>+              |<-> VFIO user
       | |  driver   | |     probe()/remove()    | vfio_mdev.ko |    APIs
       | |           | |                         |              |
       | +-----------+ |                         +--------------+
       |               |
       |  MDEV CORE    |
       |   MODULE      |
       |   mdev.ko     |
       | +-----------+ |  mdev_register_device() +--------------+
       | |           | +<------------------------+              |
       | |           | |                         |  nvidia.ko   |<-> physical
       | |           | +------------------------>+              |    device
       | |           | |        callback         +--------------+
       | | Physical  | |
       | |  device   | |  mdev_register_device() +--------------+
       | | interface | |<------------------------+              |
       | |           | |                         |  i915.ko     |<-> physical
       | |           | +------------------------>+              |    device
       | |           | |        callback         +--------------+
       | |           | |
       | |           | |  mdev_register_device() +--------------+
       | |           | +<------------------------+              |
       | |           | |                         | ccw_device.ko|<-> physical
       | |           | +------------------------>+              |    device
       | |           | |        callback         +--------------+
       | +-----------+ |
       +---------------+
      
      Core driver provides two types of registration interfaces:
      1. Registration interface for mediated bus driver:
      
      /**
        * struct mdev_driver - Mediated device's driver
        * @name: driver name
        * @probe: called when new device created
        * @remove:called when device removed
        * @driver:device driver structure
        *
        **/
      struct mdev_driver {
               const char *name;
               int  (*probe)  (struct device *dev);
               void (*remove) (struct device *dev);
               struct device_driver    driver;
      };
      
      Mediated bus driver for mdev device should use this interface to register
      and unregister with core driver respectively:
      
      int  mdev_register_driver(struct mdev_driver *drv, struct module *owner);
      void mdev_unregister_driver(struct mdev_driver *drv);
      
      Mediated bus driver is responsible to add/delete mediated devices to/from
      VFIO group when devices are bound and unbound to the driver.
      
      2. Physical device driver interface
      This interface provides vendor driver the set APIs to manage physical
      device related work in its driver. APIs are :
      
      * dev_attr_groups: attributes of the parent device.
      * mdev_attr_groups: attributes of the mediated device.
      * supported_type_groups: attributes to define supported type. This is
      			 mandatory field.
      * create: to allocate basic resources in vendor driver for a mediated
               device. This is mandatory to be provided by vendor driver.
      * remove: to free resources in vendor driver when mediated device is
               destroyed. This is mandatory to be provided by vendor driver.
      * open: open callback of mediated device
      * release: release callback of mediated device
      * read : read emulation callback.
      * write: write emulation callback.
      * ioctl: ioctl callback.
      * mmap: mmap emulation callback.
      
      Drivers should use these interfaces to register and unregister device to
      mdev core driver respectively:
      
      extern int  mdev_register_device(struct device *dev,
                                       const struct parent_ops *ops);
      extern void mdev_unregister_device(struct device *dev);
      
      There are no locks to serialize above callbacks in mdev driver and
      vfio_mdev driver. If required, vendor driver can have locks to serialize
      above APIs in their driver.
      Signed-off-by: default avatarKirti Wankhede <kwankhede@nvidia.com>
      Signed-off-by: default avatarNeo Jia <cjia@nvidia.com>
      Reviewed-by: default avatarJike Song <jike.song@intel.com>
      Reviewed-by: default avatarDong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      7b96953b
  2. 13 Nov, 2016 14 commits
    • Linus Torvalds's avatar
      Linux 4.9-rc5 · a25f0944
      Linus Torvalds authored
      a25f0944
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · e234832a
      Linus Torvalds authored
      Pull KVM fixes from Paolo Bonzini:
       "ARM fixes.  There are a couple pending x86 patches but they'll have to
        wait for next week"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: arm/arm64: vgic: Kick VCPUs when queueing already pending IRQs
        KVM: arm/arm64: vgic: Prevent access to invalid SPIs
        arm/arm64: KVM: Perform local TLB invalidation when multiplexing vcpus on a single CPU
      e234832a
    • Linus Torvalds's avatar
      Merge branch 'media-fixes' (patches from Mauro) · e861d890
      Linus Torvalds authored
      Merge media fixes from Mauro Carvalho Chehab:
       "This contains two patches fixing problems with my patch series meant
        to make USB drivers to work again after the DMA on stack changes.
      
        The last patch on this series is actually not related to DMA on stack.
        It solves a longstanding bug affecting module unload, causing
        module_put() to be called twice. It was reported by the user who
        reported and tested the issues with the gp8psk driver with the DMA
        fixup patches. As we're late at -rc cycle, maybe you prefer to not
        apply it right now. If this is the case, I'll add to the pile of
        patches for 4.10.
      
        Exceptionally this time, I'm sending the patches via e-mail, because
        I'm on another trip, and won't be able to use the usual procedure
        until Monday. Also, it is only three patches, and you followed already
        the discussions about the first one"
      
      * emailed patches from Mauro Carvalho Chehab <mchehab@osg.samsung.com>:
        gp8psk: Fix DVB frontend attach
        gp8psk: fix gp8psk_usb_in_op() logic
        dvb-usb: move data_mutex to struct dvb_usb_device
      e861d890
    • Linus Torvalds's avatar
      Merge tag 'char-misc-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · acb57b75
      Linus Torvalds authored
      Pull char/misc fixes from Greg KH:
       "Here are three small driver fixes for some reported issues for
        4.9-rc5.
      
        One for the hyper-v subsystem, fixing up a naming issue that showed up
        in 4.9-rc1, one mei driver fix, and one fix for parallel ports,
        resolving a reported regression.
      
        All have been in linux-next with no reported issues"
      
      * tag 'char-misc-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        ppdev: fix double-free of pp->pdev->name
        vmbus: make sysfs names consistent with PCI
        mei: bus: fix received data size check in NFC fixup
      acb57b75
    • Linus Torvalds's avatar
      Merge tag 'driver-core-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core · cf2b191c
      Linus Torvalds authored
      Pull driver core fixes from Greg KH:
       "Here are two driver core fixes for 4.9-rc5.
      
        The first resolves an issue with some drivers not liking to be unbound
        and bound again (if CONFIG_DEBUG_TEST_DRIVER_REMOVE is enabled), which
        solves some reported problems with graphics and storage drivers. The
        other resolves a smatch error with the 4.9-rc1 driver core changes
        around this feature.
      
        Both have been in linux-next with no reported issues"
      
      * tag 'driver-core-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        driver core: fix smatch warning on dev->bus check
        driver core: skip removal test for non-removable drivers
      cf2b191c
    • Linus Torvalds's avatar
      Merge tag 'staging-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 85b9df7a
      Linus Torvalds authored
      Pull staging/IIO fixes from Grek KH:
       "Here are a few small staging and iio driver fixes for reported issues.
      
        The last one was cherry-picked from my -next branch to resolve a build
        warning that Arnd fixed, in his quest to be able to turn
        -Wmaybe-uninitialized back on again. That patch, and all of the
        others, have been in linux-next for a while with no reported issues"
      
      * tag 'staging-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        iio: maxim_thermocouple: detect invalid storage size in read()
        staging: nvec: remove managed resource from PS2 driver
        Revert "staging: nvec: ps2: change serio type to passthrough"
        drivers: staging: nvec: remove bogus reset command for PS/2 interface
        staging: greybus: arche-platform: fix device reference leak
        staging: comedi: ni_tio: fix buggy ni_tio_clock_period_ps() return value
        staging: sm750fb: Fix bugs introduced by early commits
        iio: hid-sensors: Increase the precision of scale to fix wrong reading interpretation.
        iio: orientation: hid-sensor-rotation: Add PM function (fix non working driver)
        iio: st_sensors: fix scale configuration for h3lis331dl
        staging: iio: ad5933: avoid uninitialized variable in error case
      85b9df7a
    • Linus Torvalds's avatar
      Merge tag 'usb-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · befdfffd
      Linus Torvalds authored
      Pull USB / PHY fixes from Greg KH:
       "Here are a number of small USB and PHY driver fixes for 4.9-rc5
      
        Nothing major, just small fixes for reported issues, all of these have
        been in linux-next for a while with no reported issues"
      
      * tag 'usb-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        USB: cdc-acm: fix TIOCMIWAIT
        cdc-acm: fix uninitialized variable
        drivers/usb: Skip auto handoff for TI and RENESAS usb controllers
        usb: musb: remove duplicated actions
        usb: musb: da8xx: Don't print phy error on -EPROBE_DEFER
        phy: sun4i: check PMU presence when poking unknown bit of pmu
        phy-rockchip-pcie: remove deassert of phy_rst from exit callback
        phy: da8xx-usb: rename the ohci device to ohci-da8xx
        phy: Add reset callback for not generic phy
        uwb: fix device reference leaks
        usb: gadget: u_ether: remove interrupt throttling
        usb: dwc3: st: add missing <linux/pinctrl/consumer.h> include
        usb: dwc3: Fix error handling for core init
      befdfffd
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.dk/linux-block · 348ce85b
      Linus Torvalds authored
      Pull more block fixes from Jens Axboe:
       "Since I mistakenly left out the lightnvm regression fix yesterday and
        the aoeblk seems adequately tested at this point, might as well send
        out another pull to make -rc5"
      
      * 'for-linus' of git://git.kernel.dk/linux-block:
        aoe: fix crash in page count manipulation
        lightnvm: invalid offset calculation for lba_shift
      348ce85b
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 980221d1
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "The megaraid_sas patch in here fixes a major regression in the last
        fix set that made all megaraid_sas cards unusable. It turns out no-one
        had actually tested such an "obvious" fix, sigh. The fix for the fix
        has been tested ...
      
        The next most serious is the vmw_pvscsi abort problem which basically
        means that aborts don't work on the vmware paravirt devices and error
        handling always escalates to reset.
      
        The rest are an assortment of missed reference counting in certain
        paths and corner case bugs that show up on some architectures"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: megaraid_sas: fix macro MEGASAS_IS_LOGICAL to avoid regression
        scsi: qla2xxx: fix invalid DMA access after command aborts in PCI device remove
        scsi: qla2xxx: do not queue commands when unloading
        scsi: libcxgbi: fix incorrect DDP resource cleanup
        scsi: qla2xxx: Fix scsi scan hang triggered if adapter fails during init
        scsi: scsi_dh_alua: Fix a reference counting bug
        scsi: vmw_pvscsi: return SUCCESS for successful command aborts
        scsi: mpt3sas: Fix for block device of raid exists even after deleting raid disk
        scsi: scsi_dh_alua: fix missing kref_put() in alua_rtpg_work()
      980221d1
    • Linus Torvalds's avatar
      Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · d41bd8f3
      Linus Torvalds authored
      Pull clk fixes from Stephen Boyd:
       "The typical collection of minor bug fixes in clk drivers. We don't
        have anything in the core framework here, just driver fixes.
      
        There's a boot fix for Samsung devices and a safety measure for qoriq
        to prevent CPUs from running too fast. There's also a fix for i.MX6Q
        to properly handle audio clock rates. We also have some "that's
        obviously wrong" fixes like bad NULL pointer checks in the MPP driver
        and a poor usage of __pa in the xgene clk driver that are fixed here"
      
      * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        clk: mmp: pxa910: fix return value check in pxa910_clk_init()
        clk: mmp: pxa168: fix return value check in pxa168_clk_init()
        clk: mmp: mmp2: fix return value check in mmp2_clk_init()
        clk: qoriq: Don't allow CPU clocks higher than starting value
        clk: imx: fix integer overflow in AV PLL round rate
        clk: xgene: Don't call __pa on ioremaped address
        clk/samsung: Use CLK_OF_DECLARE_DRIVER initialization method for CLKOUT
        clk: rockchip: don't return NULL when failing to register ddrclk branch
      d41bd8f3
    • Mauro Carvalho Chehab's avatar
      gp8psk: Fix DVB frontend attach · 7a0786c1
      Mauro Carvalho Chehab authored
      The DVB binding schema at the DVB core assumes that the frontend is a
      separate driver.  Faling to do that causes OOPS when the module is
      removed, as it tries to do a symbol_put_addr on an internal symbol,
      causing craches like:
      
          WARNING: CPU: 1 PID: 28102 at kernel/module.c:1108 module_put+0x57/0x70
          Modules linked in: dvb_usb_gp8psk(-) dvb_usb dvb_core nvidia_drm(PO) nvidia_modeset(PO) snd_hda_codec_hdmi snd_hda_intel snd_hda_codec snd_hwdep snd_hda_core snd_pcm snd_timer snd soundcore nvidia(PO) [last unloaded: rc_core]
          CPU: 1 PID: 28102 Comm: rmmod Tainted: P        WC O 4.8.4-build.1 #1
          Hardware name: MSI MS-7309/MS-7309, BIOS V1.12 02/23/2009
          Call Trace:
             dump_stack+0x44/0x64
             __warn+0xfa/0x120
             module_put+0x57/0x70
             module_put+0x57/0x70
             warn_slowpath_null+0x23/0x30
             module_put+0x57/0x70
             gp8psk_fe_set_frontend+0x460/0x460 [dvb_usb_gp8psk]
             symbol_put_addr+0x27/0x50
             dvb_usb_adapter_frontend_exit+0x3a/0x70 [dvb_usb]
      
      From Derek's tests:
          "Attach bug is fixed, tuning works, module unloads without
           crashing. Everything seems ok!"
      Reported-by: default avatarDerek <user.vdr@gmail.com>
      Tested-by: default avatarDerek <user.vdr@gmail.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7a0786c1
    • Mauro Carvalho Chehab's avatar
      gp8psk: fix gp8psk_usb_in_op() logic · 1596c387
      Mauro Carvalho Chehab authored
      Commit bc29131ecb10 ("[media] gp8psk: don't do DMA on stack") fixed the
      usage of DMA on stack, but the memcpy was wrong for gp8psk_usb_in_op().
      Fix it.
      
      From Derek's email:
          "Fix confirmed using 2 different Skywalker models with
           HD mpeg4, SD mpeg2."
      Suggested-by: default avatarJohannes Stezenbach <js@linuxtv.org>
      Fixes: bc29131ecb10 ("[media] gp8psk: don't do DMA on stack")
      Tested-by: default avatarDerek <user.vdr@gmail.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1596c387
    • Mauro Carvalho Chehab's avatar
      dvb-usb: move data_mutex to struct dvb_usb_device · 7724325a
      Mauro Carvalho Chehab authored
      The data_mutex is initialized too late, as it is needed for
      each device driver's power control, causing an OOPS:
      
          dvb-usb: found a 'TerraTec/qanu USB2.0 Highspeed DVB-T Receiver' in warm state.
          BUG: unable to handle kernel NULL pointer dereference at           (null)
          IP: [<ffffffff846617af>] __mutex_lock_slowpath+0x6f/0x100 PGD 0
          Oops: 0002 [#1] SMP
          Modules linked in: dvb_usb_cinergyT2(+) dvb_usb
          CPU: 0 PID: 2029 Comm: modprobe Not tainted 4.9.0-rc4-dvbmod #24
          Hardware name: FUJITSU LIFEBOOK A544/FJNBB35 , BIOS Version 1.17 05/09/2014
          task: ffff88020e943840 task.stack: ffff8801f36ec000
          RIP: 0010:[<ffffffff846617af>]  [<ffffffff846617af>] __mutex_lock_slowpath+0x6f/0x100
          RSP: 0018:ffff8801f36efb10  EFLAGS: 00010282
          RAX: 0000000000000000 RBX: ffff88021509bdc8 RCX: 00000000c0000100
          RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff88021509bdcc
          RBP: ffff8801f36efb58 R08: ffff88021f216320 R09: 0000000000100000
          R10: ffff88021f216320 R11: 00000023fee6c5a1 R12: ffff88020e943840
          R13: ffff88021509bdcc R14: 00000000ffffffff R15: ffff88021509bdd0
          FS:  00007f21adb86740(0000) GS:ffff88021f200000(0000) knlGS:0000000000000000
          CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
          CR2: 0000000000000000 CR3: 0000000215bce000 CR4: 00000000001406f0
          Call Trace:
             mutex_lock+0x16/0x25
             cinergyt2_power_ctrl+0x1f/0x60 [dvb_usb_cinergyT2]
             dvb_usb_device_init+0x21e/0x5d0 [dvb_usb]
             cinergyt2_usb_probe+0x21/0x50 [dvb_usb_cinergyT2]
             usb_probe_interface+0xf3/0x2a0
             driver_probe_device+0x208/0x2b0
             __driver_attach+0x87/0x90
             driver_probe_device+0x2b0/0x2b0
             bus_for_each_dev+0x52/0x80
             bus_add_driver+0x1a3/0x220
             driver_register+0x56/0xd0
             usb_register_driver+0x77/0x130
             do_one_initcall+0x46/0x180
             free_vmap_area_noflush+0x38/0x70
             kmem_cache_alloc+0x84/0xc0
             do_init_module+0x50/0x1be
             load_module+0x1d8b/0x2100
             find_symbol_in_section+0xa0/0xa0
             SyS_finit_module+0x89/0x90
             entry_SYSCALL_64_fastpath+0x13/0x94
          Code: e8 a7 1d 00 00 8b 03 83 f8 01 0f 84 97 00 00 00 48 8b 43 10 4c 8d 7b 08 48 89 63 10 4c 89 3c 24 41 be ff ff ff ff 48 89 44 24 08 <48> 89 20 4c 89 64 24 10 eb 1a 49 c7 44 24 08 02 00 00 00 c6 43 RIP  [<ffffffff846617af>] __mutex_lock_slowpath+0x6f/0x100 RSP <ffff8801f36efb10>
          CR2: 0000000000000000
      
      So, move it to the struct dvb_usb_device and initialize it
      before calling the driver's callbacks.
      Reported-by: default avatarJörg Otte <jrg.otte@gmail.com>
      Tested-by: default avatarJörg Otte <jrg.otte@gmail.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7724325a
    • Arnd Bergmann's avatar
      iio: maxim_thermocouple: detect invalid storage size in read() · d70674ee
      Arnd Bergmann authored
      As found by gcc -Wmaybe-uninitialized, having a storage_bytes value other
      than 2 or 4 will result in undefined behavior:
      
      drivers/iio/temperature/maxim_thermocouple.c: In function 'maxim_thermocouple_read':
      drivers/iio/temperature/maxim_thermocouple.c:141:5: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      
      This probably cannot happen, but returning -EINVAL here is appropriate
      and makes gcc happy and the code more robust.
      
      Fixes: 231147ee ("iio: maxim_thermocouple: Align 16 bit big endian value of raw reads")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      (cherry picked from commit 32cb7d27)
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d70674ee
  3. 12 Nov, 2016 11 commits
    • Jens Axboe's avatar
      aoe: fix crash in page count manipulation · 0cbc72a1
      Jens Axboe authored
      aoeblk contains some mysterious code, that wants to elevate the bio
      vec page counts while it's under IO. That is not needed, it's
      fragile, and it's causing kernel oopses for some.
      Reported-by: default avatarTested-by: Don Koch <kochd@us.ibm.com>
      Tested-by: default avatarTested-by: Don Koch <kochd@us.ibm.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      0cbc72a1
    • Matias Bjørling's avatar
      lightnvm: invalid offset calculation for lba_shift · 409ae5a7
      Matias Bjørling authored
      The ns->lba_shift assumes its value to be the logarithmic of the
      LA size. A previous patch duplicated the lba_shift calculation into
      lightnvm. It prematurely also subtracted a 512byte shift, which commonly
      is applied per-command. The 512byte shift being subtracted twice led to
      data loss when restoring the logical to physical mapping table from
      device and when issuing I/O commands using rrpc.
      
      Fix offset by removing the 512byte shift subtraction when calculating
      lba_shift.
      
      Fixes: b0b4e09c "lightnvm: control life of nvm_dev in driver"
      Reported-by: default avatarJavier González <javier@cnexlabs.com>
      Signed-off-by: default avatarMatias Bjørling <m@bjorling.me>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      409ae5a7
    • Linus Torvalds's avatar
      Merge tag 'acpi-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 86e4ee76
      Linus Torvalds authored
      Pull ACPI fix from Rafael Wysocki:
       "Fix a recent regression in the 8250_dw serial driver introduced by
        adding a quirk for the APM X-Gene SoC to it which uncovered an issue
        related to the handling of built-in device properties in the core ACPI
        device enumeration code (Heikki Krogerus)"
      
      * tag 'acpi-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI / platform: Add support for build-in properties
      86e4ee76
    • Linus Torvalds's avatar
      Merge tag 'pm-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · b9f659b8
      Linus Torvalds authored
      Pull power management fixes from Rafael Wysocki:
       "These fix two bugs in error code paths in the PM core (system-wide
        suspend of devices), a device reference leak in the boot-time suspend
        test code and a cpupower utility regression from the 4.7 cycle.
      
        Specifics:
      
         - Prevent the PM core from attempting to suspend parent devices if
           any of their children, whose suspend callbacks were invoked
           asynchronously, have failed to suspend during the "late" and
           "noirq" phases of system-wide suspend of devices (Brian Norris).
      
         - Prevent the boot-time system suspend test code from leaking a
           reference to the RTC device used by it (Johan Hovold).
      
         - Fix cpupower to use the return value of one of its library
           functions correctly and restore the correct behavior of it when
           used for setting cpufreq tunables broken during the 4.7 development
           cycle (Laura Abbott)"
      
      * tag 'pm-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        PM / sleep: don't suspend parent when async child suspend_{noirq, late} fails
        PM / sleep: fix device reference leak in test_suspend
        cpupower: Correct return type of cpu_power_is_cpu_online() in cpufreq-set
      b9f659b8
    • Linus Torvalds's avatar
      Merge tag 'arc-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc · e6251f00
      Linus Torvalds authored
      Pull ARC fixes from Vineet Gupta:
      
       - mmap handler for dma ops as generic handler no longer works for us
         [Alexey]
      
       - Fixes for EZChip platform [Noam]
      
       - Fix RTC clocksource driver build issue
      
       - ARC IRQ handling fixes [Yuriy]
      
       - Revert a recent makefile change which doesn't go well with oldish
         tools out in the wild
      
      * tag 'arc-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc:
        ARCv2: MCIP: Use IDU_M_DISTRI_DEST mode if there is only 1 destination core
        ARC: IRQ: Do not use hwirq as virq and vice versa
        ARC: [plat-eznps] set default baud for early console
        ARC: [plat-eznps] remove IPI clear from SMP operations
        Revert "ARC: build: retire old toggles"
        ARC: timer: rtc: implement read loop in "C" vs. inline asm
        ARC: change return value of userspace cmpxchg assist syscall
        arc: Implement arch-specific dma_map_ops.mmap
        ARC: [SMP] avoid overriding present cpumask
        ARC: Enable PERF_EVENTS in nSIM driven platforms
      e6251f00
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v4.9-3' of... · e3d183c0
      Linus Torvalds authored
      Merge tag 'platform-drivers-x86-v4.9-3' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86
      
      Pull x86 platform driver fixes from Darren Hart:
       "Minor doc fix, a DMI match for ideapad and a fix to toshiba-wmi to
        avoid loading on non-toshiba systems.
      
        Documentation/ABI:
         - ibm_rtl: The "What:" fields are incomplete
      
        toshiba-wmi:
         - Fix loading the driver on non Toshiba laptops
      
        ideapad-laptop:
         - Add another DMI entry for Yoga 900"
      
      * tag 'platform-drivers-x86-v4.9-3' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86:
        Documentation/ABI: ibm_rtl: The "What:" fields are incomplete
        toshiba-wmi: Fix loading the driver on non Toshiba laptops
        ideapad-laptop: Add another DMI entry for Yoga 900
      e3d183c0
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.dk/linux-block · 5f3a5cb8
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "Two small (really, one liners both of them!) fixes that should go into
        this series:
      
         - Request allocation error handling fix for nbd, from Christophe,
           fixing a regression in this series.
      
         - An oops fix for drbd. Not a regression in this series, but stable
           material. From Richard"
      
      * 'for-linus' of git://git.kernel.dk/linux-block:
        drbd: Fix kernel_sendmsg() usage - potential NULL deref
        nbd: Fix error handling
      5f3a5cb8
    • Linus Torvalds's avatar
      Merge tag 'pci-v4.9-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci · 8233008f
      Linus Torvalds authored
      Pull PCI fixes from Bjorn Helgaas:
      
       - Update MAINTAINERS for Intel VMD driver filename
      
       - Update Rockchip rk3399 host bridge driver DTS and resets
      
       - Fix ROM shadow problem that made some video device initialization
         fail
      
      * tag 'pci-v4.9-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
        PCI: VMD: Update filename to reflect move
        arm64: dts: rockchip: add three new resets for rk3399 PCIe controller
        PCI: rockchip: Add three new resets as required properties
        PCI: Don't attempt to claim shadow copies of ROM
      8233008f
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-for-v4.9-rc5' of git://people.freedesktop.org/~airlied/linux · 4fb68f97
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "AMD, radeon, i915, imx, msm and udl fixes:
      
         - amdgpu/radeon have a number of power management regressions and
           fixes along with some better error checking
      
         - imx has a single regression fix
      
         - udl has a single kmalloc instead of stack for usb control msg fix
      
         - msm has some fixes for modesetting bugs and regressions
      
         - i915 has a one fix for a Sandybridge regression along with some
           others for DP audio.
      
        They all seem pretty okay at this stage, we've got one MST fix I know
        going through process for i915, but I expect it'll be next week"
      
      * tag 'drm-fixes-for-v4.9-rc5' of git://people.freedesktop.org/~airlied/linux: (30 commits)
        drm/udl: make control msg static const. (v2)
        drm/amd/powerplay: implement get_clock_by_type for iceland.
        drm/amd/powerplay/smu7: fix checks in smu7_get_evv_voltages (v2)
        drm/amd/powerplay: update phm_get_voltage_evv_on_sclk for iceland
        drm/amd/powerplay: propagate errors in phm_get_voltage_evv_on_sclk
        drm/imx: disable planes before DC
        drm/amd/powerplay: return false instead of -EINVAL
        drm/amdgpu/powerplay/smu7: fix unintialized data usage
        drm/amdgpu: fix crash in acp_hw_fini
        drm/i915: Limit Valleyview and earlier to only using mappable scanout
        drm/i915: Round tile chunks up for constructing partial VMAs
        drm/i915/dp: Extend BDW DP audio workaround to GEN9 platforms
        drm/i915/dp: BDW cdclk fix for DP audio
        drm/i915/vlv: Prevent enabling hpd polling in late suspend
        drm/i915: Respect alternate_ddc_pin for all DDI ports
        drm/msm: Fix error handling crashes seen when VRAM allocation fails
        drm/msm/mdp5: 8x16 actually has 8 mixer stages
        drm/msm/mdp5: no scaling support on RGBn pipes for 8x16
        drm/msm/mdp5: handle non-fullscreen base plane case
        drm/msm: Set CLK_IGNORE_UNUSED flag for PLL clocks
        ...
      4fb68f97
    • Linus Torvalds's avatar
      Merge tag 'mmc-v4.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc · b8b73df3
      Linus Torvalds authored
      Pull MMC fixes from Ulf Hansson:
       "MMC core:
         - Fix mmc card initialization for hosts not supporting HW busy
           detection
         - Fix mmc_test for sending commands during non-blocking write
      
        MMC host:
         - mxs: Avoid using an uninitialized
         - sdhci: Restore enhanced strobe setting during runtime resume
         - sdhci: Fix a couple of reset related issues
         - dw_mmc: Fix a reset controller issue"
      
      * tag 'mmc-v4.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
        mmc: mxs: Initialize the spinlock prior to using it
        mmc: mmc: Use 500ms as the default generic CMD6 timeout
        mmc: mmc_test: Fix "Commands during non-blocking write" tests
        mmc: sdhci: Fix missing enhanced strobe setting during runtime resume
        mmc: sdhci: Reset cmd and data circuits after tuning failure
        mmc: sdhci: Fix unexpected data interrupt handling
        mmc: sdhci: Fix CMD line reset interfering with ongoing data transfer
        mmc: dw_mmc: add the "reset" as name of reset controller
        Documentation: synopsys-dw-mshc: add binding for reset-names
      b8b73df3
    • Linus Torvalds's avatar
      Merge tag 'pinctrl-v4.9-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · 5c03b53c
      Linus Torvalds authored
      Pull pin control fixes from Linus Walleij:
       "All is about drivers, no core business going on.
      
         - Fix a host of runtime problems with the Intel Cherryview driver:
           suspend/resume needs to be marshalled properly, and strange effects
           from BIOS interaction during suspend/resume need to be dealt with.
      
         - A single bit was being set wrong in the Aspeed driver.
      
         - Fix an iProc probe ordering fallout resulting from v4.9
           refactorings for bus population.
      
         - Do not specify a default trigger in the ST Micro cascaded GPIO IRQ
           controller: the kernel will moan.
      
         - Make IRQs optional altogether on the STM32 driver, it turns out not
           all systems have them or want them.
      
         - Fix a re-probe bug in the i.MX driver, it will eventually crash if
           probed repeatedly, not good"
      
      * tag 'pinctrl-v4.9-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        pinctrl-aspeed-g5: Never set SCU90[6]
        pinctrl: cherryview: Prevent possible interrupt storm on resume
        pinctrl: cherryview: Serialize register access in suspend/resume
        pinctrl: imx: reset group index on probe
        pinctrl: stm32: move gpio irqs binding to optional
        pinctrl: stm32: remove dependency with interrupt controller
        pinctrl: st: don't specify default interrupt trigger
        pinctrl: iproc: Fix iProc and NSP GPIO support
      5c03b53c
  4. 11 Nov, 2016 3 commits
    • Rafael J. Wysocki's avatar
      Merge branches 'pm-tools-fixes' and 'pm-sleep-fixes' · cd16f3dc
      Rafael J. Wysocki authored
      * pm-tools-fixes:
        cpupower: Correct return type of cpu_power_is_cpu_online() in cpufreq-set
      
      * pm-sleep-fixes:
        PM / sleep: don't suspend parent when async child suspend_{noirq, late} fails
        PM / sleep: fix device reference leak in test_suspend
      cd16f3dc
    • Rafael J. Wysocki's avatar
      Merge branch 'device-properties' · 66f5854c
      Rafael J. Wysocki authored
      * device-properties:
        ACPI / platform: Add support for build-in properties
      66f5854c
    • Linus Torvalds's avatar
      Merge branch 'maybe-uninitialized' (patches from Arnd) · 015ed943
      Linus Torvalds authored
      Merge fixes for -Wmaybe-uninitialized from Arnd Bergmann:
       "It took a while for some patches to make it into mainline through
        maintainer trees, but the 28-patch series is now reduced to 10, with
        one tiny patch added at the end.
      
        Aside from patches that are no longer required, I did these changes
        compared to version 1:
      
         - Dropped "iio: maxim_thermocouple: detect invalid storage size in
           read()", which is currently in linux-next as commit 32cb7d27.
           This is the only remaining warning I see for a couple of corner
           cases (kbuild bot reports it on blackfin, kernelci bot and arm-soc
           bot both report it on arm64)
      
         - Dropped "brcmfmac: avoid maybe-uninitialized warning in
           brcmf_cfg80211_start_ap", which is currently in net/master merge
           pending.
      
         - Dropped two x86 patches, "x86: math-emu: possible uninitialized
           variable use" and "x86: mark target address as output in 'insb'
           asm" as they do not seem to trigger for a default build, and I got
           no feedback on them. Both of these are ancient issues and seem
           harmless, I will send them again to the x86 maintainers once the
           rest is merged.
      
         - Dropped "rbd: false-postive gcc-4.9 -Wmaybe-uninitialized" based on
           feedback from Ilya Dryomov, who already has a different fix queued
           up for v4.10. The kbuild bot reports this as a warning for xtensa.
      
         - Replaced "crypto: aesni: avoid -Wmaybe-uninitialized warning" with
           a simpler patch, this one always triggers but my first solution
           would not be safe for linux-4.9 any more at this point. I'll follow
           up with the larger patch as a cleanup for 4.10.
      
         - Replaced "dib0700: fix nec repeat handling" with a better one,
           contributed by Sean Young"
      
      * -Wmaybe-uninitialized fixes:
        Kbuild: enable -Wmaybe-uninitialized warnings by default
        pcmcia: fix return value of soc_pcmcia_regulator_set
        infiniband: shut up a maybe-uninitialized warning
        crypto: aesni: shut up -Wmaybe-uninitialized warning
        rc: print correct variable for z8f0811
        dib0700: fix nec repeat handling
        s390: pci: don't print uninitialized data for debugging
        nios2: fix timer initcall return value
        x86: apm: avoid uninitialized data
        NFSv4.1: work around -Wmaybe-uninitialized warning
        Kbuild: enable -Wmaybe-uninitialized warning for "make W=1"
      015ed943