1. 07 11月, 2016 5 次提交
    • N
      i2c: bcm2835: Add support for Repeated Start Condition · ee05fea2
      Noralf Trønnes 提交于
      Documentation/i2c/i2c-protocol states that Combined transactions should
      separate messages with a Start bit and end the whole transaction with a
      Stop bit. This patch adds support for issuing only a Start between
      messages instead of a Stop followed by a Start.
      
      This implementation differs from downstream i2c-bcm2708 in 2 respects:
      - it uses an interrupt to detect that the transfer is active instead
        of using polling. There is no interrupt for Transfer Active, but by
        not prefilling the FIFO it's possible to use the TXW interrupt.
      - when resetting/disabling the controller between transfers it writes
        CLEAR to the control register instead of just zero.
        Using just zero gave many errors. This might be the reason why
        downstream had to disable this feature and make it available with a
        module parameter.
      
      I have run thousands of transfers to a DS1307 (rtc), MMA8451 (accel)
      and AT24C32 (eeprom) in parallel without problems.
      Signed-off-by: NNoralf Trønnes <noralf@tronnes.org>
      Acked-by: NEric Anholt <eric@anholt.net>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      ee05fea2
    • N
      i2c: bcm2835: Can't support I2C_M_IGNORE_NAK · 8d2cc5cc
      Noralf Trønnes 提交于
      The controller can't support this flag, so remove it.
      
      Documentation/i2c/i2c-protocol states that all of the message is sent:
      
      I2C_M_IGNORE_NAK:
          Normally message is interrupted immediately if there is [NA] from the
          client. Setting this flag treats any [NA] as [A], and all of
          message is sent.
      
      >From the BCM2835 ARM Peripherals datasheet:
      
          The ERR field is set when the slave fails to acknowledge either
          its address or a data byte written to it.
      
      So when the controller doesn't receive an ack, it sets ERR and raises
      an interrupt. In other words, the whole message is not sent.
      Signed-off-by: NNoralf Trønnes <noralf@tronnes.org>
      Reviewed-by: NEric Anholt <eric@anholt.net>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      8d2cc5cc
    • N
      i2c: bcm2835: Use dev_dbg logging on transfer errors · 23c9540b
      Noralf Trønnes 提交于
      Writing to an AT24C32 generates on average 2x i2c transfer errors per
      32-byte page write. Which amounts to a lot for a 4k write. This is due
      to the fact that the chip doesn't respond during it's internal write
      cycle when the at24 driver tries and retries the next write.
      Only a handful drivers use dev_err() on transfer error, so switch to
      dev_dbg() instead.
      Signed-off-by: NNoralf Trønnes <noralf@tronnes.org>
      Reviewed-by: NEric Anholt <eric@anholt.net>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      23c9540b
    • N
      i2c: bcm2835: Protect against unexpected TXW/RXR interrupts · d4030d75
      Noralf Trønnes 提交于
      If an unexpected TXW or RXR interrupt occurs (msg_buf_remaining == 0),
      the driver has no way to fill/drain the FIFO to stop the interrupts.
      In this case the controller has to be disabled and the transfer
      completed to avoid hang.
      
      (CLKT | ERR) and DONE interrupts are completed in their own paths, and
      the controller is disabled in the transfer function after completion.
      Unite the code paths and do disabling inside the interrupt routine.
      
      Clear interrupt status bits in the united completion path instead of
      trying to do it on every interrupt which isn't necessary.
      Only CLKT, ERR and DONE can be cleared that way.
      
      Add the status value to the error value in case of TXW/RXR errors to
      distinguish them from the other S_LEN error.
      Signed-off-by: NNoralf Trønnes <noralf@tronnes.org>
      Reviewed-by: NEric Anholt <eric@anholt.net>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      d4030d75
    • N
      i2c: bcm2835: Fix hang for writing messages larger than 16 bytes · e2474541
      Noralf Trønnes 提交于
      Writing messages larger than the FIFO size results in a hang, rendering
      the machine unusable. This is because the RXD status flag is set on the
      first interrupt which results in bcm2835_drain_rxfifo() stealing bytes
      from the buffer. The controller continues to trigger interrupts waiting
      for the missing bytes, but bcm2835_fill_txfifo() has none to give.
      In this situation wait_for_completion_timeout() apparently is unable to
      stop the madness.
      
      The BCM2835 ARM Peripherals datasheet has this to say about the flags:
        TXD: is set when the FIFO has space for at least one byte of data.
        RXD: is set when the FIFO contains at least one byte of data.
        TXW: is set during a write transfer and the FIFO is less than full.
        RXR: is set during a read transfer and the FIFO is or more full.
      
      Implementing the logic from the downstream i2c-bcm2708 driver solved
      the hang problem.
      Signed-off-by: NNoralf Trønnes <noralf@tronnes.org>
      Reviewed-by: NEric Anholt <eric@anholt.net>
      Reviewed-by: NMartin Sperl <kernel@martin.sperl.org>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      e2474541
  2. 06 11月, 2016 12 次提交
  3. 05 11月, 2016 9 次提交
    • L
      Merge tag 'nfsd-4.9-1' of git://linux-nfs.org/~bfields/linux · fb415f22
      Linus Torvalds 提交于
      Pull nfsd bugfixes from Bruce Fields:
       "Fixes for some recent regressions including fallout from the vmalloc'd
        stack change (after which we can no longer encrypt stuff on the
        stack)"
      
      * tag 'nfsd-4.9-1' of git://linux-nfs.org/~bfields/linux:
        nfsd: Fix general protection fault in release_lock_stateid()
        svcrdma: backchannel cannot share a page for send and rcv buffers
        sunrpc: fix some missing rq_rbuffer assignments
        sunrpc: don't pass on-stack memory to sg_set_buf
        nfsd: move blocked lock handling under a dedicated spinlock
      fb415f22
    • L
      Merge branch 'for-4.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 46d7cbb2
      Linus Torvalds 提交于
      Pull btrfs fixes from Chris Mason:
       "Some fixes that Dave Sterba collected.  We held off on these last week
        because I was focused on the memory corruption testing"
      
      * 'for-4.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: fix WARNING in btrfs_select_ref_head()
        Btrfs: remove some no-op casts
        btrfs: pass correct args to btrfs_async_run_delayed_refs()
        btrfs: make file clone aware of fatal signals
        btrfs: qgroup: Prevent qgroup->reserved from going subzero
        Btrfs: kill BUG_ON in do_relocation
      46d7cbb2
    • L
      Merge branch 'overlayfs-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs · bd30fac1
      Linus Torvalds 提交于
      Pull overlayfs fixes from Miklos Szeredi:
       "Fix two more POSIX ACL bugs introduced in 4.8 and add a missing fsync
        during copy up to prevent possible data loss"
      
      * 'overlayfs-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs:
        ovl: fsync after copy-up
        ovl: fix get_acl() on tmpfs
        ovl: update S_ISGID when setting posix ACLs
      bd30fac1
    • L
      Merge tag 'drm-fixes-for-v4.9-rc4' of git://people.freedesktop.org/~airlied/linux · d4c5f43d
      Linus Torvalds 提交于
      Pull drm fixes from Dave Airlie:
       "Fixes for amdgpu, radeon, intel, imx and virtio-gpu.
      
        This is a bit larger than I'd like, but I had some stuff I meant to
        send for -rc3 but was waiting for the PAT regression fix to land. So
        this is really fixes for rc3 and rc4 in one go.
      
        There are a set of fixes for an oops we've been seeing around MST
        display unplug, along with more suspend/resume and shutdown fixes for
        amdgpu, one power management follow on fix for nouveau, and set of imx
        fixes, and a single virtio-gpu regression fix"
      
      * tag 'drm-fixes-for-v4.9-rc4' of git://people.freedesktop.org/~airlied/linux: (54 commits)
        virtio-gpu: fix vblank events
        drm/nouveau/acpi: fix check for power resources support
        drm/i915: Fix SKL+ 90/270 degree rotated plane coordinate computation
        drm/i915: Remove two invalid warns
        drm/i915: Rotated view does not need a fence
        drm/i915/fbc: fix CFB size calculation for gen8+
        drm: i915: Wait for fences on new fb, not old
        drm/i915: Clean up DDI DDC/AUX CH sanitation
        drm/i915: Respect alternate_aux_channel for all DDI ports
        drm/i915/gen9: fix watermarks when using the pipe scaler
        drm/i915: Fix mismatched INIT power domain disabling during suspend
        drm/i915: fix a read size argument
        drm/i915: Use fence_write() from rpm resume
        drm/i915/gen9: fix DDB partitioning for multi-screen cases
        drm/i915: workaround sparse warning on variable length arrays
        drm/i915: keep declarations in i915_drv.h
        drm/amd/powerplay: fix bug get wrong evv voltage of Polaris.
        drm/amdgpu/si_dpm: workaround for SI kickers
        drm/radeon/si_dpm: workaround for SI kickers
        drm/amdgpu: fix s3 resume back, uvd dpm randomly can't disable.
        ...
      d4c5f43d
    • N
      PCI: designware: Check for iATU unroll support after initializing host · 416379f9
      Niklas Cassel 提交于
      dw_pcie_iatu_unroll_enabled() reads a dbi_base register.  Reading any
      dbi_base register before pp->ops->host_init has been called causes
      "imprecise external abort" on platforms like ARTPEC-6, where the PCIe
      module is disabled at boot and first enabled in pp->ops->host_init.  Move
      dw_pcie_iatu_unroll_enabled() to dw_pcie_setup_rc(), since it is after
      pp->ops->host_init, but before pp->iatu_unroll_enabled is actually used.
      
      Fixes: a0601a47 ("PCI: designware: Add iATU Unroll feature")
      Tested-by: NJames Le Cuirot <chewi@gentoo.org>
      Signed-off-by: NNiklas Cassel <niklas.cassel@axis.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NJoao Pinto <jpinto@synopsys.com>
      Acked-by: NOlof Johansson <olof@lixom.net>
      416379f9
    • L
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 66cecb67
      Linus Torvalds 提交于
      Pull KVM updates from Paolo Bonzini:
       "One NULL pointer dereference, and two fixes for regressions introduced
        during the merge window.
      
        The rest are fixes for MIPS, s390 and nested VMX"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        kvm: x86: Check memopp before dereference (CVE-2016-8630)
        kvm: nVMX: VMCLEAR an active shadow VMCS after last use
        KVM: x86: drop TSC offsetting kvm_x86_ops to fix KVM_GET/SET_CLOCK
        KVM: x86: fix wbinvd_dirty_mask use-after-free
        kvm/x86: Show WRMSR data is in hex
        kvm: nVMX: Fix kernel panics induced by illegal INVEPT/INVVPID types
        KVM: document lock orders
        KVM: fix OOPS on flush_work
        KVM: s390: Fix STHYI buffer alignment for diag224
        KVM: MIPS: Precalculate MMIO load resume PC
        KVM: MIPS: Make ERET handle ERL before EXL
        KVM: MIPS: Fix lazy user ASID regenerate for SMP
      66cecb67
    • L
      Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus · 34c510b2
      Linus Torvalds 提交于
      Pull MIPS fixes from Ralf Baechle:
       "A set of MIPS fixes for 4.9:
      
         - lots of fixes for printk continuations
         - six fixes for FP related code.
         - fix max_low_pfn with disabled highmem
         - fix KASLR handling of NULL FDT and KASLR for generic kernels
         - fix build of compressed image
         - provide default mips_cpc_default_phys_base to ignore CPC
         - fix reboot on Malta"
      
      * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
        MIPS: Fix max_low_pfn with disabled highmem
        MIPS: Correct MIPS I FP sigcontext layout
        MIPS: Fix ISA I/II FP signal context offsets
        MIPS: Remove FIR from ISA I FP signal context
        MIPS: Fix ISA I FP sigcontext access violation handling
        MIPS: Fix FCSR Cause bit handling for correct SIGFPE issue
        MIPS: ptrace: Also initialize the FP context on individual FCSR writes
        MIPS: dump_tlb: Fix printk continuations
        MIPS: Fix __show_regs() output
        MIPS: traps: Fix output of show_code
        MIPS: traps: Fix output of show_stacktrace
        MIPS: traps: Fix output of show_backtrace
        MIPS: Fix build of compressed image
        MIPS: generic: Fix KASLR for generic kernel.
        MIPS: KASLR: Fix handling of NULL FDT
        MIPS: Malta: Fixup reboot
        MIPS: CPC: Provide default mips_cpc_default_phys_base to ignore CPC
      34c510b2
    • L
      Merge branch 'parisc-4.9-3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux · f7df76e6
      Linus Torvalds 提交于
      Pull parisc updates from Helge Deller:
       "The first three patches are trivial and add some required KERN_CONT,
        ignore the new pkey syscalls on parisc and use the LINUX_GATEWAY_ADDR
        define instead of hardcoded values.
      
        The two patches from Dave Anglin are important.
      
        The first one avoids trashing the sr2 and sr3 space registers in the
        Light-weight syscall path. Especially the usage of sr3 is critical
        since it may get trashed by the interrupt handler.
      
        The second patch is even more important and tagged for stable series.
        It protects one critical section in the syscall entry path by
        disabling local interrupts. Without disabling interrupts, the sr7
        space register may not be in sync with the current stack setup and
        thus an incoming hardware interrupt may destroy memory in random
        userspace areas"
      
      * 'parisc-4.9-3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
        parisc: Ignore the pkey system calls for now
        parisc: Use LINUX_GATEWAY_ADDR define instead of hardcoded value
        parisc: Ensure consistent state when switching to kernel stack at syscall entry
        parisc: Avoid trashing sr2 and sr3 in LWS code
        parisc: use KERN_CONT when printing device inventory
      f7df76e6
    • V
      i2c: core: fix NULL pointer dereference under race condition · 147b36d5
      Vladimir Zapolskiy 提交于
      Race condition between registering an I2C device driver and
      deregistering an I2C adapter device which is assumed to manage that
      I2C device may lead to a NULL pointer dereference due to the
      uninitialized list head of driver clients.
      
      The root cause of the issue is that the I2C bus may know about the
      registered device driver and thus it is matched by bus_for_each_drv(),
      but the list of clients is not initialized and commonly it is NULL,
      because I2C device drivers define struct i2c_driver as static and
      clients field is expected to be initialized by I2C core:
      
        i2c_register_driver()             i2c_del_adapter()
          driver_register()                 ...
            bus_add_driver()                ...
              ...                           bus_for_each_drv(..., __process_removed_adapter)
            ...                               i2c_do_del_adapter()
          ...                                   list_for_each_entry_safe(..., &driver->clients, ...)
          INIT_LIST_HEAD(&driver->clients);
      
      To solve the problem it is sufficient to do clients list head
      initialization before calling driver_register().
      
      The problem was found while using an I2C device driver with a sluggish
      registration routine on a bus provided by a physically detachable I2C
      master controller, but practically the oops may be reproduced under
      the race between arbitraty I2C device driver registration and managing
      I2C bus device removal e.g. by unbinding the latter over sysfs:
      
      % echo 21a4000.i2c > /sys/bus/platform/drivers/imx-i2c/unbind
        Unable to handle kernel NULL pointer dereference at virtual address 00000000
        Internal error: Oops: 17 [#1] SMP ARM
        CPU: 2 PID: 533 Comm: sh Not tainted 4.9.0-rc3+ #61
        Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
        task: e5ada400 task.stack: e4936000
        PC is at i2c_do_del_adapter+0x20/0xcc
        LR is at __process_removed_adapter+0x14/0x1c
        Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
        Control: 10c5387d  Table: 35bd004a  DAC: 00000051
        Process sh (pid: 533, stack limit = 0xe4936210)
        Stack: (0xe4937d28 to 0xe4938000)
        Backtrace:
        [<c0667be0>] (i2c_do_del_adapter) from [<c0667cc0>] (__process_removed_adapter+0x14/0x1c)
        [<c0667cac>] (__process_removed_adapter) from [<c0516998>] (bus_for_each_drv+0x6c/0xa0)
        [<c051692c>] (bus_for_each_drv) from [<c06685ec>] (i2c_del_adapter+0xbc/0x284)
        [<c0668530>] (i2c_del_adapter) from [<bf0110ec>] (i2c_imx_remove+0x44/0x164 [i2c_imx])
        [<bf0110a8>] (i2c_imx_remove [i2c_imx]) from [<c051a838>] (platform_drv_remove+0x2c/0x44)
        [<c051a80c>] (platform_drv_remove) from [<c05183d8>] (__device_release_driver+0x90/0x12c)
        [<c0518348>] (__device_release_driver) from [<c051849c>] (device_release_driver+0x28/0x34)
        [<c0518474>] (device_release_driver) from [<c0517150>] (unbind_store+0x80/0x104)
        [<c05170d0>] (unbind_store) from [<c0516520>] (drv_attr_store+0x28/0x34)
        [<c05164f8>] (drv_attr_store) from [<c0298acc>] (sysfs_kf_write+0x50/0x54)
        [<c0298a7c>] (sysfs_kf_write) from [<c029801c>] (kernfs_fop_write+0x100/0x214)
        [<c0297f1c>] (kernfs_fop_write) from [<c0220130>] (__vfs_write+0x34/0x120)
        [<c02200fc>] (__vfs_write) from [<c0221088>] (vfs_write+0xa8/0x170)
        [<c0220fe0>] (vfs_write) from [<c0221e74>] (SyS_write+0x4c/0xa8)
        [<c0221e28>] (SyS_write) from [<c0108a20>] (ret_fast_syscall+0x0/0x1c)
      Signed-off-by: NVladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      Cc: stable@kernel.org
      147b36d5
  4. 04 11月, 2016 14 次提交