Skip to content
  1. Feb 25, 2020
    • Rafał Miłecki's avatar
      brcmfmac: remove monitor interface when detaching · 7a09b0b4
      Rafał Miłecki authored
      commit 4f61563d
      
       upstream.
      
      This fixes a minor WARNING in the cfg80211:
      [  130.658034] ------------[ cut here ]------------
      [  130.662805] WARNING: CPU: 1 PID: 610 at net/wireless/core.c:954 wiphy_unregister+0xb4/0x198 [cfg80211]
      
      Signed-off-by: default avatarRafał Miłecki <rafal@milecki.pl>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      7a09b0b4
    • Luigi Rizzo's avatar
      net-af_xdp: Use correct number of channels from ethtool · 02a2b53e
      Luigi Rizzo authored
      commit 3de88c91
      
       upstream.
      
      Drivers use different fields to report the number of channels, so take
      the maximum of all data channels (rx, tx, combined) when determining the
      size of the xsk map. The current code used only 'combined' which was set
      to 0 in some drivers e.g. mlx4.
      
      Tested: compiled and run xdpsock -q 3 -r -S on mlx4
      
      Signed-off-by: default avatarLuigi Rizzo <lrizzo@google.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Acked-by: default avatarMagnus Karlsson <magnus.karlsson@intel.com>
      Link: https://lore.kernel.org/bpf/20191119001951.92930-1-lrizzo@google.com
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      02a2b53e
    • Adrian Hunter's avatar
      x86/insn: Add some Intel instructions to the opcode map · 35c02226
      Adrian Hunter authored
      commit b980be18
      
       upstream.
      
      Add to the opcode map the following instructions:
              cldemote
              tpause
              umonitor
              umwait
              movdiri
              movdir64b
              enqcmd
              enqcmds
              encls
              enclu
              enclv
              pconfig
              wbnoinvd
      
      For information about the instructions, refer Intel SDM May 2019
      (325462-070US) and Intel Architecture Instruction Set Extensions
      May 2019 (319433-037).
      
      The instruction decoding can be tested using the perf tools'
      "x86 instruction decoder - new instructions" test as folllows:
      
        $ perf test -v "new " 2>&1 | grep -i cldemote
        Decoded ok: 0f 1c 00                    cldemote (%eax)
        Decoded ok: 0f 1c 05 78 56 34 12        cldemote 0x12345678
        Decoded ok: 0f 1c 84 c8 78 56 34 12     cldemote 0x12345678(%eax,%ecx,8)
        Decoded ok: 0f 1c 00                    cldemote (%rax)
        Decoded ok: 41 0f 1c 00                 cldemote (%r8)
        Decoded ok: 0f 1c 04 25 78 56 34 12     cldemote 0x12345678
        Decoded ok: 0f 1c 84 c8 78 56 34 12     cldemote 0x12345678(%rax,%rcx,8)
        Decoded ok: 41 0f 1c 84 c8 78 56 34 12  cldemote 0x12345678(%r8,%rcx,8)
        $ perf test -v "new " 2>&1 | grep -i tpause
        Decoded ok: 66 0f ae f3                 tpause %ebx
        Decoded ok: 66 0f ae f3                 tpause %ebx
        Decoded ok: 66 41 0f ae f0              tpause %r8d
        $ perf test -v "new " 2>&1 | grep -i umonitor
        Decoded ok: 67 f3 0f ae f0              umonitor %ax
        Decoded ok: f3 0f ae f0                 umonitor %eax
        Decoded ok: 67 f3 0f ae f0              umonitor %eax
        Decoded ok: f3 0f ae f0                 umonitor %rax
        Decoded ok: 67 f3 41 0f ae f0           umonitor %r8d
        $ perf test -v "new " 2>&1 | grep -i umwait
        Decoded ok: f2 0f ae f0                 umwait %eax
        Decoded ok: f2 0f ae f0                 umwait %eax
        Decoded ok: f2 41 0f ae f0              umwait %r8d
        $ perf test -v "new " 2>&1 | grep -i movdiri
        Decoded ok: 0f 38 f9 03                 movdiri %eax,(%ebx)
        Decoded ok: 0f 38 f9 88 78 56 34 12     movdiri %ecx,0x12345678(%eax)
        Decoded ok: 48 0f 38 f9 03              movdiri %rax,(%rbx)
        Decoded ok: 48 0f 38 f9 88 78 56 34 12  movdiri %rcx,0x12345678(%rax)
        $ perf test -v "new " 2>&1 | grep -i movdir64b
        Decoded ok: 66 0f 38 f8 18              movdir64b (%eax),%ebx
        Decoded ok: 66 0f 38 f8 88 78 56 34 12  movdir64b 0x12345678(%eax),%ecx
        Decoded ok: 67 66 0f 38 f8 1c           movdir64b (%si),%bx
        Decoded ok: 67 66 0f 38 f8 8c 34 12     movdir64b 0x1234(%si),%cx
        Decoded ok: 66 0f 38 f8 18              movdir64b (%rax),%rbx
        Decoded ok: 66 0f 38 f8 88 78 56 34 12  movdir64b 0x12345678(%rax),%rcx
        Decoded ok: 67 66 0f 38 f8 18           movdir64b (%eax),%ebx
        Decoded ok: 67 66 0f 38 f8 88 78 56 34 12       movdir64b 0x12345678(%eax),%ecx
        $ perf test -v "new " 2>&1 | grep -i enqcmd
        Decoded ok: f2 0f 38 f8 18              enqcmd (%eax),%ebx
        Decoded ok: f2 0f 38 f8 88 78 56 34 12  enqcmd 0x12345678(%eax),%ecx
        Decoded ok: 67 f2 0f 38 f8 1c           enqcmd (%si),%bx
        Decoded ok: 67 f2 0f 38 f8 8c 34 12     enqcmd 0x1234(%si),%cx
        Decoded ok: f3 0f 38 f8 18              enqcmds (%eax),%ebx
        Decoded ok: f3 0f 38 f8 88 78 56 34 12  enqcmds 0x12345678(%eax),%ecx
        Decoded ok: 67 f3 0f 38 f8 1c           enqcmds (%si),%bx
        Decoded ok: 67 f3 0f 38 f8 8c 34 12     enqcmds 0x1234(%si),%cx
        Decoded ok: f2 0f 38 f8 18              enqcmd (%rax),%rbx
        Decoded ok: f2 0f 38 f8 88 78 56 34 12  enqcmd 0x12345678(%rax),%rcx
        Decoded ok: 67 f2 0f 38 f8 18           enqcmd (%eax),%ebx
        Decoded ok: 67 f2 0f 38 f8 88 78 56 34 12       enqcmd 0x12345678(%eax),%ecx
        Decoded ok: f3 0f 38 f8 18              enqcmds (%rax),%rbx
        Decoded ok: f3 0f 38 f8 88 78 56 34 12  enqcmds 0x12345678(%rax),%rcx
        Decoded ok: 67 f3 0f 38 f8 18           enqcmds (%eax),%ebx
        Decoded ok: 67 f3 0f 38 f8 88 78 56 34 12       enqcmds 0x12345678(%eax),%ecx
        $ perf test -v "new " 2>&1 | grep -i enqcmds
        Decoded ok: f3 0f 38 f8 18              enqcmds (%eax),%ebx
        Decoded ok: f3 0f 38 f8 88 78 56 34 12  enqcmds 0x12345678(%eax),%ecx
        Decoded ok: 67 f3 0f 38 f8 1c           enqcmds (%si),%bx
        Decoded ok: 67 f3 0f 38 f8 8c 34 12     enqcmds 0x1234(%si),%cx
        Decoded ok: f3 0f 38 f8 18              enqcmds (%rax),%rbx
        Decoded ok: f3 0f 38 f8 88 78 56 34 12  enqcmds 0x12345678(%rax),%rcx
        Decoded ok: 67 f3 0f 38 f8 18           enqcmds (%eax),%ebx
        Decoded ok: 67 f3 0f 38 f8 88 78 56 34 12       enqcmds 0x12345678(%eax),%ecx
        $ perf test -v "new " 2>&1 | grep -i encls
        Decoded ok: 0f 01 cf                    encls
        Decoded ok: 0f 01 cf                    encls
        $ perf test -v "new " 2>&1 | grep -i enclu
        Decoded ok: 0f 01 d7                    enclu
        Decoded ok: 0f 01 d7                    enclu
        $ perf test -v "new " 2>&1 | grep -i enclv
        Decoded ok: 0f 01 c0                    enclv
        Decoded ok: 0f 01 c0                    enclv
        $ perf test -v "new " 2>&1 | grep -i pconfig
        Decoded ok: 0f 01 c5                    pconfig
        Decoded ok: 0f 01 c5                    pconfig
        $ perf test -v "new " 2>&1 | grep -i wbnoinvd
        Decoded ok: f3 0f 09                    wbnoinvd
        Decoded ok: f3 0f 09                    wbnoinvd
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Reviewed-by: default avatarAndi Kleen <ak@linux.intel.com>
      Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86@kernel.org
      Link: http://lore.kernel.org/lkml/20191115135447.6519-3-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      35c02226
    • Hans de Goede's avatar
      ASoC: Intel: bytcr_rt5640: Update quirk for Acer Switch 10 SW5-012 2-in-1 · 2399750b
      Hans de Goede authored
      commit 0bb88770
      
       upstream.
      
      When the Acer Switch 10 SW5-012 quirk was added we did not have
      jack-detection support yet; and the builtin microphone selection of
      the original quirk is wrong too.
      
      Fix the microphone-input quirk and add jack-detection info so that the
      internal-microphone and headphone/set jack on the Switch 10 work properly.
      
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Link: https://lore.kernel.org/r/20191119145138.59162-1-hdegoede@redhat.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      2399750b
    • Linus Walleij's avatar
      firmware_loader: Fix labels with comma for builtin firmware · c8dff12c
      Linus Walleij authored
      commit 553671b7
      
       upstream.
      
      Some firmware images contain a comma, such as:
      EXTRA_FIRMWARE "brcm/brcmfmac4334-sdio.samsung,gt-s7710.txt"
      as Broadcom firmware simply tags the device tree compatible
      string at the end of the firmware parameter file. And the
      compatible string contains a comma.
      
      This doesn't play well with gas:
      
      drivers/base/firmware_loader/builtin/brcm/brcmfmac4334-sdio.samsung,gt-s7710.txt.gen.S: Assembler messages:
      drivers/base/firmware_loader/builtin/brcm/brcmfmac4334-sdio.samsung,gt-s7710.txt.gen.S:4: Error: bad instruction `_fw_brcm_brcmfmac4334_sdio_samsung,gt_s7710_txt_bin:'
      drivers/base/firmware_loader/builtin/brcm/brcmfmac4334-sdio.samsung,gt-s7710.txt.gen.S:9: Error: bad instruction `_fw_brcm_brcmfmac4334_sdio_samsung,gt_s7710_txt_name:'
      drivers/base/firmware_loader/builtin/brcm/brcmfmac4334-sdio.samsung,gt-s7710.txt.gen.S:15: Error: can't resolve `.rodata' {.rodata section} - `_fw_brcm_brcmfmac4334_sdio_samsung' {*UND* section}
      make[6]: *** [../scripts/Makefile.build:357: drivers/base/firmware_loader/builtin/brcm/brcmfmac4334-sdio.samsung,gt-s7710.txt.gen.o] Error 1
      
      We need to get rid of the comma from the labels used by the
      assembly stub generator.
      
      Replacing a comma using GNU Make subst requires a helper
      variable.
      
      Cc: Stephan Gerhold <stephan@gerhold.net>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Link: https://lore.kernel.org/r/20191115225911.3260-1-linus.walleij@linaro.org
      Acked-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      c8dff12c
    • Russell King's avatar
      net: phy: avoid matching all-ones clause 45 PHY IDs · 481b47b7
      Russell King authored
      commit b95e86d8
      
       upstream.
      
      We currently match clause 45 PHYs using any ID read from a MMD marked
      as present in the "Devices in package" registers 5 and 6.  However,
      this is incorrect.  45.2 says:
      
        "The definition of the term package is vendor specific and could be
         a chip, module, or other similar entity."
      
      so a package could be more or less than the whole PHY - a PHY could be
      made up of several modules instantiated onto a single chip such as the
      Marvell 88x3310, or some of the MMDs could be disabled according to
      chip configuration, such as the Broadcom 84881.
      
      In the case of Broadcom 84881, the "Devices in package" registers
      contain 0xc000009b, meaning that there is a PHYXS present in the
      package, but all registers in MMD 4 return 0xffff.  This leads to our
      matching code incorrectly binding this PHY to one of our generic PHY
      drivers.
      
      This patch changes the way we determine whether to attempt to match a
      MMD identifier, or use it to request a module - if the identifier is
      all-ones, then we skip over it. When reading the identifiers, we
      initialise phydev->c45_ids.device_ids to all-ones, only reading the
      device ID if the "Devices in package" registers indicates we should.
      
      This avoids the generic drivers incorrectly matching on a PHY ID of
      0xffffffff.
      
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      481b47b7
    • Jiri Benc's avatar
      selftests, bpf: Fix test_tc_tunnel hanging · 3424768c
      Jiri Benc authored
      commit 3b054b71 upstream.
      
      When run_kselftests.sh is run, it hangs after test_tc_tunnel.sh. The reason
      is test_tc_tunnel.sh ensures the server ('nc -l') is run all the time,
      starting it again every time it is expected to terminate. The exception is
      the final client_connect: the server is not started anymore, which ensures
      no process is kept running after the test is finished.
      
      For a sit test, though, the script is terminated prematurely without the
      final client_connect and the 'nc' process keeps running. This in turn causes
      the run_one function in kselftest/runner.sh to hang forever, waiting for the
      runaway process to finish.
      
      Ensure a remaining server is terminated on cleanup.
      
      Fixes: f6ad6acc
      
       ("selftests/bpf: expand test_tc_tunnel with SIT encap")
      Signed-off-by: default avatarJiri Benc <jbenc@redhat.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarWillem de Bruijn <willemb@google.com>
      Link: https://lore.kernel.org/bpf/60919291657a9ee89c708d8aababc28ebe1420be.1573821780.git.jbenc@redhat.com
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      3424768c
    • Alexander Shishkin's avatar
      perf/core: Fix the mlock accounting, again · 0fb20837
      Alexander Shishkin authored
      commit 36b3db03 upstream.
      
      Commit:
      
        5e6c3c7b
      
       ("perf/aux: Fix tracking of auxiliary trace buffer allocation")
      
      tried to guess the correct combination of arithmetic operations that would
      undo the AUX buffer's mlock accounting, and failed, leaking the bottom part
      when an allocation needs to be charged partially to both user->locked_vm
      and mm->pinned_vm, eventually leaving the user with no locked bonus:
      
        $ perf record -e intel_pt//u -m1,128 uname
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.061 MB perf.data ]
      
        $ perf record -e intel_pt//u -m1,128 uname
        Permission error mapping pages.
        Consider increasing /proc/sys/kernel/perf_event_mlock_kb,
        or try again with a smaller value of -m/--mmap_pages.
        (current value: 1,128)
      
      Fix this by subtracting both locked and pinned counts when AUX buffer is
      unmapped.
      
      Reported-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Tested-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
      Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      0fb20837
    • Chuhong Yuan's avatar
      ASoC: wm5100: add missed pm_runtime_disable · 44d6f4a5
      Chuhong Yuan authored
      commit b1176bbb
      
       upstream.
      
      The driver forgets to call pm_runtime_disable in remove and
      probe failure.
      Add the calls to fix it.
      
      Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
      Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
      Link: https://lore.kernel.org/r/20191118073707.28298-1-hslester96@gmail.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      44d6f4a5
    • Chuhong Yuan's avatar
      spi: st-ssc4: add missed pm_runtime_disable · a5540c06
      Chuhong Yuan authored
      commit cd050abe
      
       upstream.
      
      The driver forgets to call pm_runtime_disable in probe failure
      and remove.
      Add the missed calls to fix it.
      
      Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
      Link: https://lore.kernel.org/r/20191118024848.21645-1-hslester96@gmail.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      a5540c06
    • Chuhong Yuan's avatar
      ASoC: wm2200: add missed operations in remove and probe failure · 509182dd
      Chuhong Yuan authored
      commit 2dab09be
      
       upstream.
      
      This driver misses calls to pm_runtime_disable and regulator_bulk_disable
      in remove and a call to free_irq in probe failure.
      Add the calls to fix it.
      
      Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
      Link: https://lore.kernel.org/r/20191118073633.28237-1-hslester96@gmail.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      509182dd
    • Omar Sandoval's avatar
      btrfs: don't prematurely free work in run_ordered_work() · 21b8f5b4
      Omar Sandoval authored
      commit c495dcd6
      
       upstream.
      
      We hit the following very strange deadlock on a system with Btrfs on a
      loop device backed by another Btrfs filesystem:
      
      1. The top (loop device) filesystem queues an async_cow work item from
         cow_file_range_async(). We'll call this work X.
      2. Worker thread A starts work X (normal_work_helper()).
      3. Worker thread A executes the ordered work for the top filesystem
         (run_ordered_work()).
      4. Worker thread A finishes the ordered work for work X and frees X
         (work->ordered_free()).
      5. Worker thread A executes another ordered work and gets blocked on I/O
         to the bottom filesystem (still in run_ordered_work()).
      6. Meanwhile, the bottom filesystem allocates and queues an async_cow
         work item which happens to be the recently-freed X.
      7. The workqueue code sees that X is already being executed by worker
         thread A, so it schedules X to be executed _after_ worker thread A
         finishes (see the find_worker_executing_work() call in
         process_one_work()).
      
      Now, the top filesystem is waiting for I/O on the bottom filesystem, but
      the bottom filesystem is waiting for the top filesystem to finish, so we
      deadlock.
      
      This happens because we are breaking the workqueue assumption that a
      work item cannot be recycled while it still depends on other work. Fix
      it by waiting to free the work item until we are done with all of the
      related ordered work.
      
      P.S.:
      
      One might ask why the workqueue code doesn't try to detect a recycled
      work item. It actually does try by checking whether the work item has
      the same work function (find_worker_executing_work()), but in our case
      the function is the same. This is the only key that the workqueue code
      has available to compare, short of adding an additional, layer-violating
      "custom key". Considering that we're the only ones that have ever hit
      this, we should just play by the rules.
      
      Unfortunately, we haven't been able to create a minimal reproducer other
      than our full container setup using a compress-force=zstd filesystem on
      top of another compress-force=zstd filesystem.
      
      Suggested-by: default avatarTejun Heo <tj@kernel.org>
      Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      21b8f5b4
    • Omar Sandoval's avatar
      btrfs: don't prematurely free work in end_workqueue_fn() · 598bc872
      Omar Sandoval authored
      commit 9be490f1
      
       upstream.
      
      Currently, end_workqueue_fn() frees the end_io_wq entry (which embeds
      the work item) and then calls bio_endio(). This is another potential
      instance of the bug in "btrfs: don't prematurely free work in
      run_ordered_work()".
      
      In particular, the endio call may depend on other work items. For
      example, btrfs_end_dio_bio() can call btrfs_subio_endio_read() ->
      __btrfs_correct_data_nocsum() -> dio_read_error() ->
      submit_dio_repair_bio(), which submits a bio that is also completed
      through a end_workqueue_fn() work item. However,
      __btrfs_correct_data_nocsum() waits for the newly submitted bio to
      complete, thus it depends on another work item.
      
      This example currently usually works because we use different workqueue
      helper functions for BTRFS_WQ_ENDIO_DATA and BTRFS_WQ_ENDIO_DIO_REPAIR.
      However, it may deadlock with stacked filesystems and is fragile
      overall. The proper fix is to free the work item at the very end of the
      work function, so let's do that.
      
      Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      598bc872
    • Eugeniu Rosca's avatar
      mmc: tmio: Add MMC_CAP_ERASE to allow erase/discard/trim requests · f6ac775a
      Eugeniu Rosca authored
      commit c9184346
      
       upstream.
      
      Isolated initially to renesas_sdhi_internal_dmac [1], Ulf suggested
      adding MMC_CAP_ERASE to the TMIO mmc core:
      
      On Fri, Nov 15, 2019 at 10:27:25AM +0100, Ulf Hansson wrote:
       -- snip --
       This test and due to the discussions with Wolfram and you in this
       thread, I would actually suggest that you enable MMC_CAP_ERASE for all
       tmio variants, rather than just for this particular one.
      
       In other words, set the cap in tmio_mmc_host_probe() should be fine,
       as it seems none of the tmio variants supports HW busy detection at
       this point.
       -- snip --
      
      Testing on R-Car H3ULCB-KF doesn't reveal any issues (v5.4-rc7):
      
      root@rcar-gen3:~# lsblk
      NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
      mmcblk0      179:0    0 59.2G  0 disk  <--- eMMC
      mmcblk0boot0 179:8    0    4M  1 disk
      mmcblk0boot1 179:16   0    4M  1 disk
      mmcblk1      179:24   0   30G  0 disk  <--- SD card
      
      root@rcar-gen3:~# time blkdiscard /dev/mmcblk0
      real    0m8.659s
      user    0m0.001s
      sys     0m1.920s
      
      root@rcar-gen3:~# time blkdiscard /dev/mmcblk1
      real    0m1.176s
      user    0m0.001s
      sys     0m0.124s
      
      [1] https://lore.kernel.org/linux-renesas-soc/20191112134808.23546-1-erosca@de.adit-jv.com/
      
      Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Andrew Gabbasov <andrew_gabbasov@mentor.com>
      Originally-by: default avatarHarish Jenny K N <harish_kandiga@mentor.com>
      Suggested-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarEugeniu Rosca <erosca@de.adit-jv.com>
      Reviewed-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      f6ac775a
    • Ard Biesheuvel's avatar
      crypto: virtio - deal with unsupported input sizes · 6be736e1
      Ard Biesheuvel authored
      commit 19c5da7d upstream.
      
      Return -EINVAL for input sizes that are not a multiple of the AES
      block size, since they are not supported by our CBC chaining mode.
      
      While at it, remove the pr_err() that reports unsupported key sizes
      being used: we shouldn't spam the kernel log with that.
      
      Fixes: dbaf0624
      
       ("crypto: add virtio-crypto driver")
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: Gonglei <arei.gonglei@huawei.com>
      Cc: virtualization@lists.linux-foundation.org
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      6be736e1
    • Mika Westerberg's avatar
      xhci-pci: Allow host runtime PM as default also for Intel Ice Lake xHCI · f93c732f
      Mika Westerberg authored
      commit 07a594f3
      
       upstream.
      
      Intel Ice Lake has two xHCI controllers one on PCH and the other as part
      of the CPU itself. The latter is also part of the so called Type C
      Subsystem (TCSS) sharing ACPI power resources with the PCIe root ports
      and the Thunderbolt controllers. In order to put the whole TCSS block
      into D3cold the xHCI needs to be runtime suspended as well when idle.
      
      For this reason allow runtime PM as default for Ice Lake TCSS xHCI
      controller.
      
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/1573836603-10871-5-git-send-email-mathias.nyman@linux.intel.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      f93c732f
    • Petar Penkov's avatar
      tun: fix data-race in gro_normal_list() · c44827a0
      Petar Penkov authored
      commit c39e342a upstream.
      
      There is a race in the TUN driver between napi_busy_loop and
      napi_gro_frags. This commit resolves the race by adding the NAPI struct
      via netif_tx_napi_add, instead of netif_napi_add, which disables polling
      for the NAPI struct.
      
      KCSAN reported:
      BUG: KCSAN: data-race in gro_normal_list.part.0 / napi_busy_loop
      
      write to 0xffff8880b5d474b0 of 4 bytes by task 11205 on cpu 0:
       gro_normal_list.part.0+0x77/0xb0 net/core/dev.c:5682
       gro_normal_list net/core/dev.c:5678 [inline]
       gro_normal_one net/core/dev.c:5692 [inline]
       napi_frags_finish net/core/dev.c:5705 [inline]
       napi_gro_frags+0x625/0x770 net/core/dev.c:5778
       tun_get_user+0x2150/0x26a0 drivers/net/tun.c:1976
       tun_chr_write_iter+0x79/0xd0 drivers/net/tun.c:2022
       call_write_iter include/linux/fs.h:1895 [inline]
       do_iter_readv_writev+0x487/0x5b0 fs/read_write.c:693
       do_iter_write fs/read_write.c:970 [inline]
       do_iter_write+0x13b/0x3c0 fs/read_write.c:951
       vfs_writev+0x118/0x1c0 fs/read_write.c:1015
       do_writev+0xe3/0x250 fs/read_write.c:1058
       __do_sys_writev fs/read_write.c:1131 [inline]
       __se_sys_writev fs/read_write.c:1128 [inline]
       __x64_sys_writev+0x4e/0x60 fs/read_write.c:1128
       do_syscall_64+0xcc/0x370 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      read to 0xffff8880b5d474b0 of 4 bytes by task 11168 on cpu 1:
       gro_normal_list net/core/dev.c:5678 [inline]
       napi_busy_loop+0xda/0x4f0 net/core/dev.c:6126
       sk_busy_loop include/net/busy_poll.h:108 [inline]
       __skb_recv_udp+0x4ad/0x560 net/ipv4/udp.c:1689
       udpv6_recvmsg+0x29e/0xe90 net/ipv6/udp.c:288
       inet6_recvmsg+0xbb/0x240 net/ipv6/af_inet6.c:592
       sock_recvmsg_nosec net/socket.c:871 [inline]
       sock_recvmsg net/socket.c:889 [inline]
       sock_recvmsg+0x92/0xb0 net/socket.c:885
       sock_read_iter+0x15f/0x1e0 net/socket.c:967
       call_read_iter include/linux/fs.h:1889 [inline]
       new_sync_read+0x389/0x4f0 fs/read_write.c:414
       __vfs_read+0xb1/0xc0 fs/read_write.c:427
       vfs_read fs/read_write.c:461 [inline]
       vfs_read+0x143/0x2c0 fs/read_write.c:446
       ksys_read+0xd5/0x1b0 fs/read_write.c:587
       __do_sys_read fs/read_write.c:597 [inline]
       __se_sys_read fs/read_write.c:595 [inline]
       __x64_sys_read+0x4c/0x60 fs/read_write.c:595
       do_syscall_64+0xcc/0x370 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      Reported by Kernel Concurrency Sanitizer on:
      CPU: 1 PID: 11168 Comm: syz-executor.0 Not tainted 5.4.0-rc6+ #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      
      Fixes: 94317099
      
       ("tun: enable NAPI for TUN/TAP driver")
      Signed-off-by: default avatarPetar Penkov <ppenkov@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      c44827a0
    • Chuhong Yuan's avatar
      spi: tegra20-slink: add missed clk_unprepare · 12fdf234
      Chuhong Yuan authored
      commit 04358e40
      
       upstream.
      
      The driver misses calling clk_unprepare in probe failure and remove.
      Add the calls to fix it.
      
      Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
      Link: https://lore.kernel.org/r/20191115083122.12278-1-hslester96@gmail.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      12fdf234
    • Pascal Paillet's avatar
      regulator: core: Let boot-on regulators be powered off · 34bc5aaa
      Pascal Paillet authored
      commit 089b3f61 upstream.
      
      Boot-on regulators are always kept on because their use_count value
      is now incremented at boot time and never cleaned.
      
      Only increment count value for alway-on regulators.
      regulator_late_cleanup() is now able to power off boot-on regulators
      when unused.
      
      Fixes: 05f224ca
      
       ("regulator: core: Clean enabling always-on regulators + their supplies")
      Signed-off-by: default avatarPascal Paillet <p.paillet@st.com>
      Link: https://lore.kernel.org/r/20191113102737.27831-1-p.paillet@st.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      34bc5aaa
    • Michael Walle's avatar
      ASoC: wm8904: fix regcache handling · 4304566a
      Michael Walle authored
      commit e9149b8c
      
       upstream.
      
      The current code assumes that the power is turned off in
      SND_SOC_BIAS_OFF. If there are no actual regulator the codec isn't
      turned off and the registers are not reset to their default values but
      the regcache is still marked as dirty. Thus a value might not be written
      to the hardware if it is set to the default value. Do a software reset
      before turning off the power to make sure the registers are always reset
      to their default states.
      
      Signed-off-by: default avatarMichael Walle <michael@walle.cc>
      Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
      Link: https://lore.kernel.org/r/20191112223629.21867-1-michael@walle.cc
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      4304566a
    • Wang Xuerui's avatar
      iwlwifi: mvm: fix unaligned read of rx_pkt_status · 29c3fa0c
      Wang Xuerui authored
      commit c5aaa8be
      
       upstream.
      
      This is present since the introduction of iwlmvm.
      Example stack trace on MIPS:
      
      [<ffffffffc0789328>] iwl_mvm_rx_rx_mpdu+0xa8/0xb88 [iwlmvm]
      [<ffffffffc0632b40>] iwl_pcie_rx_handle+0x420/0xc48 [iwlwifi]
      
      Tested with a Wireless AC 7265 for ~6 months, confirmed to fix the
      problem. No other unaligned accesses are spotted yet.
      
      Signed-off-by: default avatarWang Xuerui <wangxuerui@qiniu.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      29c3fa0c
    • Andrea Righi's avatar
      bcache: fix deadlock in bcache_allocator · db3aea71
      Andrea Righi authored
      commit 84c529ae
      
       upstream.
      
      bcache_allocator can call the following:
      
       bch_allocator_thread()
        -> bch_prio_write()
           -> bch_bucket_alloc()
              -> wait on &ca->set->bucket_wait
      
      But the wake up event on bucket_wait is supposed to come from
      bch_allocator_thread() itself => deadlock:
      
      [ 1158.490744] INFO: task bcache_allocato:15861 blocked for more than 10 seconds.
      [ 1158.495929]       Not tainted 5.3.0-050300rc3-generic #201908042232
      [ 1158.500653] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      [ 1158.504413] bcache_allocato D    0 15861      2 0x80004000
      [ 1158.504419] Call Trace:
      [ 1158.504429]  __schedule+0x2a8/0x670
      [ 1158.504432]  schedule+0x2d/0x90
      [ 1158.504448]  bch_bucket_alloc+0xe5/0x370 [bcache]
      [ 1158.504453]  ? wait_woken+0x80/0x80
      [ 1158.504466]  bch_prio_write+0x1dc/0x390 [bcache]
      [ 1158.504476]  bch_allocator_thread+0x233/0x490 [bcache]
      [ 1158.504491]  kthread+0x121/0x140
      [ 1158.504503]  ? invalidate_buckets+0x890/0x890 [bcache]
      [ 1158.504506]  ? kthread_park+0xb0/0xb0
      [ 1158.504510]  ret_from_fork+0x35/0x40
      
      Fix by making the call to bch_prio_write() non-blocking, so that
      bch_allocator_thread() never waits on itself.
      
      Moreover, make sure to wake up the garbage collector thread when
      bch_prio_write() is failing to allocate buckets.
      
      BugLink: https://bugs.launchpad.net/bugs/1784665
      BugLink: https://bugs.launchpad.net/bugs/1796292
      Signed-off-by: default avatarAndrea Righi <andrea.righi@canonical.com>
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      db3aea71
    • Masami Hiramatsu's avatar
      tracing/kprobe: Check whether the non-suffixed symbol is notrace · 1ddb4983
      Masami Hiramatsu authored
      commit c7411a1a upstream.
      
      Check whether the non-suffixed symbol is notrace, since suffixed
      symbols are generated by the compilers for optimization. Based on
      these suffixed symbols, notrace check might not work because
      some of them are just a partial code of the original function.
      (e.g. cold-cache (unlikely) code is separated from original
       function as FUNCTION.cold.XX)
      
      For example, without this fix,
        # echo p device_add.cold.67 > /sys/kernel/debug/tracing/kprobe_events
        sh: write error: Invalid argument
      
        # cat /sys/kernel/debug/tracing/error_log
        [  135.491035] trace_kprobe: error: Failed to register probe event
          Command: p device_add.cold.67
                     ^
        # dmesg | tail -n 1
        [  135.488599] trace_kprobe: Could not probe notrace function device_add.cold.67
      
      With this,
        # echo p device_add.cold.66 > /sys/kernel/debug/tracing/kprobe_events
        # cat /sys/kernel/debug/kprobes/list
        ffffffff81599de9  k  device_add.cold.66+0x0    [DISABLED]
      
      Actually, kprobe blacklist already did similar thing,
      see within_kprobe_blacklist().
      
      Link: http://lkml.kernel.org/r/157233790394.6706.18243942030937189679.stgit@devnote2
      
      Fixes: 45408c4f
      
       ("tracing: kprobes: Prohibit probing on notrace function")
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      1ddb4983
    • Yuming Han's avatar
      tracing: use kvcalloc for tgid_map array allocation · 35c27459
      Yuming Han authored
      commit 6ee40511
      
       upstream.
      
      Fail to allocate memory for tgid_map, because it requires order-6 page.
      detail as:
      
      c3 sh: page allocation failure: order:6,
         mode:0x140c0c0(GFP_KERNEL), nodemask=(null)
      c3 sh cpuset=/ mems_allowed=0
      c3 CPU: 3 PID: 5632 Comm: sh Tainted: G        W  O    4.14.133+ #10
      c3 Hardware name: Generic DT based system
      c3 Backtrace:
      c3 [<c010bdbc>] (dump_backtrace) from [<c010c08c>](show_stack+0x18/0x1c)
      c3 [<c010c074>] (show_stack) from [<c0993c54>](dump_stack+0x84/0xa4)
      c3 [<c0993bd0>] (dump_stack) from [<c0229858>](warn_alloc+0xc4/0x19c)
      c3 [<c0229798>] (warn_alloc) from [<c022a6e4>](__alloc_pages_nodemask+0xd18/0xf28)
      c3 [<c02299cc>] (__alloc_pages_nodemask) from [<c0248344>](kmalloc_order+0x20/0x38)
      c3 [<c0248324>] (kmalloc_order) from [<c0248380>](kmalloc_order_trace+0x24/0x108)
      c3 [<c024835c>] (kmalloc_order_trace) from [<c01e6078>](set_tracer_flag+0xb0/0x158)
      c3 [<c01e5fc8>] (set_tracer_flag) from [<c01e6404>](trace_options_core_write+0x7c/0xcc)
      c3 [<c01e6388>] (trace_options_core_write) from [<c0278b1c>](__vfs_write+0x40/0x14c)
      c3 [<c0278adc>] (__vfs_write) from [<c0278e10>](vfs_write+0xc4/0x198)
      c3 [<c0278d4c>] (vfs_write) from [<c027906c>](SyS_write+0x6c/0xd0)
      c3 [<c0279000>] (SyS_write) from [<c01079a0>](ret_fast_syscall+0x0/0x54)
      
      Switch to use kvcalloc to avoid unexpected allocation failures.
      
      Link: http://lkml.kernel.org/r/1571888070-24425-1-git-send-email-chunyan.zhang@unisoc.com
      
      Signed-off-by: default avatarYuming Han <yuming.han@unisoc.com>
      Signed-off-by: default avatarChunyan Zhang <chunyan.zhang@unisoc.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      35c27459
    • Gal Pressman's avatar
      RDMA/efa: Clear the admin command buffer prior to its submission · 0583ffd2
      Gal Pressman authored
      commit 64c26487 upstream.
      
      We cannot rely on the entry memcpy as we only copy the actual size of the
      command, the rest of the bytes must be memset to zero.
      
      Currently providing non-zero memory will not have any user visible impact.
      However, since admin commands are extendable (in a backwards compatible
      way) everything beyond the size of the command must be cleared to prevent
      issues in the future.
      
      Fixes: 0420e542
      
       ("RDMA/efa: Implement functions that submit and complete admin commands")
      Link: https://lore.kernel.org/r/20191112092608.46964-1-galpress@amazon.com
      Reviewed-by: default avatarDaniel Kranzdorf <dkkranzd@amazon.com>
      Reviewed-by: default avatarFiras JahJah <firasj@amazon.com>
      Signed-off-by: default avatarGal Pressman <galpress@amazon.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      0583ffd2
    • Sergey Matyukevich's avatar
      qtnfmac: fix using skb after free · f1c6076a
      Sergey Matyukevich authored
      commit 4a33f21c
      
       upstream.
      
      KASAN reported use-after-free error:
      
      [  995.220767] BUG: KASAN: use-after-free in qtnf_cmd_send_with_reply+0x169/0x3e0 [qtnfmac]
      [  995.221098] Read of size 2 at addr ffff888213d1ded0 by task kworker/1:1/71
      
      The issue in qtnf_cmd_send_with_reply impacts all the commands that do
      not need response other then return code. For such commands, consume_skb
      is used for response skb and right after that return code in response
      skb is accessed.
      
      Signed-off-by: default avatarSergey Matyukevich <sergey.matyukevich.os@quantenna.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      f1c6076a
    • Lianbo Jiang's avatar
      x86/crash: Add a forward declaration of struct kimage · 91a1fb1a
      Lianbo Jiang authored
      commit 112eee5d
      
       upstream.
      
      Add a forward declaration of struct kimage to the crash.h header because
      future changes will invoke a crash-specific function from the realmode
      init path and the compiler will complain otherwise like this:
      
        In file included from arch/x86/realmode/init.c:11:
        ./arch/x86/include/asm/crash.h:5:32: warning: ‘struct kimage’ declared inside\
         parameter list will not be visible outside of this definition or declaration
            5 | int crash_load_segments(struct kimage *image);
              |                                ^~~~~~
        ./arch/x86/include/asm/crash.h:6:37: warning: ‘struct kimage’ declared inside\
         parameter list will not be visible outside of this definition or declaration
            6 | int crash_copy_backup_region(struct kimage *image);
              |                                     ^~~~~~
        ./arch/x86/include/asm/crash.h:7:39: warning: ‘struct kimage’ declared inside\
         parameter list will not be visible outside of this definition or declaration
            7 | int crash_setup_memmap_entries(struct kimage *image,
              |
      
       [ bp: Rewrite the commit message. ]
      
      Reported-by: default avatarkbuild test robot <lkp@intel.com>
      Signed-off-by: default avatarLianbo Jiang <lijiang@redhat.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: bhe@redhat.com
      Cc: d.hatayama@fujitsu.com
      Cc: dhowells@redhat.com
      Cc: dyoung@redhat.com
      Cc: ebiederm@xmission.com
      Cc: horms@verge.net.au
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jürgen Gross <jgross@suse.com>
      Cc: kexec@lists.infradead.org
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Cc: vgoyal@redhat.com
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191108090027.11082-4-lijiang@redhat.com
      Link: https://lkml.kernel.org/r/201910310233.EJRtTMWP%25lkp@intel.com
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      91a1fb1a
    • Sergey Matyukevich's avatar
      qtnfmac: fix invalid channel information output · 2a1c6434
      Sergey Matyukevich authored
      commit 24227a9e
      
       upstream.
      
      Do not attempt to print frequency for an invalid channel
      provided by firmware. That channel may simply not exist.
      
      Signed-off-by: default avatarSergey Matyukevich <sergey.matyukevich.os@quantenna.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      2a1c6434
    • Sergey Matyukevich's avatar
      qtnfmac: fix debugfs support for multiple cards · 954135cc
      Sergey Matyukevich authored
      commit dd4c2260 upstream.
      
      Fix merge artifact for commit 0b68fe10
      
       ("qtnfmac: modify debugfs
      to support multiple cards") and finally add debugfs support
      for multiple qtnfmac wireless cards.
      
      Signed-off-by: default avatarSergey Matyukevich <sergey.matyukevich.os@quantenna.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      954135cc
    • Viresh Kumar's avatar
      cpufreq: Register drivers only after CPU devices have been registered · e2b16dd3
      Viresh Kumar authored
      commit 46770be0
      
       upstream.
      
      The cpufreq core heavily depends on the availability of the struct
      device for CPUs and if they aren't available at the time cpufreq driver
      is registered, we will never succeed in making cpufreq work.
      
      This happens due to following sequence of events:
      
      - cpufreq_register_driver()
        - subsys_interface_register()
        - return 0; //successful registration of driver
      
      ... at a later point of time
      
      - register_cpu();
        - device_register();
          - bus_probe_device();
            - sif->add_dev();
      	- cpufreq_add_dev();
      	  - get_cpu_device(); //FAILS
        - per_cpu(cpu_sys_devices, num) = &cpu->dev; //used by get_cpu_device()
        - return 0; //CPU registered successfully
      
      Because the per-cpu variable cpu_sys_devices is set only after the CPU
      device is regsitered, cpufreq will never be able to get it when
      cpufreq_add_dev() is called.
      
      This patch avoids this failure by making sure device structure of at
      least CPU0 is available when the cpufreq driver is registered, else
      return -EPROBE_DEFER.
      
      Reported-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
      Co-developed-by: default avatarAmit Kucheria <amit.kucheria@linaro.org>
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Tested-by: default avatarAmit Kucheria <amit.kucheria@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      e2b16dd3
    • Coly Li's avatar
      bcache: fix static checker warning in bcache_device_free() · 118454bf
      Coly Li authored
      commit 2d886951 upstream.
      
      Commit cafe5635
      
       ("bcache: A block layer cache") leads to the
      following static checker warning:
      
          ./drivers/md/bcache/super.c:770 bcache_device_free()
          warn: variable dereferenced before check 'd->disk' (see line 766)
      
      drivers/md/bcache/super.c
         762  static void bcache_device_free(struct bcache_device *d)
         763  {
         764          lockdep_assert_held(&bch_register_lock);
         765
         766          pr_info("%s stopped", d->disk->disk_name);
                                            ^^^^^^^^^
      Unchecked dereference.
      
         767
         768          if (d->c)
         769                  bcache_device_detach(d);
         770          if (d->disk && d->disk->flags & GENHD_FL_UP)
                          ^^^^^^^
      Check too late.
      
         771                  del_gendisk(d->disk);
         772          if (d->disk && d->disk->queue)
         773                  blk_cleanup_queue(d->disk->queue);
         774          if (d->disk) {
         775                  ida_simple_remove(&bcache_device_idx,
         776                                    first_minor_to_idx(d->disk->first_minor));
         777                  put_disk(d->disk);
         778          }
         779
      
      It is not 100% sure that the gendisk struct of bcache device will always
      be there, the warning makes sense when there is problem in block core.
      
      This patch tries to remove the static checking warning by checking
      d->disk to avoid NULL pointer deferences.
      
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      118454bf
    • Sudip Mukherjee's avatar
      parport: load lowlevel driver if ports not found · ddaaa284
      Sudip Mukherjee authored
      commit 231ec2f2
      
       upstream.
      
      Usually all the distro will load the parport low level driver as part
      of their initialization. But we can get into a situation where all the
      parallel port drivers are built as module and we unload all the modules
      at a later time. Then if we just do "modprobe parport" it will only
      load the parport module and will not load the low level driver which
      will actually register the ports. So, check the bus if there is any
      parport registered, if not, load the low level driver.
      
      We can get into the above situation with all distro but only Suse has
      setup the alias for "parport_lowlevel" and so it only works in Suse.
      Users of Debian based distro will need to load the lowlevel module
      manually.
      
      Signed-off-by: default avatarSudip Mukherjee <sudipm.mukherjee@gmail.com>
      Link: https://lore.kernel.org/r/20191016144540.18810-3-sudipm.mukherjee@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      ddaaa284
    • Eduard Hasenleithner's avatar
      nvme: Discard workaround for non-conformant devices · 3de2c29e
      Eduard Hasenleithner authored
      commit 530436c4
      
       upstream.
      
      Users observe IOMMU related errors when performing discard on nvme from
      non-compliant nvme devices reading beyond the end of the DMA mapped
      ranges to discard.
      
      Two different variants of this behavior have been observed: SM22XX
      controllers round up the read size to a multiple of 512 bytes, and Phison
      E12 unconditionally reads the maximum discard size allowed by the spec
      (256 segments or 4kB).
      
      Make nvme_setup_discard unconditionally allocate the maximum DSM buffer
      so the driver DMA maps a memory range that will always succeed.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=202665 many
      Signed-off-by: default avatarEduard Hasenleithner <eduard@hasenleithner.at>
      [changelog, use existing define, kernel coding style]
      Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      3de2c29e
    • Mao Wenan's avatar
      net: ethernet: ti: Add dependency for TI_DAVINCI_EMAC · 3cb8fa1e
      Mao Wenan authored
      commit b2ef81dc upstream.
      
      If TI_DAVINCI_EMAC=y and GENERIC_ALLOCATOR is not set,
      below erros can be seen:
      drivers/net/ethernet/ti/davinci_cpdma.o: In function `cpdma_desc_pool_destroy.isra.14':
      davinci_cpdma.c:(.text+0x359): undefined reference to `gen_pool_size'
      davinci_cpdma.c:(.text+0x365): undefined reference to `gen_pool_avail'
      davinci_cpdma.c:(.text+0x373): undefined reference to `gen_pool_avail'
      davinci_cpdma.c:(.text+0x37f): undefined reference to `gen_pool_size'
      drivers/net/ethernet/ti/davinci_cpdma.o: In function `__cpdma_chan_free':
      davinci_cpdma.c:(.text+0x4a2): undefined reference to `gen_pool_free_owner'
      drivers/net/ethernet/ti/davinci_cpdma.o: In function `cpdma_chan_submit_si':
      davinci_cpdma.c:(.text+0x66c): undefined reference to `gen_pool_alloc_algo_owner'
      davinci_cpdma.c:(.text+0x805): undefined reference to `gen_pool_free_owner'
      drivers/net/ethernet/ti/davinci_cpdma.o: In function `cpdma_ctlr_create':
      davinci_cpdma.c:(.text+0xabd): undefined reference to `devm_gen_pool_create'
      davinci_cpdma.c:(.text+0xb79): undefined reference to `gen_pool_add_owner'
      drivers/net/ethernet/ti/davinci_cpdma.o: In function `cpdma_check_free_tx_desc':
      davinci_cpdma.c:(.text+0x16c6): undefined reference to `gen_pool_avail'
      
      This patch mades TI_DAVINCI_EMAC select GENERIC_ALLOCATOR.
      
      Fixes: 99f62971
      
       ("net: ethernet: ti: cpsw: drop TI_DAVINCI_CPDMA config option")
      Signed-off-by: default avatarMao Wenan <maowenan@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      3cb8fa1e
    • Ilya Leoshkevich's avatar
      s390/disassembler: don't hide instruction addresses · 4235d006
      Ilya Leoshkevich authored
      commit 544f1d62
      
       upstream.
      
      Due to kptr_restrict, JITted BPF code is now displayed like this:
      
      000000000b6ed1b2: ebdff0800024  stmg    %r13,%r15,128(%r15)
      000000004cde2ba0: 41d0f040      la      %r13,64(%r15)
      00000000fbad41b0: a7fbffa0      aghi    %r15,-96
      
      Leaking kernel addresses to dmesg is not a concern in this case, because
      this happens only when JIT debugging is explicitly activated, which only
      root can do.
      
      Use %px in this particular instance, and also to print an instruction
      address in show_code and PCREL (e.g. brasl) arguments in print_insn.
      While at present functionally equivalent to %016lx, %px is recommended
      by Documentation/core-api/printk-formats.rst for such cases.
      
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Reviewed-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      4235d006
    • Vladimir Oltean's avatar
      net: dsa: sja1105: Disallow management xmit during switch reset · 28e39843
      Vladimir Oltean authored
      commit af580ae2
      
       upstream.
      
      The purpose here is to avoid ptp4l fail due to this condition:
      
        timed out while polling for tx timestamp
        increasing tx_timestamp_timeout may correct this issue, but it is likely caused by a driver bug
        port 1: send peer delay request failed
      
      So either reset the switch before the management frame was sent, or
      after it was timestamped as well, but not in the middle.
      
      The condition may arise either due to a true timeout (i.e. because
      re-uploading the static config takes time), or due to the TX timestamp
      actually getting lost due to reset. For the former we can increase
      tx_timestamp_timeout in userspace, for the latter we need this patch.
      
      Locking all traffic during switch reset does not make sense at all,
      though. Forcing all CPU-originated traffic to potentially block waiting
      for a sleepable context to send > 800 bytes over SPI is not a good idea.
      Flows that are autonomously forwarded by the switch will get dropped
      anyway during switch reset no matter what. So just let all other
      CPU-originated traffic be dropped as well.
      
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      28e39843
    • Yu-Hsuan Hsu's avatar
      ASoC: Intel: kbl_rt5663_rt5514_max98927: Add dmic format constraint · 90c73750
      Yu-Hsuan Hsu authored
      commit e2db787b
      
       upstream.
      
      On KBL platform, the microphone is attached to external codec(rt5514)
      instead of PCH. However, TDM slot between PCH and codec is 16 bits only.
      In order to avoid setting wrong format, we should add a constraint to
      force to use 16 bits format forever.
      
      Signed-off-by: default avatarYu-Hsuan Hsu <yuhsuan@chromium.org>
      Acked-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Link: https://lore.kernel.org/r/20190923162940.199580-1-yuhsuan@chromium.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      90c73750
    • Stefan Popa's avatar
      iio: dac: ad5446: Add support for new AD5600 DAC · 85c69924
      Stefan Popa authored
      commit 6376cbe5
      
       upstream.
      
      The AD5600 is a single channel, 16-bit resolution, voltage output digital
      to analog converter (DAC). The AD5600 uses a 3-wire SPI interface. It is
      part of the AD5541 family of DACs.
      
      The ad5446 IIO driver implements support for some of these DACs (in the
      AD5441 family), so the change is a simple entry in this driver.
      
      Link: https://www.analog.com/media/en/technical-documentation/data-sheets/AD5600.pdf
      
      Signed-off-by: default avatarStefan Popa <stefan.popa@analog.com>
      Signed-off-by: default avatarAlexandru Ardelean <alexandru.ardelean@analog.com>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      85c69924
    • Ben Zhang's avatar
      ASoC: rt5677: Mark reg RT5677_PWR_ANLG2 as volatile · 98bd5453
      Ben Zhang authored
      commit eabf424f
      
       upstream.
      
      The codec dies when RT5677_PWR_ANLG2(MX-64h) is set to 0xACE1
      while it's streaming audio over SPI. The DSP firmware turns
      on PLL2 (MX-64 bit 8) when SPI streaming starts.  However regmap
      does not believe that register can change by itself. When
      BST1 (bit 15) is turned on with regmap_update_bits(), it doesn't
      read the register first before write, so PLL2 power bit is
      cleared by accident.
      
      Marking MX-64h as volatile in regmap solved the issue.
      
      Signed-off-by: default avatarBen Zhang <benzh@chromium.org>
      Signed-off-by: default avatarCurtis Malainey <cujomalainey@chromium.org>
      Link: https://lore.kernel.org/r/20191106011335.223061-6-cujomalainey@chromium.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      98bd5453
    • Chuhong Yuan's avatar
      spi: pxa2xx: Add missed security checks · b17699b9
      Chuhong Yuan authored
      commit 5eb263ef
      
       upstream.
      
      pxa2xx_spi_init_pdata misses checks for devm_clk_get and
      platform_get_irq.
      Add checks for them to fix the bugs.
      
      Since ssp->clk and ssp->irq are used in probe, they are mandatory here.
      So we cannot use _optional() for devm_clk_get and platform_get_irq.
      
      Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
      Link: https://lore.kernel.org/r/20191109080943.30428-1-hslester96@gmail.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      b17699b9