1. 16 Jul, 2020 2 commits
  2. 15 Jul, 2020 9 commits
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v5.8-2' of... · 994e99a9
      Linus Torvalds authored
      Merge tag 'platform-drivers-x86-v5.8-2' of git://git.infradead.org/linux-platform-drivers-x86 into master
      
      Pull x86 platform driver fixes from Andriy Shevchenko:
       "Small fixes for this cycle:
      
         - Fix procfs handling in Thinkpad ACPI driver
      
         - Fix battery management on new ASUS laptops
      
         - New IDs (Sapphire Rapids) in ISST tool"
      
      * tag 'platform-drivers-x86-v5.8-2' of git://git.infradead.org/linux-platform-drivers-x86:
        platform/x86: asus-wmi: allow BAT1 battery name
        platform/x86: ISST: Add new PCI device ids
        platform/x86: thinkpad_acpi: Revert "Use strndup_user() in dispatch_proc_write()"
      994e99a9
    • Linus Torvalds's avatar
      Merge tag 'dmaengine-fix-5.8-rc6' of... · 0665a4e9
      Linus Torvalds authored
      Merge tag 'dmaengine-fix-5.8-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine into master
      
      Pull dmaengine fixes from Vinod Koul:
      
       - update dmaengine tree location to kernel.org
      
       - dmatest fix for completing threads
      
       - driver fixes for k3dma, fsl-dma, idxd, ,tegra, and few other drivers
      
      * tag 'dmaengine-fix-5.8-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine: (21 commits)
        dmaengine: ioat setting ioat timeout as module parameter
        dmaengine: fsl-edma: fix wrong tcd endianness for big-endian cpu
        dmaengine: dmatest: stop completed threads when running without set channel
        dmaengine: fsl-edma-common: correct DSIZE_32BYTE
        dmaengine: dw: Initialize channel before each transfer
        dmaengine: idxd: fix misc interrupt handler thread unmasking
        dmaengine: idxd: cleanup workqueue config after disabling
        dmaengine: tegra210-adma: Fix runtime PM imbalance on error
        dmaengine: mcf-edma: Fix NULL pointer exception in mcf_edma_tx_handler
        dmaengine: fsl-edma: Fix NULL pointer exception in fsl_edma_tx_handler
        dmaengine: fsl-edma: Add lockdep assert for exported function
        dmaengine: idxd: fix hw descriptor fields for delta record
        dmaengine: ti: k3-udma: add missing put_device() call in of_xudma_dev_get()
        dmaengine: sh: usb-dmac: set tx_result parameters
        dmaengine: ti: k3-udma: Fix delayed_work usage for tx drain workaround
        dmaengine: idxd: fix cdev locking for open and release
        dmaengine: imx-sdma: Fix: Remove 'always true' comparison
        MAINTAINERS: switch dmaengine tree to kernel.org
        dmaengine: ti: k3-udma: Fix the running channel handling in alloc_chan_resources
        dmaengine: ti: k3-udma: Fix cleanup code for alloc_chan_resources
        ...
      0665a4e9
    • Wei Yongjun's avatar
      keys: asymmetric: fix error return code in software_key_query() · 6cbba1f9
      Wei Yongjun authored
      Fix to return negative error code -ENOMEM from kmalloc() error handling
      case instead of 0, as done elsewhere in this function.
      
      Fixes: f1774cb8 ("X.509: parse public key parameters from x509 for akcipher")
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6cbba1f9
    • David Howells's avatar
      afs: Fix interruption of operations · 811f04ba
      David Howells authored
      The afs filesystem driver allows unstarted operations to be cancelled by
      signal, but most of these can easily be restarted (mkdir for example).  The
      primary culprits for reproducing this are those applications that use
      SIGALRM to display a progress counter.
      
      File lock-extension operation is marked uninterruptible as we have a
      limited time in which to do it, and the release op is marked
      uninterruptible also as if we fail to unlock a file, we'll have to wait 20
      mins before anyone can lock it again.
      
      The store operation logs a warning if it gets interruption, e.g.:
      
      	kAFS: Unexpected error from FS.StoreData -4
      
      because it's run from the background - but it can also be run from
      fdatasync()-type things.  However, store options aren't marked
      interruptible at the moment.
      
      Fix this in the following ways:
      
       (1) Mark store operations as uninterruptible.  It might make sense to
           relax this for certain situations, but I'm not sure how to make sure
           that background store ops aren't affected by signals to foreground
           processes that happen to trigger them.
      
       (2) In afs_get_io_locks(), where we're getting the serialisation lock for
           talking to the fileserver, return ERESTARTSYS rather than EINTR
           because a lot of the operations (e.g. mkdir) are restartable if we
           haven't yet started sending the op to the server.
      
      Fixes: e49c7b2f ("afs: Build an abstraction around an "operation" concept")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      811f04ba
    • Vasiliy Kupriakov's avatar
      platform/x86: asus-wmi: allow BAT1 battery name · 9a33e375
      Vasiliy Kupriakov authored
      The battery on my laptop ASUS TUF Gaming FX706II is named BAT1.
      This patch allows battery extension to load.
      Signed-off-by: default avatarVasiliy Kupriakov <rublag-ns@yandex.ru>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      9a33e375
    • Srinivas Pandruvada's avatar
      platform/x86: ISST: Add new PCI device ids · e1eea3f8
      Srinivas Pandruvada authored
      Added new PCI device ids for supporting mailbox and MMIO interface for
      Sapphire Rapids.
      Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      e1eea3f8
    • Andy Shevchenko's avatar
      platform/x86: thinkpad_acpi: Revert "Use strndup_user() in dispatch_proc_write()" · e2e90804
      Andy Shevchenko authored
      This reverts commit 35d13c7a.
      
      This broke procfs interface due to neglecting the fact that
      the strings are not coming NULL terminated.
      
      Revert the change till we will have a better clean up.
      
      Fixes: 35d13c7a ("platform/x86: thinkpad_acpi: Use strndup_user() in dispatch_proc_write()")
      Reported-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      e2e90804
    • Enric Balletbo i Serra's avatar
      Revert "thermal: mediatek: fix register index error" · a8f62f18
      Enric Balletbo i Serra authored
      This reverts commit eb9aecd9
      
      The above patch is supposed to fix a register index error on mt2701. It
      is not clear if the problem solved is a hang or just an invalid value
      returned, my guess is the second. The patch introduces, though, a new
      hang on MT8173 device making them unusable. So, seems reasonable, revert
      the patch because introduces a worst issue.
      
      The reason I send a revert instead of trying to fix the issue for MT8173
      is because the information needed to fix the issue is in the datasheet
      and is not public. So I am not really able to fix it.
      
      Fixes the following bug when CONFIG_MTK_THERMAL is set on MT8173
      devices.
      
      [    2.222488] Unable to handle kernel paging request at virtual address ffff8000125f5001
      [    2.230421] Mem abort info:
      [    2.233207]   ESR = 0x96000021
      [    2.236261]   EC = 0x25: DABT (current EL), IL = 32 bits
      [    2.241571]   SET = 0, FnV = 0
      [    2.244623]   EA = 0, S1PTW = 0
      [    2.247762] Data abort info:
      [    2.250640]   ISV = 0, ISS = 0x00000021
      [    2.254473]   CM = 0, WnR = 0
      [    2.257544] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000041850000
      [    2.264251] [ffff8000125f5001] pgd=000000013ffff003, pud=000000013fffe003, pmd=000000013fff9003, pte=006800001100b707
      [    2.274867] Internal error: Oops: 96000021 [#1] PREEMPT SMP
      [    2.280432] Modules linked in:
      [    2.283483] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.7.0-rc6+ #162
      [    2.289914] Hardware name: Google Elm (DT)
      [    2.294003] pstate: 20000005 (nzCv daif -PAN -UAO)
      [    2.298792] pc : mtk_read_temp+0xb8/0x1c8
      [    2.302793] lr : mtk_read_temp+0x7c/0x1c8
      [    2.306794] sp : ffff80001003b930
      [    2.310100] x29: ffff80001003b930 x28: 0000000000000000
      [    2.315404] x27: 0000000000000002 x26: ffff0000f9550b10
      [    2.320709] x25: ffff0000f9550a80 x24: 0000000000000090
      [    2.326014] x23: ffff80001003ba24 x22: 00000000610344c0
      [    2.331318] x21: 0000000000002710 x20: 00000000000001f4
      [    2.336622] x19: 0000000000030d40 x18: ffff800011742ec0
      [    2.341926] x17: 0000000000000001 x16: 0000000000000001
      [    2.347230] x15: ffffffffffffffff x14: ffffff0000000000
      [    2.352535] x13: ffffffffffffffff x12: 0000000000000028
      [    2.357839] x11: 0000000000000003 x10: ffff800011295ec8
      [    2.363143] x9 : 000000000000291b x8 : 0000000000000002
      [    2.368447] x7 : 00000000000000a8 x6 : 0000000000000004
      [    2.373751] x5 : 0000000000000000 x4 : ffff800011295cb0
      [    2.379055] x3 : 0000000000000002 x2 : ffff8000125f5001
      [    2.384359] x1 : 0000000000000001 x0 : ffff0000f9550a80
      [    2.389665] Call trace:
      [    2.392105]  mtk_read_temp+0xb8/0x1c8
      [    2.395760]  of_thermal_get_temp+0x2c/0x40
      [    2.399849]  thermal_zone_get_temp+0x78/0x160
      [    2.404198]  thermal_zone_device_update.part.0+0x3c/0x1f8
      [    2.409589]  thermal_zone_device_update+0x34/0x48
      [    2.414286]  of_thermal_set_mode+0x58/0x88
      [    2.418375]  thermal_zone_of_sensor_register+0x1a8/0x1d8
      [    2.423679]  devm_thermal_zone_of_sensor_register+0x64/0xb0
      [    2.429242]  mtk_thermal_probe+0x690/0x7d0
      [    2.433333]  platform_drv_probe+0x5c/0xb0
      [    2.437335]  really_probe+0xe4/0x448
      [    2.440901]  driver_probe_device+0xe8/0x140
      [    2.445077]  device_driver_attach+0x7c/0x88
      [    2.449252]  __driver_attach+0xac/0x178
      [    2.453082]  bus_for_each_dev+0x78/0xc8
      [    2.456909]  driver_attach+0x2c/0x38
      [    2.460476]  bus_add_driver+0x14c/0x230
      [    2.464304]  driver_register+0x6c/0x128
      [    2.468131]  __platform_driver_register+0x50/0x60
      [    2.472831]  mtk_thermal_driver_init+0x24/0x30
      [    2.477268]  do_one_initcall+0x50/0x298
      [    2.481098]  kernel_init_freeable+0x1ec/0x264
      [    2.485450]  kernel_init+0x1c/0x110
      [    2.488931]  ret_from_fork+0x10/0x1c
      [    2.492502] Code: f9401081 f9400402 b8a67821 8b010042 (b9400042)
      [    2.498599] ---[ end trace e43e3105ed27dc99 ]---
      [    2.503367] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
      [    2.511020] SMP: stopping secondary CPUs
      [    2.514941] Kernel Offset: disabled
      [    2.518421] CPU features: 0x090002,25006005
      [    2.522595] Memory Limit: none
      [    2.525644] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]--
      
      Cc: Michael Kao <michael.kao@mediatek.com>
      Fixes: eb9aecd9 ("thermal: mediatek: fix register index error")
      Signed-off-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
      Reviewed-by: default avatarMatthias Brugger <matthias.bgg@gmail.com>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      Link: https://lore.kernel.org/r/20200707103412.1010823-1-enric.balletbo@collabora.com
      a8f62f18
    • Alex Hung's avatar
      thermal: int3403_thermal: Downgrade error message · f3d7fb38
      Alex Hung authored
      Downgrade "Unsupported event" message from dev_err to dev_dbg to avoid
      flooding with this message on some platforms.
      
      Cc: stable@vger.kernel.org # v5.4+
      Suggested-by: default avatarZhang Rui <rui.zhang@intel.com>
      Signed-off-by: default avatarAlex Hung <alex.hung@canonical.com>
      [ rzhang: fix typo in changelog ]
      Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
      Link: https://lore.kernel.org/r/20200615223957.183153-1-alex.hung@canonical.com
      f3d7fb38
  3. 14 Jul, 2020 2 commits
  4. 13 Jul, 2020 2 commits
    • Linus Torvalds's avatar
      Merge tag 'iommu-fixes-v5.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · 0dc589da
      Linus Torvalds authored
      Pull iommu fixes from Joerg Roedel:
      
       - Fix a use-after-free of the device iommu-group. Found in the arm-smmu
         driver, but the fix is in generic code.
      
       - Fix for the new Allwinner IOMMU driver to use the atomic
         readl_timeout() variant in IO/TLB flushing code.
      
       - A couple of cleanups to fix various compile warnings.
      
      * tag 'iommu-fixes-v5.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/arm-smmu: Mark qcom_smmu_client_of_match as possibly unused
        iommu: Fix use-after-free in iommu_release_device
        iommu/amd: Make amd_iommu_apply_ivrs_quirks() static inline
        iommu: SUN50I_IOMMU should depend on HAS_DMA
        iommu/sun50i: Remove unused variable
        iommu/sun50i: Change the readl timeout to the atomic variant
      0dc589da
    • Linus Torvalds's avatar
      mm: document warning in move_normal_pmd() and make it warn only once · f81fdd0c
      Linus Torvalds authored
      Naresh Kamboju reported that the LTP tests can cause warnings on i386
      going back all the way to v5.0, and bisected it to commit 2c91bd4a
      ("mm: speed up mremap by 20x on large regions").
      
      The warning in move_normal_pmd() is actually mostly correct, but we have
      a very unusual special case at process creation time, when we may move
      the stack down with an overlapping mode (kind of like a "memmove()"
      except using the page tables).
      
      And when you have just the right condition of "move a large initial
      stack by the right alignment in the end, but with the early part of the
      move being only page-aligned", we'll be in a situation where we're
      trying to move a normal PMD entry on top of an already existing - but
      now empty - PMD entry.
      
      The warning is still worth having, in case it ever triggers other cases,
      and perhaps as a reminder that we could do the stack move case more
      efficiently (although it's clearly rare enough that it probably doesn't
      matter).
      
      But make it do WARN_ON_ONCE(), so that you can't flood the logs with it.
      
      And add a *big* comment above it to explain and remind us what's going
      on, because it took some figuring out to see how this could trigger.
      Kudos to Joel Fernandes for debugging this.
      Reported-by: default avatarNaresh Kamboju <naresh.kamboju@linaro.org>
      Debugged-and-acked-by: default avatarJoel Fernandes <joel@joelfernandes.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f81fdd0c
  5. 12 Jul, 2020 8 commits
  6. 11 Jul, 2020 9 commits
  7. 10 Jul, 2020 8 commits
    • Nathan Chancellor's avatar
      mips: Remove compiler check in unroll macro · 9321f1aa
      Nathan Chancellor authored
      CONFIG_CC_IS_GCC is undefined when Clang is used, which breaks the build
      (see our Travis link below).
      
      Clang 8 was chosen as a minimum version for this check because there
      were some improvements around __builtin_constant_p in that release. In
      reality, MIPS was not even buildable until clang 9 so that check was not
      technically necessary. Just remove all compiler checks and just assume
      that we have a working compiler.
      
      Fixes: d4e60453 ("Restore gcc check in mips asm/unroll.h")
      Link: https://travis-ci.com/github/ClangBuiltLinux/continuous-integration/jobs/359642821Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9321f1aa
    • David S. Miller's avatar
      Merge branch 'mlxsw-Various-fixes' · 1195c7ce
      David S. Miller authored
      Ido Schimmel says:
      
      ====================
      mlxsw: Various fixes
      
      Fix two issues found by syzkaller.
      
      Patch #1 removes inappropriate usage of WARN_ON() following memory
      allocation failure. Constantly triggered when syzkaller injects faults.
      
      Patch #2 fixes a use-after-free that can be triggered by 'devlink dev
      info' following a failed devlink reload.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1195c7ce
    • Ido Schimmel's avatar
      mlxsw: pci: Fix use-after-free in case of failed devlink reload · c4317b11
      Ido Schimmel authored
      In case devlink reload failed, it is possible to trigger a
      use-after-free when querying the kernel for device info via 'devlink dev
      info' [1].
      
      This happens because as part of the reload error path the PCI command
      interface is de-initialized and its mailboxes are freed. When the
      devlink '->info_get()' callback is invoked the device is queried via the
      command interface and the freed mailboxes are accessed.
      
      Fix this by initializing the command interface once during probe and not
      during every reload.
      
      This is consistent with the other bus used by mlxsw (i.e., 'mlxsw_i2c')
      and also allows user space to query the running firmware version (for
      example) from the device after a failed reload.
      
      [1]
      BUG: KASAN: use-after-free in memcpy include/linux/string.h:406 [inline]
      BUG: KASAN: use-after-free in mlxsw_pci_cmd_exec+0x177/0xa60 drivers/net/ethernet/mellanox/mlxsw/pci.c:1675
      Write of size 4096 at addr ffff88810ae32000 by task syz-executor.1/2355
      
      CPU: 1 PID: 2355 Comm: syz-executor.1 Not tainted 5.8.0-rc2+ #29
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014
      Call Trace:
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0xf6/0x16e lib/dump_stack.c:118
       print_address_description.constprop.0+0x1c/0x250 mm/kasan/report.c:383
       __kasan_report mm/kasan/report.c:513 [inline]
       kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
       check_memory_region_inline mm/kasan/generic.c:186 [inline]
       check_memory_region+0x14e/0x1b0 mm/kasan/generic.c:192
       memcpy+0x39/0x60 mm/kasan/common.c:106
       memcpy include/linux/string.h:406 [inline]
       mlxsw_pci_cmd_exec+0x177/0xa60 drivers/net/ethernet/mellanox/mlxsw/pci.c:1675
       mlxsw_cmd_exec+0x249/0x550 drivers/net/ethernet/mellanox/mlxsw/core.c:2335
       mlxsw_cmd_access_reg drivers/net/ethernet/mellanox/mlxsw/cmd.h:859 [inline]
       mlxsw_core_reg_access_cmd drivers/net/ethernet/mellanox/mlxsw/core.c:1938 [inline]
       mlxsw_core_reg_access+0x2f6/0x540 drivers/net/ethernet/mellanox/mlxsw/core.c:1985
       mlxsw_reg_query drivers/net/ethernet/mellanox/mlxsw/core.c:2000 [inline]
       mlxsw_devlink_info_get+0x17f/0x6e0 drivers/net/ethernet/mellanox/mlxsw/core.c:1090
       devlink_nl_info_fill.constprop.0+0x13c/0x2d0 net/core/devlink.c:4588
       devlink_nl_cmd_info_get_dumpit+0x246/0x460 net/core/devlink.c:4648
       genl_lock_dumpit+0x85/0xc0 net/netlink/genetlink.c:575
       netlink_dump+0x515/0xe50 net/netlink/af_netlink.c:2245
       __netlink_dump_start+0x53d/0x830 net/netlink/af_netlink.c:2353
       genl_family_rcv_msg_dumpit.isra.0+0x296/0x300 net/netlink/genetlink.c:638
       genl_family_rcv_msg net/netlink/genetlink.c:733 [inline]
       genl_rcv_msg+0x78d/0x9d0 net/netlink/genetlink.c:753
       netlink_rcv_skb+0x152/0x440 net/netlink/af_netlink.c:2469
       genl_rcv+0x24/0x40 net/netlink/genetlink.c:764
       netlink_unicast_kernel net/netlink/af_netlink.c:1303 [inline]
       netlink_unicast+0x53a/0x750 net/netlink/af_netlink.c:1329
       netlink_sendmsg+0x850/0xd90 net/netlink/af_netlink.c:1918
       sock_sendmsg_nosec net/socket.c:652 [inline]
       sock_sendmsg+0x150/0x190 net/socket.c:672
       ____sys_sendmsg+0x6d8/0x840 net/socket.c:2363
       ___sys_sendmsg+0xff/0x170 net/socket.c:2417
       __sys_sendmsg+0xe5/0x1b0 net/socket.c:2450
       do_syscall_64+0x56/0xa0 arch/x86/entry/common.c:359
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      Fixes: a9c8336f ("mlxsw: core: Add support for devlink info command")
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c4317b11
    • Ido Schimmel's avatar
      mlxsw: spectrum_router: Remove inappropriate usage of WARN_ON() · d9d54202
      Ido Schimmel authored
      We should not trigger a warning when a memory allocation fails. Remove
      the WARN_ON().
      
      The warning is constantly triggered by syzkaller when it is injecting
      faults:
      
      [ 2230.758664] FAULT_INJECTION: forcing a failure.
      [ 2230.758664] name failslab, interval 1, probability 0, space 0, times 0
      [ 2230.762329] CPU: 3 PID: 1407 Comm: syz-executor.0 Not tainted 5.8.0-rc2+ #28
      ...
      [ 2230.898175] WARNING: CPU: 3 PID: 1407 at drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:6265 mlxsw_sp_router_fib_event+0xfad/0x13e0
      [ 2230.898179] Kernel panic - not syncing: panic_on_warn set ...
      [ 2230.898183] CPU: 3 PID: 1407 Comm: syz-executor.0 Not tainted 5.8.0-rc2+ #28
      [ 2230.898190] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014
      
      Fixes: 3057224e ("mlxsw: spectrum_router: Implement FIB offload in deferred work")
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d9d54202
    • David S. Miller's avatar
      Merge branch 'macb-WOL-fixes' · f9f41e3d
      David S. Miller authored
      Nicolas Ferre says:
      
      ====================
      net: macb: Wake-on-Lan magic packet fixes and GEM handling
      
      Here is a split series to fix WoL magic-packet on the current macb driver. Only
      fixes in this one based on current net/master.
      
      Changes in v5:
      - Addressed the error code returned by phylink_ethtool_set_wol() as suggested
        by Russell.
        If PHY handles WoL, MAC doesn't stay in the way.
      - Removed Florian's tag on 3/5 because of the above changes.
      - Correct the "Fixes" tag on 1/5.
      
      Changes in v4:
      - Pure bug fix series for 'net'. GEM addition and MACB update removed: will be
        sent later.
      
      Changes in v3:
      - Revert some of the v2 changes done in macb_resume(). Now the resume function
        supports in-depth re-configuration of the controller in order to deal with
        deeper sleep states. Basically as it was before changes introduced by this
        series
      - Tested for non-regression with our deeper Power Management mode which cuts
        power to the controller completely
      
      Changes in v2:
      - Add patch 4/7 ("net: macb: fix macb_suspend() by removing call to netif_carrier_off()")
        needed for keeping phy state consistent
      - Add patch 5/7 ("net: macb: fix call to pm_runtime in the suspend/resume functions") that prevent
        putting the macb in runtime pm suspend mode when WoL is used
      - Collect review tags on 3 first patches from Florian: Thanks!
      - Review of macb_resume() function
      - Addition of pm_wakeup_event() in both MACB and GEM WoL IRQ handlers
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f9f41e3d
    • Nicolas Ferre's avatar
      net: macb: fix call to pm_runtime in the suspend/resume functions · 6c8f85ca
      Nicolas Ferre authored
      The calls to pm_runtime_force_suspend/resume() functions are only
      relevant if the device is not configured to act as a WoL wakeup source.
      Add the device_may_wakeup() test before calling them.
      
      Fixes: 3e2a5e15 ("net: macb: add wake-on-lan support via magic packet")
      Cc: Claudiu Beznea <claudiu.beznea@microchip.com>
      Cc: Harini Katakam <harini.katakam@xilinx.com>
      Cc: Sergio Prado <sergio.prado@e-labworks.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6c8f85ca
    • Nicolas Ferre's avatar
      net: macb: fix macb_suspend() by removing call to netif_carrier_off() · 64febc5e
      Nicolas Ferre authored
      As we now use the phylink call to phylink_stop() in the non-WoL path,
      there is no need for this call to netif_carrier_off() anymore. It can
      disturb the underlying phylink FSM.
      
      Fixes: 7897b071 ("net: macb: convert to phylink")
      Cc: Claudiu Beznea <claudiu.beznea@microchip.com>
      Cc: Harini Katakam <harini.katakam@xilinx.com>
      Cc: Antoine Tenart <antoine.tenart@bootlin.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      64febc5e
    • Nicolas Ferre's avatar
      net: macb: fix macb_get/set_wol() when moving to phylink · 253fe094
      Nicolas Ferre authored
      Keep previous function goals and integrate phylink actions to them.
      
      phylink_ethtool_get_wol() is not enough to figure out if Ethernet driver
      supports Wake-on-Lan.
      Initialization of "supported" and "wolopts" members is done in phylink
      function, no need to keep them in calling function.
      
      phylink_ethtool_set_wol() return value is considered and determines
      if the MAC has to handle WoL or not. The case where the PHY doesn't
      implement WoL leads to the MAC configuring it to provide this feature.
      
      Fixes: 7897b071 ("net: macb: convert to phylink")
      Cc: Claudiu Beznea <claudiu.beznea@microchip.com>
      Cc: Harini Katakam <harini.katakam@xilinx.com>
      Cc: Antoine Tenart <antoine.tenart@bootlin.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      253fe094