1. 20 Jun, 2019 10 commits
    • Linus Torvalds's avatar
      Merge tag 'fuse-fixes-5.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse · b910f6a7
      Linus Torvalds authored
      Pull fuse fix from Miklos Szeredi:
       "Just a single revert, fixing a regression in -rc1"
      
      * tag 'fuse-fixes-5.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse:
        Revert "fuse: require /dev/fuse reads to have enough buffer capacity"
      b910f6a7
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · b3e97833
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
       "Fixes for ARM and x86, plus selftest patches and nicer structs for
        nested state save/restore"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: nVMX: reorganize initial steps of vmx_set_nested_state
        KVM: arm/arm64: Fix emulated ptimer irq injection
        tests: kvm: Check for a kernel warning
        kvm: tests: Sort tests in the Makefile alphabetically
        KVM: x86/mmu: Allocate PAE root array when using SVM's 32-bit NPT
        KVM: x86: Modify struct kvm_nested_state to have explicit fields for data
        KVM: fix typo in documentation
        KVM: nVMX: use correct clean fields when copying from eVMCS
        KVM: arm/arm64: vgic: Fix kvm_device leak in vgic_its_destroy
        KVM: arm64: Filter out invalid core register IDs in KVM_GET_REG_LIST
        KVM: arm64: Implement vq_present() as a macro
      b3e97833
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · e9293874
      Linus Torvalds authored
      Pull arm64 fixes from Will Deacon:
       "This is mainly a couple of email address updates to MAINTAINERS, but
        we've also fixed a UAPI build issue with musl libc and an accidental
        double-initialisation of our pgd_cache due to a naming conflict with a
        weak symbol.
      
        There are a couple of outstanding issues that have been reported, but
        it doesn't look like they're new and we're still a long way off from
        fully debugging them.
      
        Summary:
      
         - Fix use of #include in UAPI headers for compatability with musl libc
      
         - Update email addresses in MAINTAINERS
      
         - Fix initialisation of pgd_cache due to name collision with weak symbol"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64/mm: don't initialize pgd_cache twice
        MAINTAINERS: Update my email address
        arm64/sve: <uapi/asm/ptrace.h> should not depend on <uapi/linux/prctl.h>
        arm64: ssbd: explicitly depend on <linux/prctl.h>
        MAINTAINERS: Update my email address to use @kernel.org
      e9293874
    • Linus Torvalds's avatar
      Merge tag 's390-5.2-5' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · a409de61
      Linus Torvalds authored
      Pull s390 fixes from Heiko Carstens:
      
       - Disable address-of-packed-member warning in s390 specific boot code
         to get rid of a gcc9 warning which otherwise is already disabled for
         the whole kernel.
      
       - Fix yet another compiler error seen with CONFIG_OPTIMIZE_INLINING
         enabled.
      
       - Fix memory leak in vfio-ccw code on module exit.
      
      * tag 's390-5.2-5' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        vfio-ccw: Destroy kmem cache region on module exit
        s390/ctl_reg: mark __ctl_set_bit and __ctl_clear_bit as __always_inline
        s390/boot: disable address-of-packed-member warning
      a409de61
    • Linus Torvalds's avatar
      Merge tag 'for_v5.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs · d72558b2
      Linus Torvalds authored
      Pull two misc vfs fixes from Jan Kara:
       "One small quota fix fixing spurious EDQUOT errors and one fanotify fix
        fixing a bug in the new fanotify FID reporting code"
      
      * tag 'for_v5.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
        fanotify: update connector fsid cache on add mark
        quota: fix a problem about transfer quota
      d72558b2
    • Linus Torvalds's avatar
      Merge tag 'mmc-v5.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc · 6331d118
      Linus Torvalds authored
      Pull MMC fixes from Ulf Hansson:
       "Here's quite a few MMC fixes intended for v5.2-rc6. This time it also
        contains fixes for a WiFi driver, which device is attached to the SDIO
        interface. Patches for the WiFi driver have been acked by the
        corresponding maintainers.
      
        Summary:
      
        MMC core:
         - Make switch to eMMC HS400 more robust for some controllers
         - Add two SDIO func API to manage re-tuning constraints
         - Prevent processing SDIO IRQs when the card is suspended
      
        MMC host:
         - sdhi: Disallow broken HS400 for M3-W ES1.2, RZ/G2M and V3H
         - mtk-sd: Fixup support for SDIO IRQs
         - sdhci-pci-o2micro: Fixup support for tuning
      
        Wireless BRCMFMAC (SDIO):
         - Deal with expected transmission errors related to the idle states
           (handled by the Always-On-Subsystem or AOS) on the SDIO-based WiFi
           on rk3288-veyron-minnie, rk3288-veyron-speedy and
           rk3288-veyron-mickey"
      
      * tag 'mmc-v5.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
        mmc: core: Prevent processing SDIO IRQs when the card is suspended
        mmc: sdhci: sdhci-pci-o2micro: Correctly set bus width when tuning
        brcmfmac: sdio: Don't tune while the card is off
        mmc: core: Add sdio_retune_hold_now() and sdio_retune_release()
        brcmfmac: sdio: Disable auto-tuning around commands expected to fail
        mmc: core: API to temporarily disable retuning for SDIO CRC errors
        Revert "brcmfmac: disable command decode in sdio_aos"
        mmc: mediatek: fix SDIO IRQ detection issue
        mmc: mediatek: fix SDIO IRQ interrupt handle flow
        mmc: core: complete HS400 before checking status
        mmc: sdhi: disallow HS400 for M3-W ES1.2, RZ/G2M, and V3H
      6331d118
    • Linus Torvalds's avatar
      Merge tag 'for-linus-20190620' of git://git.kernel.dk/linux-block · 41a247d8
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "Three fixes that should go into this series.
      
        One is a set of two patches from Christoph, fixing a page leak on same
        page merges. Boiled down version of a bigger fix, but this one is more
        appropriate for this late in the cycle (and easier to backport to
        stable).
      
        The last patch is for a divide error in MD, from Mariusz (via Song)"
      
      * tag 'for-linus-20190620' of git://git.kernel.dk/linux-block:
        md: fix for divide error in status_resync
        block: fix page leak when merging to same page
        block: return from __bio_try_merge_page if merging occured in the same page
      41a247d8
    • Paolo Bonzini's avatar
      Merge tag 'kvmarm-fixes-for-5.2-2' of... · b21e31b2
      Paolo Bonzini authored
      Merge tag 'kvmarm-fixes-for-5.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD
      
      KVM/arm fixes for 5.2, take #2
      
      - SVE cleanup killing a warning with ancient GCC versions
      - Don't report non-existent system registers to userspace
      - Fix memory leak when freeing the vgic ITS
      - Properly lower the interrupt on the emulated physical timer
      b21e31b2
    • Paolo Bonzini's avatar
      KVM: nVMX: reorganize initial steps of vmx_set_nested_state · 9fd58877
      Paolo Bonzini authored
      Commit 332d0797 ("KVM: nVMX: KVM_SET_NESTED_STATE - Tear down old EVMCS
      state before setting new state", 2019-05-02) broke evmcs_test because the
      eVMCS setup must be performed even if there is no VMXON region defined,
      as long as the eVMCS bit is set in the assist page.
      
      While the simplest possible fix would be to add a check on
      kvm_state->flags & KVM_STATE_NESTED_EVMCS in the initial "if" that
      covers kvm_state->hdr.vmx.vmxon_pa == -1ull, that is quite ugly.
      
      Instead, this patch moves checks earlier in the function and
      conditionalizes them on kvm_state->hdr.vmx.vmxon_pa, so that
      vmx_set_nested_state always goes through vmx_leave_nested
      and nested_enable_evmcs.
      
      Fixes: 332d0797 ("KVM: nVMX: KVM_SET_NESTED_STATE - Tear down old EVMCS state before setting new state")
      Cc: Aaron Lewis <aaronlewis@google.com>
      Reviewed-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      9fd58877
    • J. Bruce Fields's avatar
      nfsd: replace Jeff by Chuck as nfsd co-maintainer · 241e3900
      J. Bruce Fields authored
      Jeff's picking up more responsibilities elsewhere, and Chuck's agreed to
      take over.
      
      For now, as before, nothing's changing day-to-day, but I want to have a
      co-maintainer if only for bus factor.
      Acked-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      241e3900
  2. 19 Jun, 2019 10 commits
  3. 18 Jun, 2019 20 commits
    • Mike Salvatore's avatar
      apparmor: reset pos on failure to unpack for various functions · 156e4299
      Mike Salvatore authored
      Each function that manipulates the aa_ext struct should reset it's "pos"
      member on failure. This ensures that, on failure, no changes are made to
      the state of the aa_ext struct.
      
      There are paths were elements are optional and the error path is
      used to indicate the optional element is not present. This means
      instead of just aborting on error the unpack stream can become
      unsynchronized on optional elements, if using one of the affected
      functions.
      
      Cc: stable@vger.kernel.org
      Fixes: 736ec752 ("AppArmor: policy routines for loading and unpacking policy")
      Signed-off-by: default avatarMike Salvatore <mike.salvatore@canonical.com>
      Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
      156e4299
    • Jann Horn's avatar
      apparmor: enforce nullbyte at end of tag string · 8404d7a6
      Jann Horn authored
      A packed AppArmor policy contains null-terminated tag strings that are read
      by unpack_nameX(). However, unpack_nameX() uses string functions on them
      without ensuring that they are actually null-terminated, potentially
      leading to out-of-bounds accesses.
      
      Make sure that the tag string is null-terminated before passing it to
      strcmp().
      
      Cc: stable@vger.kernel.org
      Fixes: 736ec752 ("AppArmor: policy routines for loading and unpacking policy")
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
      8404d7a6
    • John Johansen's avatar
      apparmor: fix PROFILE_MEDIATES for untrusted input · 23375b13
      John Johansen authored
      While commit 11c236b8 ("apparmor: add a default null dfa") ensure
      every profile has a policy.dfa it does not resize the policy.start[]
      to have entries for every possible start value. Which means
      PROFILE_MEDIATES is not safe to use on untrusted input. Unforunately
      commit b9590ad4 ("apparmor: remove POLICY_MEDIATES_SAFE") did not
      take into account the start value usage.
      
      The input string in profile_query_cb() is user controlled and is not
      properly checked to be within the limited start[] entries, even worse
      it can't be as userspace policy is allowed to make us of entries types
      the kernel does not know about. This mean usespace can currently cause
      the kernel to access memory up to 240 entries beyond the start array
      bounds.
      
      Cc: stable@vger.kernel.org
      Fixes: b9590ad4 ("apparmor: remove POLICY_MEDIATES_SAFE")
      Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
      23375b13
    • Jens Axboe's avatar
      Merge branch 'md-fixes' of https://github.com/liu-song-6/linux into for-linus · 440078db
      Jens Axboe authored
      Pull MD fix from Song.
      
      * 'md-fixes' of https://github.com/liu-song-6/linux:
        md: fix for divide error in status_resync
      440078db
    • Linus Torvalds's avatar
      Merge tag 'for-5.2-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · bed3c0d8
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
      
       - regression where properties stored as xattrs are not properly
         persisted
      
       - a small readahead fix (the fstests testcase for that fix hangs on
         unpatched kernel, so we'd like get it merged to ease future testing)
      
       - fix a race during block group creation and deletion
      
      * tag 'for-5.2-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        Btrfs: fix failure to persist compression property xattr deletion on fsync
        btrfs: start readahead also in seed devices
        Btrfs: fix race between block group removal and block group allocation
      bed3c0d8
    • Linus Torvalds's avatar
      Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 7b306892
      Linus Torvalds authored
      Pull ARM SoC fixes from Olof Johansson:
       "I've been bad at collecting fixes this release cycle, so this is a
        fairly large batch that's been trickling in for a while.
      
        It's the usual mix, more or less.
      
        Some of the bigger things fixed:
      
         - Voltage fix for MMC on TI DRA7 that sometimes would overvoltage
           cards
      
         - Regression fixes for D_CAN on am355x
      
         - i.MX6SX cpuidle fix to deal with wakeup latency (dropped uart
           chars)
      
         - DT fixes for some DRA7 variants that don't share the superset of
           blocks on the chip
      
        plus the usual mix of stuff: minor build/warning fixes, Kconfig
        dependencies, and some DT fixlets"
      
      * tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (28 commits)
        soc: ixp4xx: npe: Fix an IS_ERR() vs NULL check in probe
        ARM: ixp4xx: include irqs.h where needed
        ARM: ixp4xx: mark ixp4xx_irq_setup as __init
        ARM: ixp4xx: don't select SERIAL_OF_PLATFORM
        firmware: trusted_foundations: add ARMv7 dependency
        MAINTAINERS: Change QCOM repo location
        ARM: davinci: da8xx: specify dma_coherent_mask for lcdc
        ARM: davinci: da850-evm: call regulator_has_full_constraints()
        ARM: mvebu_v7_defconfig: fix Ethernet on Clearfog
        ARM: dts: am335x phytec boards: Fix cd-gpios active level
        ARM: dts: dra72x: Disable usb4_tm target module
        arm64: arch_k3: Fix kconfig dependency warning
        ARM: dts: Drop bogus CLKSEL for timer12 on dra7
        MAINTAINERS: Update Stefan Wahren email address
        ARM: dts: bcm: Add missing device_type = "memory" property
        soc: bcm: brcmstb: biuctrl: Register writes require a barrier
        soc: brcmstb: Fix error path for unsupported CPUs
        ARM: dts: dra71x: Disable usb4_tm target module
        ARM: dts: dra71x: Disable rtc target module
        ARM: dts: dra76x: Disable usb4_tm target module
        ...
      7b306892
    • Linus Torvalds's avatar
      Merge tag 'meminit-v5.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 915ed932
      Linus Torvalds authored
      Pull stack init fix from Kees Cook:
       "This is a small update to the stack auto-initialization self-test code
        to deal with the Clang initialization pattern.
      
        It's been in linux-next for a couple weeks; I had waited a bit
        wondering if anything more substantial was going to show up, but
        nothing has, so I'm sending this now before it gets too late"
      
      * tag 'meminit-v5.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        lib/test_stackinit: Handle Clang auto-initialization pattern
      915ed932
    • Dennis Restle's avatar
      KVM: fix typo in documentation · 76e3bcdb
      Dennis Restle authored
      The documentation mentions a non-existing capability KVM_CAP_USER_MEM.s
      The right name is KVM_CAP_USER_MEMORY.
      Signed-off-by: default avatarDennis Restle <derestle@htwg-konstanz.de>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      76e3bcdb
    • Mariusz Tkaczyk's avatar
      md: fix for divide error in status_resync · 9642fa73
      Mariusz Tkaczyk authored
      Stopping external metadata arrays during resync/recovery causes
      retries, loop of interrupting and starting reconstruction, until it
      hit at good moment to stop completely. While these retries
      curr_mark_cnt can be small- especially on HDD drives, so subtraction
      result can be smaller than 0. However it is casted to uint without
      checking. As a result of it the status bar in /proc/mdstat while stopping
      is strange (it jumps between 0% and 99%).
      
      The real problem occurs here after commit 72deb455 ("block: remove
      CONFIG_LBDAF"). Sector_div() macro has been changed, now the
      divisor is casted to uint32. For db = -8 the divisior(db/32-1) becomes 0.
      
      Check if db value can be really counted and replace these macro by
      div64_u64() inline.
      Signed-off-by: default avatarMariusz Tkaczyk <mariusz.tkaczyk@intel.com>
      Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
      9642fa73
    • Dan Carpenter's avatar
      soc: ixp4xx: npe: Fix an IS_ERR() vs NULL check in probe · cd3967be
      Dan Carpenter authored
      The devm_ioremap_resource() function doesn't return NULL, it returns
      error pointers.
      
      Fixes: 0b458d7b ("soc: ixp4xx: npe: Pass addresses as resources")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
      cd3967be
    • Mike Rapoport's avatar
      arm64/mm: don't initialize pgd_cache twice · 615c48ad
      Mike Rapoport authored
      When PGD_SIZE != PAGE_SIZE, arm64 uses kmem_cache for allocation of PGD
      memory. That cache was initialized twice: first through
      pgtable_cache_init() alias and then as an override for weak
      pgd_cache_init().
      
      Remove the alias from pgtable_cache_init() and keep the only pgd_cache
      initialization in pgd_cache_init().
      
      Fixes: caa84136 ("x86/mm: Initialize PGD cache during mm initialization")
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      615c48ad
    • Hanjun Guo's avatar
      MAINTAINERS: Update my email address · 2a081968
      Hanjun Guo authored
      The @linaro.org address is not working and bonucing, so update the
      references.
      Signed-off-by: default avatarHanjun Guo <guohanjun@huawei.com>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      2a081968
    • Anisse Astier's avatar
      arm64/sve: <uapi/asm/ptrace.h> should not depend on <uapi/linux/prctl.h> · 35341ca0
      Anisse Astier authored
      Pulling linux/prctl.h into asm/ptrace.h in the arm64 UAPI headers causes
      userspace build issues for any program (e.g. strace and qemu) that
      includes both <sys/prctl.h> and <linux/ptrace.h> when using musl libc:
      
        | error: redefinition of 'struct prctl_mm_map'
        |  struct prctl_mm_map {
      
      See https://github.com/foundriesio/meta-lmp/commit/6d4a106e191b5d79c41b9ac78fd321316d3013c0
      for a public example of people working around this issue.
      
      Although it's a bit grotty, fix this breakage by duplicating the prctl
      constant definitions. Since these are part of the kernel ABI, they
      cannot be changed in future and so it's not the end of the world to have
      them open-coded.
      
      Fixes: 43d4da2c ("arm64/sve: ptrace and ELF coredump support")
      Cc: stable@vger.kernel.org
      Acked-by: default avatarDave Martin <Dave.Martin@arm.com>
      Signed-off-by: default avatarAnisse Astier <aastier@freebox.fr>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      35341ca0
    • Ulf Hansson's avatar
      mmc: core: Prevent processing SDIO IRQs when the card is suspended · 83293386
      Ulf Hansson authored
      Processing of SDIO IRQs must obviously be prevented while the card is
      system suspended, otherwise we may end up trying to communicate with an
      uninitialized SDIO card.
      
      Reports throughout the years shows that this is not only a theoretical
      problem, but a real issue. So, let's finally fix this problem, by keeping
      track of the state for the card and bail out before processing the SDIO
      IRQ, in case the card is suspended.
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatarDouglas Anderson <dianders@chromium.org>
      Tested-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      83293386
    • Raul E Rangel's avatar
      mmc: sdhci: sdhci-pci-o2micro: Correctly set bus width when tuning · 0f7b79a4
      Raul E Rangel authored
      The O2Micro controller only supports tuning at 4-bits. So the host driver
      needs to change the bus width while tuning and then set it back when done.
      
      There was a bug in the original implementation in that mmc->ios.bus_width
      also wasn't updated. Thus setting the incorrect blocksize in
      sdhci_send_tuning which results in a tuning failure.
      Signed-off-by: default avatarRaul E Rangel <rrangel@chromium.org>
      Fixes: 0086fc21 ("mmc: sdhci: Add support for O2 hardware tuning")
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      0f7b79a4
    • Douglas Anderson's avatar
      brcmfmac: sdio: Don't tune while the card is off · 65dade60
      Douglas Anderson authored
      When Broadcom SDIO cards are idled they go to sleep and a whole
      separate subsystem takes over their SDIO communication.  This is the
      Always-On-Subsystem (AOS) and it can't handle tuning requests.
      
      Specifically, as tested on rk3288-veyron-minnie (which reports having
      BCM4354/1 in dmesg), if I force a retune in brcmf_sdio_kso_control()
      when "on = 1" (aka we're transition from sleep to wake) by whacking:
        bus->sdiodev->func1->card->host->need_retune = 1
      ...then I can often see tuning fail.  In this case dw_mmc reports "All
      phases bad!").  Note that I don't get 100% failure, presumably because
      sometimes the card itself has already transitioned away from the AOS
      itself by the time we try to wake it up.  If I force retuning when "on
      = 0" (AKA force retuning right before sending the command to go to
      sleep) then retuning is always OK.
      
      NOTE: we need _both_ this patch and the patch to avoid triggering
      tuning due to CRC errors in the sleep/wake transition, AKA ("brcmfmac:
      sdio: Disable auto-tuning around commands expected to fail").  Though
      both patches handle issues with Broadcom's AOS, the problems are
      distinct:
      1. We want to defer (but not ignore) asynchronous (like
         timer-requested) tuning requests till the card is awake.  However,
         we want to ignore CRC errors during the transition, we don't want
         to queue deferred tuning request.
      2. You could imagine that the AOS could implement retuning but we
         could still get errors while transitioning in and out of the AOS.
         Similarly you could imagine a seamless transition into and out of
         the AOS (with no CRC errors) even if the AOS couldn't handle
         tuning.
      
      ALSO NOTE: presumably there is never a desperate need to retune in
      order to wake up the card, since doing so is impossible.  Luckily the
      only way the card can get into sleep state is if we had a good enough
      tuning to send it the command to put it into sleep, so presumably that
      "good enough" tuning is enough to wake us up, at least with a few
      retries.
      
      Cc: stable@vger.kernel.org #v4.18+
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Reviewed-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
      Acked-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      65dade60
    • Douglas Anderson's avatar
      mmc: core: Add sdio_retune_hold_now() and sdio_retune_release() · b4c9f938
      Douglas Anderson authored
      We want SDIO drivers to be able to temporarily stop retuning when the
      driver knows that the SDIO card is not in a state where retuning will
      work (maybe because the card is asleep).  We'll move the relevant
      functions to a place where drivers can call them.
      
      Cc: stable@vger.kernel.org #v4.18+
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      b4c9f938
    • Douglas Anderson's avatar
      brcmfmac: sdio: Disable auto-tuning around commands expected to fail · 2de0b42d
      Douglas Anderson authored
      There are certain cases, notably when transitioning between sleep and
      active state, when Broadcom SDIO WiFi cards will produce errors on the
      SDIO bus.  This is evident from the source code where you can see that
      we try commands in a loop until we either get success or we've tried
      too many times.  The comment in the code reinforces this by saying
      "just one write attempt may fail"
      
      Unfortunately these failures sometimes end up causing an "-EILSEQ"
      back to the core which triggers a retuning of the SDIO card and that
      blocks all traffic to the card until it's done.
      
      Let's disable retuning around the commands we expect might fail.
      
      Cc: stable@vger.kernel.org #v4.18+
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Reviewed-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
      Acked-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      2de0b42d
    • Douglas Anderson's avatar
      mmc: core: API to temporarily disable retuning for SDIO CRC errors · 0a55f4ab
      Douglas Anderson authored
      Normally when the MMC core sees an "-EILSEQ" error returned by a host
      controller then it will trigger a retuning of the card.  This is
      generally a good idea.
      
      However, if a command is expected to sometimes cause transfer errors
      then these transfer errors shouldn't cause a re-tuning.  This
      re-tuning will be a needless waste of time.  One example case where a
      transfer is expected to cause errors is when transitioning between
      idle (sometimes referred to as "sleep" in Broadcom code) and active
      state on certain Broadcom WiFi SDIO cards.  Specifically if the card
      was already transitioning between states when the command was sent it
      could cause an error on the SDIO bus.
      
      Let's add an API that the SDIO function drivers can call that will
      temporarily disable the auto-tuning functionality.  Then we can add a
      call to this in the Broadcom WiFi driver and any other driver that
      might have similar needs.
      
      NOTE: this makes the assumption that the card is already tuned well
      enough that it's OK to disable the auto-retuning during one of these
      error-prone situations.  Presumably the driver code performing the
      error-prone transfer knows how to recover / retry from errors.  ...and
      after we can get back to a state where transfers are no longer
      error-prone then we can enable the auto-retuning again.  If we truly
      find ourselves in a case where the card needs to be retuned sometimes
      to handle one of these error-prone transfers then we can always try a
      few transfers first without auto-retuning and then re-try with
      auto-retuning if the first few fail.
      
      Without this change on rk3288-veyron-minnie I periodically see this in
      the logs of a machine just sitting there idle:
        dwmmc_rockchip ff0d0000.dwmmc: Successfully tuned phase to XYZ
      
      Cc: stable@vger.kernel.org #v4.18+
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      0a55f4ab
    • Douglas Anderson's avatar
      Revert "brcmfmac: disable command decode in sdio_aos" · abdd5dcc
      Douglas Anderson authored
      This reverts commit 29f65891.
      
      After that patch landed I find that my kernel log on
      rk3288-veyron-minnie and rk3288-veyron-speedy is filled with:
      brcmfmac: brcmf_sdio_bus_sleep: error while changing bus sleep state -110
      
      This seems to happen every time the Broadcom WiFi transitions out of
      sleep mode.  Reverting the commit fixes the problem for me, so that's
      what this patch does.
      
      Note that, in general, the justification in the original commit seemed
      a little weak.  It looked like someone was testing on a SD card
      controller that would sometimes die if there were CRC errors on the
      bus.  This used to happen back in early days of dw_mmc (the controller
      on my boards), but we fixed it.  Disabling a feature on all boards
      just because one SD card controller is broken seems bad.
      
      Fixes: 29f65891 ("brcmfmac: disable command decode in sdio_aos")
      Cc: Wright Feng <wright.feng@cypress.com>
      Cc: Double Lo <double.lo@cypress.com>
      Cc: Madhan Mohan R <madhanmohan.r@cypress.com>
      Cc: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Cc: stable@vger.kernel.org
      Acked-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      abdd5dcc