Skip to content
  1. Sep 06, 2019
    • Greg Kroah-Hartman's avatar
      Linux 5.2.13 · 218ca2e5
      Greg Kroah-Hartman authored
      v5.2.13
      218ca2e5
    • Benjamin Tissoires's avatar
      Revert "Input: elantech - enable SMBus on new (2018+) systems" · 4c634717
      Benjamin Tissoires authored
      This reverts commit 60956b01 which is
      commit 883a2a80
      
       upstream.
      
      This patch depends on an other series:
      https://patchwork.kernel.org/project/linux-input/list/?series=122327&state=%2A&archive=both
      
      It was a mistake to backport it in the v5.2 branch, as there
      is a high chance we encounter a touchpad that needs the series
      above.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=204733
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=204771
      Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4c634717
    • Greg Kroah-Hartman's avatar
      Linux 5.2.12 · 140839fe
      Greg Kroah-Hartman authored
      v5.2.12
      140839fe
    • Greg Kroah-Hartman's avatar
      Revert "ASoC: Fail card instantiation if DAI format setup fails" · 5566d1c6
      Greg Kroah-Hartman authored
      This reverts commit ab4f4d33 which is
      commit 40aa5383
      
       upstream.
      
      Mark Brown writes:
      	I nacked this patch when Sasha posted it - it only improves
      	diagnostics and might make systems that worked by accident break
      	since it turns things into a hard failure, it won't make
      	anything that didn't work previously work.
      
      Reported-by: default avatarMark Brown <broonie@kernel.org>
      Cc: Ricard Wanderlof <ricardw@axis.com>
      Cc: Sasha Levin <sashal@kernel.org>
      Link: https://lore.kernel.org/lkml/20190904181027.GG4348@sirena.co.uk
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5566d1c6
    • Cong Wang's avatar
      hsr: switch ->dellink() to ->ndo_uninit() · 4d896602
      Cong Wang authored
      [ Upstream commit 311633b6 ]
      
      Switching from ->priv_destructor to dellink() has an unexpected
      consequence: existing RCU readers, that is, hsr_port_get_hsr()
      callers, may still be able to read the port list.
      
      Instead of checking the return value of each hsr_port_get_hsr(),
      we can just move it to ->ndo_uninit() which is called after
      device unregister and synchronize_net(), and we still have RTNL
      lock there.
      
      Fixes: b9a1e627 ("hsr: implement dellink to clean up resources")
      Fixes: edf070a0
      
       ("hsr: fix a NULL pointer deref in hsr_dev_xmit()")
      Reported-by: default avatar <syzbot+097ef84cdc95843fbaa8@syzkaller.appspotmail.com>
      Cc: Arvid Brodin <arvid.brodin@alten.se>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4d896602
    • Cong Wang's avatar
      hsr: fix a NULL pointer deref in hsr_dev_xmit() · 072c9337
      Cong Wang authored
      [ Upstream commit edf070a0
      
       ]
      
      hsr_port_get_hsr() could return NULL and kernel
      could crash:
      
       BUG: kernel NULL pointer dereference, address: 0000000000000010
       #PF: supervisor read access in kernel mode
       #PF: error_code(0x0000) - not-present page
       PGD 8000000074b84067 P4D 8000000074b84067 PUD 7057d067 PMD 0
       Oops: 0000 [#1] SMP PTI
       CPU: 0 PID: 754 Comm: a.out Not tainted 5.2.0-rc6+ #718
       Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-2.fc30 04/01/2014
       RIP: 0010:hsr_dev_xmit+0x20/0x31
       Code: 48 8b 1b eb e0 5b 5d 41 5c c3 66 66 66 66 90 55 48 89 fd 48 8d be 40 0b 00 00 be 04 00 00 00 e8 ee f2 ff ff 48 89 ef 48 89 c6 <48> 8b 40 10 48 89 45 10 e8 6c 1b 00 00 31 c0 5d c3 66 66 66 66 90
       RSP: 0018:ffffb5b400003c48 EFLAGS: 00010246
       RAX: 0000000000000000 RBX: ffff9821b4509a88 RCX: 0000000000000000
       RDX: ffff9821b4509a88 RSI: 0000000000000000 RDI: ffff9821bc3fc7c0
       RBP: ffff9821bc3fc7c0 R08: 0000000000000000 R09: 00000000000c2019
       R10: 0000000000000000 R11: 0000000000000002 R12: ffff9821bc3fc7c0
       R13: ffff9821b4509a88 R14: 0000000000000000 R15: 000000000000006e
       FS:  00007fee112a1800(0000) GS:ffff9821bd800000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 0000000000000010 CR3: 000000006e9ce000 CR4: 00000000000406f0
       Call Trace:
        <IRQ>
        netdev_start_xmit+0x1b/0x38
        dev_hard_start_xmit+0x121/0x21e
        ? validate_xmit_skb.isra.0+0x19/0x1e3
        __dev_queue_xmit+0x74c/0x823
        ? lockdep_hardirqs_on+0x12b/0x17d
        ip6_finish_output2+0x3d3/0x42c
        ? ip6_mtu+0x55/0x5c
        ? mld_sendpack+0x191/0x229
        mld_sendpack+0x191/0x229
        mld_ifc_timer_expire+0x1f7/0x230
        ? mld_dad_timer_expire+0x58/0x58
        call_timer_fn+0x12e/0x273
        __run_timers.part.0+0x174/0x1b5
        ? mld_dad_timer_expire+0x58/0x58
        ? sched_clock_cpu+0x10/0xad
        ? mark_lock+0x26/0x1f2
        ? __lock_is_held+0x40/0x71
        run_timer_softirq+0x26/0x48
        __do_softirq+0x1af/0x392
        irq_exit+0x53/0xa2
        smp_apic_timer_interrupt+0x1c4/0x1d9
        apic_timer_interrupt+0xf/0x20
        </IRQ>
      
      Cc: Arvid Brodin <arvid.brodin@alten.se>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      072c9337
    • Cong Wang's avatar
      hsr: implement dellink to clean up resources · 08523d5a
      Cong Wang authored
      commit b9a1e627
      
       upstream.
      
      hsr_link_ops implements ->newlink() but not ->dellink(),
      which leads that resources not released after removing the device,
      particularly the entries in self_node_db and node_db.
      
      So add ->dellink() implementation to replace the priv_destructor.
      This also makes the code slightly easier to understand.
      
      Reported-by: default avatar <syzbot+c6167ec3de7def23d1e8@syzkaller.appspotmail.com>
      Cc: Arvid Brodin <arvid.brodin@alten.se>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      08523d5a
    • Daniel Borkmann's avatar
      bpf: fix use after free in prog symbol exposure · a282179b
      Daniel Borkmann authored
      commit c751798a upstream.
      
      syzkaller managed to trigger the warning in bpf_jit_free() which checks via
      bpf_prog_kallsyms_verify_off() for potentially unlinked JITed BPF progs
      in kallsyms, and subsequently trips over GPF when walking kallsyms entries:
      
        [...]
        8021q: adding VLAN 0 to HW filter on device batadv0
        8021q: adding VLAN 0 to HW filter on device batadv0
        WARNING: CPU: 0 PID: 9869 at kernel/bpf/core.c:810 bpf_jit_free+0x1e8/0x2a0
        Kernel panic - not syncing: panic_on_warn set ...
        CPU: 0 PID: 9869 Comm: kworker/0:7 Not tainted 5.0.0-rc8+ #1
        Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
        Workqueue: events bpf_prog_free_deferred
        Call Trace:
         __dump_stack lib/dump_stack.c:77 [inline]
         dump_stack+0x113/0x167 lib/dump_stack.c:113
         panic+0x212/0x40b kernel/panic.c:214
         __warn.cold.8+0x1b/0x38 kernel/panic.c:571
         report_bug+0x1a4/0x200 lib/bug.c:186
         fixup_bug arch/x86/kernel/traps.c:178 [inline]
         do_error_trap+0x11b/0x200 arch/x86/kernel/traps.c:271
         do_invalid_op+0x36/0x40 arch/x86/kernel/traps.c:290
         invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:973
        RIP: 0010:bpf_jit_free+0x1e8/0x2a0
        Code: 02 4c 89 e2 83 e2 07 38 d0 7f 08 84 c0 0f 85 86 00 00 00 48 ba 00 02 00 00 00 00 ad de 0f b6 43 02 49 39 d6 0f 84 5f fe ff ff <0f> 0b e9 58 fe ff ff 48 b8 00 00 00 00 00 fc ff df 4c 89 e2 48 c1
        RSP: 0018:ffff888092f67cd8 EFLAGS: 00010202
        RAX: 0000000000000007 RBX: ffffc90001947000 RCX: ffffffff816e9d88
        RDX: dead000000000200 RSI: 0000000000000008 RDI: ffff88808769f7f0
        RBP: ffff888092f67d00 R08: fffffbfff1394059 R09: fffffbfff1394058
        R10: fffffbfff1394058 R11: ffffffff89ca02c7 R12: ffffc90001947002
        R13: ffffc90001947020 R14: ffffffff881eca80 R15: ffff88808769f7e8
        BUG: unable to handle kernel paging request at fffffbfff400d000
        #PF error: [normal kernel read fault]
        PGD 21ffee067 P4D 21ffee067 PUD 21ffed067 PMD 9f942067 PTE 0
        Oops: 0000 [#1] PREEMPT SMP KASAN
        CPU: 0 PID: 9869 Comm: kworker/0:7 Not tainted 5.0.0-rc8+ #1
        Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
        Workqueue: events bpf_prog_free_deferred
        RIP: 0010:bpf_get_prog_addr_region kernel/bpf/core.c:495 [inline]
        RIP: 0010:bpf_tree_comp kernel/bpf/core.c:558 [inline]
        RIP: 0010:__lt_find include/linux/rbtree_latch.h:115 [inline]
        RIP: 0010:latch_tree_find include/linux/rbtree_latch.h:208 [inline]
        RIP: 0010:bpf_prog_kallsyms_find+0x107/0x2e0 kernel/bpf/core.c:632
        Code: 00 f0 ff ff 44 38 c8 7f 08 84 c0 0f 85 fa 00 00 00 41 f6 45 02 01 75 02 0f 0b 48 39 da 0f 82 92 00 00 00 48 89 d8 48 c1 e8 03 <42> 0f b6 04 30 84 c0 74 08 3c 03 0f 8e 45 01 00 00 8b 03 48 c1 e0
        [...]
      
      Upon further debugging, it turns out that whenever we trigger this
      issue, the kallsyms removal in bpf_prog_ksym_node_del() was /skipped/
      but yet bpf_jit_free() reported that the entry is /in use/.
      
      Problem is that symbol exposure via bpf_prog_kallsyms_add() but also
      perf_event_bpf_event() were done /after/ bpf_prog_new_fd(). Once the
      fd is exposed to the public, a parallel close request came in right
      before we attempted to do the bpf_prog_kallsyms_add().
      
      Given at this time the prog reference count is one, we start to rip
      everything underneath us via bpf_prog_release() -> bpf_prog_put().
      The memory is eventually released via deferred free, so we're seeing
      that bpf_jit_free() has a kallsym entry because we added it from
      bpf_prog_load() but /after/ bpf_prog_put() from the remote CPU.
      
      Therefore, move both notifications /before/ we install the fd. The
      issue was never seen between bpf_prog_alloc_id() and bpf_prog_new_fd()
      because upon bpf_prog_get_fd_by_id() we'll take another reference to
      the BPF prog, so we're still holding the original reference from the
      bpf_prog_load().
      
      Fixes: 6ee52e2a ("perf, bpf: Introduce PERF_RECORD_BPF_EVENT")
      Fixes: 74451e66
      
       ("bpf: make jited programs visible in traces")
      Reported-by: default avatar <syzbot+bd3bba6ff3fcea7a6ec6@syzkaller.appspotmail.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Cc: Song Liu <songliubraving@fb.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a282179b
    • Greg Kroah-Hartman's avatar
      x86/ptrace: fix up botched merge of spectrev1 fix · 0d5014b8
      Greg Kroah-Hartman authored
      I incorrectly merged commit 31a2fbb3
      
       ("x86/ptrace: Fix possible
      spectre-v1 in ptrace_get_debugreg()") when backporting it, as was
      graciously pointed out at
      https://grsecurity.net/teardown_of_a_failed_linux_lts_spectre_fix.php
      
      Resolve the upstream difference with the stable kernel merge to properly
      protect things.
      
      Reported-by: default avatarBrad Spengler <spender@grsecurity.net>
      Cc: Dianzhang Chen <dianzhangchen0@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: <bp@alien8.de>
      Cc: <hpa@zytor.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0d5014b8
    • Manasi Navare's avatar
      drm/i915/dp: Fix DSC enable code to use cpu_transcoder instead of encoder->type · 3af8db6a
      Manasi Navare authored
      [ Upstream commit d4c61c4a ]
      
      This patch fixes the intel_configure_pps_for_dsc_encoder() function to use
      cpu_transcoder instead of encoder->type to select the correct DSC registers
      that was wrongly used in the original patch for one DSC register isntance.
      
      Fixes: 7182414e
      
       ("drm/i915/dp: Configure i915 Picture parameter Set registers during DSC enabling")
      Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
      Cc: <stable@vger.kernel.org> # v5.0+
      Signed-off-by: default avatarManasi Navare <manasi.d.navare@intel.com>
      Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190821215950.24223-1-manasi.d.navare@intel.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3af8db6a
    • Ville Syrjälä's avatar
      drm/i915: Do not create a new max_bpc prop for MST connectors · b6980646
      Ville Syrjälä authored
      [ Upstream commit 1b9bd096 ]
      
      We're not allowed to create new properties after device registration
      so for MST connectors we need to either create the max_bpc property
      earlier, or we reuse one we already have. Let's do the latter apporach
      since the corresponding SST connector already has the prop and its
      min/max are correct also for the MST connector.
      
      The problem was highlighted by commit 4f5368b5 ("drm/kms:
      Catch mode_object lifetime errors") which results in the following
      spew:
      [ 1330.878941] WARNING: CPU: 2 PID: 1554 at drivers/gpu/drm/drm_mode_object.c:45 __drm_mode_object_add+0xa0/0xb0 [drm]
      ...
      [ 1330.879008] Call Trace:
      [ 1330.879023]  drm_property_create+0xba/0x180 [drm]
      [ 1330.879036]  drm_property_create_range+0x15/0x30 [drm]
      [ 1330.879048]  drm_connector_attach_max_bpc_property+0x62/0x80 [drm]
      [ 1330.879086]  intel_dp_add_mst_connector+0x11f/0x140 [i915]
      [ 1330.879094]  drm_dp_add_port.isra.20+0x20b/0x440 [drm_kms_helper]
      ...
      
      Cc: stable@vger.kernel.org
      Cc: Lyude Paul <lyude@redhat.com>
      Cc: sunpeng.li@amd.com
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Fixes: 5ca0ef8a
      
       ("drm/i915: Add max_bpc property for DP MST")
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190820161657.9658-1-ville.syrjala@linux.intel.com
      Reviewed-by: default avatarJosé Roberto de Souza <jose.souza@intel.com>
      Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b6980646
    • Luca Coelho's avatar
      iwlwifi: pcie: handle switching killer Qu B0 NICs to C0 · 79d5d731
      Luca Coelho authored
      [ Upstream commit b9500577
      
       ]
      
      We need to use a different firmware for C0 versions of killer Qu NICs.
      Add structures for them and handle them in the if block that detects
      C0 revisions.
      
      Additionally, instead of having an inclusive check for QnJ devices,
      make the selection exclusive, so that switching to QnJ is the
      exception, not the default.  This prevents us from having to add all
      the non-QnJ cards to an exclusion list.  To do so, only go into the
      QnJ block if the device has an RF ID type HR and HW revision QnJ.
      
      Cc: stable@vger.kernel.org # 5.2
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Link: https://lore.kernel.org/r/20190821171732.2266-1-luca@coelho.fi
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      79d5d731
    • Luca Coelho's avatar
      iwlwifi: pcie: don't switch FW to qnj when ax201 is detected · 3146a6de
      Luca Coelho authored
      [ Upstream commit 17e40e69
      
       ]
      
      We have a too generic condition that switches from Qu configurations
      to QnJ configurations.  We need to exclude some configurations so that
      they are not erroneously switched.  Add the ax201 configuration to the
      list of exclusions.
      
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3146a6de
    • Luca Coelho's avatar
      iwlwifi: pcie: add support for qu c-step devices · 9e7e6850
      Luca Coelho authored
      [ Upstream commit a7d544d6
      
       ]
      
      Add support for C-step devices.  Currently we don't have a nice way of
      matching the step and choosing the proper configuration, so we need to
      switch the config structs one by one.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9e7e6850
    • Ihab Zhaika's avatar
      iwlwifi: change 0x02F0 fw from qu to quz · c013312e
      Ihab Zhaika authored
      [ Upstream commit 658521fc
      
       ]
      
      change the fw of 0x02F0 platform from qu to quz
      
      Signed-off-by: default avatarIhab Zhaika <ihab.zhaika@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c013312e
    • Ihab Zhaika's avatar
      iwlwifi: add new cards for 9000 and 20000 series · feee62ef
      Ihab Zhaika authored
      [ Upstream commit ffcb60a5
      
       ]
      
      add two new PCI ID's for 9000 and 20000 series
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarIhab Zhaika <ihab.zhaika@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      feee62ef
    • Ihab Zhaika's avatar
      iwlwifi: add new cards for 22000 and change wrong structs · 0fdbd727
      Ihab Zhaika authored
      [ Upstream commit a976bfb4
      
       ]
      
      add few PCI ID'S for 22000 and chainge few cards structs names
      
      Signed-off-by: default avatarIhab Zhaika <ihab.zhaika@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0fdbd727
    • Ihab Zhaika's avatar
      iwlwifi: add new cards for 22000 and fix struct name · 805363e2
      Ihab Zhaika authored
      [ Upstream commit d151b0a2
      
       ]
      
      add few PCI ID'S for 22000 and fix the wrong name for one
      of the structs
      
      Signed-off-by: default avatarIhab Zhaika <ihab.zhaika@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      805363e2
    • Chunyan Zhang's avatar
      mmc: sdhci-sprd: add get_ro hook function · e27fc344
      Chunyan Zhang authored
      [ Upstream commit 4eae8cbd ]
      
      sprd's sd host controller doesn't support write protect to sd card.
      
      Fixes: fb8bd90f
      
       ("mmc: sdhci-sprd: Add Spreadtrum's initial host controller")
      Signed-off-by: default avatarChunyan Zhang <chunyan.zhang@unisoc.com>
      Signed-off-by: default avatarChunyan Zhang <zhang.lyra@gmail.com>
      Reviewed-by: default avatarBaolin Wang <baolin.wang@linaro.org>
      Tested-by: default avatarBaolin Wang <baolin.wang@linaro.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e27fc344
    • Baolin Wang's avatar
      mmc: sdhci-sprd: Implement the get_max_timeout_count() interface · 9ad0348f
      Baolin Wang authored
      [ Upstream commit 7486831d
      
       ]
      
      Implement the get_max_timeout_count() interface to set the Spredtrum SD
      host controller actual maximum timeout count.
      
      Signed-off-by: default avatarBaolin Wang <baolin.wang@linaro.org>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9ad0348f
    • Chunyan Zhang's avatar
      mmc: sdhci-sprd: clear the UHS-I modes read from registers · d100666e
      Chunyan Zhang authored
      [ Upstream commit 2f765c17 ]
      
      sprd's sd host controller supports SDR50/SDR104/DDR50 though, the UHS-I
      mode used by the specific card can be selected via devicetree only.
      
      Fixes: fb8bd90f
      
       ("mmc: sdhci-sprd: Add Spreadtrum's initial host controller")
      Signed-off-by: default avatarChunyan Zhang <chunyan.zhang@unisoc.com>
      Signed-off-by: default avatarChunyan Zhang <zhang.lyra@gmail.com>
      Reviewed-by: default avatarBaolin Wang <baolin.wang@linaro.org>
      Tested-by: default avatarBaolin Wang <baolin.wang@linaro.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d100666e
    • Denis Kenzior's avatar
      mac80211: Correctly set noencrypt for PAE frames · b018fcb9
      Denis Kenzior authored
      commit f8b43c5c upstream.
      
      The noencrypt flag was intended to be set if the "frame was received
      unencrypted" according to include/uapi/linux/nl80211.h.  However, the
      current behavior is opposite of this.
      
      Cc: stable@vger.kernel.org
      Fixes: 018f6fbf
      
       ("mac80211: Send control port frames over nl80211")
      Signed-off-by: default avatarDenis Kenzior <denkenz@gmail.com>
      Link: https://lore.kernel.org/r/20190827224120.14545-3-denkenz@gmail.com
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b018fcb9
    • Denis Kenzior's avatar
      mac80211: Don't memset RXCB prior to PAE intercept · 08392de0
      Denis Kenzior authored
      commit c8a41c6a upstream.
      
      In ieee80211_deliver_skb_to_local_stack intercepts EAPoL frames if
      mac80211 is configured to do so and forwards the contents over nl80211.
      During this process some additional data is also forwarded, including
      whether the frame was received encrypted or not.  Unfortunately just
      prior to the call to ieee80211_deliver_skb_to_local_stack, skb->cb is
      cleared, resulting in incorrect data being exposed over nl80211.
      
      Fixes: 018f6fbf
      
       ("mac80211: Send control port frames over nl80211")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDenis Kenzior <denkenz@gmail.com>
      Link: https://lore.kernel.org/r/20190827224120.14545-2-denkenz@gmail.com
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      08392de0
    • Alexander Wetzel's avatar
      cfg80211: Fix Extended Key ID key install checks · 4e118994
      Alexander Wetzel authored
      commit b67fd72e upstream.
      
      Fix two shortcomings in the Extended Key ID API:
      
       1) Allow the userspace to install pairwise keys using keyid 1 without
          NL80211_KEY_NO_TX set. This allows the userspace to install and
          activate pairwise keys with keyid 1 in the same way as for keyid 0,
          simplifying the API usage for e.g. FILS and FT key installs.
      
       2) IEEE 802.11 - 2016 restricts Extended Key ID usage to CCMP/GCMP
          ciphers in IEEE 802.11 - 2016 "9.4.2.25.4 RSN capabilities".
          Enforce that when installing a key.
      
      Cc: stable@vger.kernel.org # 5.2
      Fixes: 6cdd3979
      
       ("nl80211/cfg80211: Extended Key ID support")
      Signed-off-by: default avatarAlexander Wetzel <alexander@wetzel-home.de>
      Link: https://lore.kernel.org/r/20190805123400.51567-1-alexander@wetzel-home.de
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4e118994
    • Johannes Berg's avatar
      mac80211: fix possible sta leak · b14f5ba7
      Johannes Berg authored
      commit 5fd2f91a upstream.
      
      If TDLS station addition is rejected, the sta memory is leaked.
      Avoid this by moving the check before the allocation.
      
      Cc: stable@vger.kernel.org
      Fixes: 7ed52853
      
       ("mac80211: don't initiate TDLS connection if station is not associated to AP")
      Link: https://lore.kernel.org/r/20190801073033.7892-1-johannes@sipsolutions.net
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b14f5ba7
    • Hodaszi, Robert's avatar
      Revert "cfg80211: fix processing world regdomain when non modular" · 3cd42050
      Hodaszi, Robert authored
      commit 0d31d4db upstream.
      
      This reverts commit 96cce12f ("cfg80211: fix processing world
      regdomain when non modular").
      
      Re-triggering a reg_process_hint with the last request on all events,
      can make the regulatory domain fail in case of multiple WiFi modules. On
      slower boards (espacially with mdev), enumeration of the WiFi modules
      can end up in an intersected regulatory domain, and user cannot set it
      with 'iw reg set' anymore.
      
      This is happening, because:
      - 1st module enumerates, queues up a regulatory request
      - request gets processed by __reg_process_hint_driver():
        - checks if previous was set by CORE -> yes
          - checks if regulator domain changed -> yes, from '00' to e.g. 'US'
            -> sends request to the 'crda'
      - 2nd module enumerates, queues up a regulator request (which triggers
        the reg_todo() work)
      - reg_todo() -> reg_process_pending_hints() sees, that the last request
        is not processed yet, so it tries to process it again.
        __reg_process_hint driver() will run again, and:
        - checks if the last request's initiator was the core -> no, it was
          the driver (1st WiFi module)
        - checks, if the previous initiator was the driver -> yes
          - checks if the regulator domain changed -> yes, it was '00' (set by
            core, and crda call did not return yet), and should be changed to 'US'
      
      ------> __reg_process_hint_driver calls an intersect
      
      Besides, the reg_process_hint call with the last request is meaningless
      since the crda call has a timeout work. If that timeout expires, the
      first module's request will lost.
      
      Cc: stable@vger.kernel.org
      Fixes: 96cce12f
      
       ("cfg80211: fix processing world regdomain when non modular")
      Signed-off-by: default avatarRobert Hodaszi <robert.hodaszi@digi.com>
      Link: https://lore.kernel.org/r/20190614131600.GA13897@a1-hr
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3cd42050
    • Shakeel Butt's avatar
      mm: memcontrol: fix percpu vmstats and vmevents flush · b6a0d1f9
      Shakeel Butt authored
      commit 6c1c2808 upstream.
      
      Instead of using raw_cpu_read() use per_cpu() to read the actual data of
      the corresponding cpu otherwise we will be reading the data of the
      current cpu for the number of online CPUs.
      
      Link: http://lkml.kernel.org/r/20190829203110.129263-1-shakeelb@google.com
      Fixes: bb65f89b ("mm: memcontrol: flush percpu vmevents before releasing memcg")
      Fixes: c350a99e
      
       ("mm: memcontrol: flush percpu vmstats before releasing memcg")
      Signed-off-by: default avatarShakeel Butt <shakeelb@google.com>
      Acked-by: default avatarRoman Gushchin <guro@fb.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b6a0d1f9
    • Roman Gushchin's avatar
      mm, memcg: partially revert "mm/memcontrol.c: keep local VM counters in sync... · bba5bcb0
      Roman Gushchin authored
      mm, memcg: partially revert "mm/memcontrol.c: keep local VM counters in sync with the hierarchical ones"
      
      commit b4c46484 upstream.
      
      Commit 766a4c19 ("mm/memcontrol.c: keep local VM counters in sync
      with the hierarchical ones") effectively decreased the precision of
      per-memcg vmstats_local and per-memcg-per-node lruvec percpu counters.
      
      That's good for displaying in memory.stat, but brings a serious
      regression into the reclaim process.
      
      One issue I've discovered and debugged is the following:
      lruvec_lru_size() can return 0 instead of the actual number of pages in
      the lru list, preventing the kernel to reclaim last remaining pages.
      Result is yet another dying memory cgroups flooding.  The opposite is
      also happening: scanning an empty lru list is the waste of cpu time.
      
      Also, inactive_list_is_low() can return incorrect values, preventing the
      active lru from being scanned and freed.  It can fail both because the
      size of active and inactive lists are inaccurate, and because the number
      of workingset refaults isn't precise.  In other words, the result is
      pretty random.
      
      I'm not sure, if using the approximate number of slab pages in
      count_shadow_number() is acceptable, but issues described above are
      enough to partially revert the patch.
      
      Let's keep per-memcg vmstat_local batched (they are only used for
      displaying stats to the userspace), but keep lruvec stats precise.  This
      change fixes the dead memcg flooding on my setup.
      
      Link: http://lkml.kernel.org/r/20190817004726.2530670-1-guro@fb.com
      Fixes: 766a4c19
      
       ("mm/memcontrol.c: keep local VM counters in sync with the hierarchical ones")
      Signed-off-by: default avatarRoman Gushchin <guro@fb.com>
      Acked-by: default avatarYafang Shao <laoar.shao@gmail.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      bba5bcb0
    • Chunyan Zhang's avatar
      mms: sdhci-sprd: add SDHCI_QUIRK_BROKEN_CARD_DETECTION · 8706ffe2
      Chunyan Zhang authored
      commit 4324e54b upstream.
      
      sprd's sd host controller doesn't support detection to
      card insert or remove.
      
      Fixes: fb8bd90f
      
       ("mmc: sdhci-sprd: Add Spreadtrum's initial host controller")
      Signed-off-by: default avatarChunyan Zhang <chunyan.zhang@unisoc.com>
      Signed-off-by: default avatarChunyan Zhang <zhang.lyra@gmail.com>
      Reviewed-by: default avatarBaolin Wang <baolin.wang@linaro.org>
      Tested-by: default avatarBaolin Wang <baolin.wang@linaro.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8706ffe2
    • Stanislaw Gruszka's avatar
      mt76: mt76x0u: do not reset radio on resume · d7c7531a
      Stanislaw Gruszka authored
      commit 8f2d163c upstream.
      
      On some machines mt76x0u firmware can hung during resume,
      what result on messages like below:
      
      [  475.480062] mt76x0 1-8:1.0: Error: MCU response pre-completed!
      [  475.990066] mt76x0 1-8:1.0: Error: send MCU cmd failed:-110
      [  475.990075] mt76x0 1-8:1.0: Error: MCU response pre-completed!
      [  476.500003] mt76x0 1-8:1.0: Error: send MCU cmd failed:-110
      [  476.500012] mt76x0 1-8:1.0: Error: MCU response pre-completed!
      [  477.010046] mt76x0 1-8:1.0: Error: send MCU cmd failed:-110
      [  477.010055] mt76x0 1-8:1.0: Error: MCU response pre-completed!
      [  477.529997] mt76x0 1-8:1.0: Error: send MCU cmd failed:-110
      [  477.530006] mt76x0 1-8:1.0: Error: MCU response pre-completed!
      [  477.824907] mt76x0 1-8:1.0: Error: send MCU cmd failed:-71
      [  477.824916] mt76x0 1-8:1.0: Error: MCU response pre-completed!
      [  477.825029] usb 1-8: USB disconnect, device number 6
      
      and possible whole system freeze.
      
      This can be avoided, if we do not perform mt76x0_chip_onoff() reset.
      
      Cc: stable@vger.kernel.org
      Fixes: 134b2d0d
      
       ("mt76x0: init files")
      Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d7c7531a
    • Trond Myklebust's avatar
      SUNRPC: Don't handle errors if the bind/connect succeeded · 839e9613
      Trond Myklebust authored
      commit bd736ed3
      
       upstream.
      
      Don't handle errors in call_bind_status()/call_connect_status()
      if it turns out that a previous call caused it to succeed.
      
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Cc: stable@vger.kernel.org # v5.1+
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      839e9613
    • Gary R Hook's avatar
      crypto: ccp - Ignore unconfigured CCP device on suspend/resume · 90ff6dd4
      Gary R Hook authored
      commit 5871cd93 upstream.
      
      If a CCP is unconfigured (e.g. there are no available queues) then
      there will be no data structures allocated for the device. Thus, we
      must check for validity of a pointer before trying to access structure
      members.
      
      Fixes: 720419f0
      
       ("crypto: ccp - Introduce the AMD Secure Processor device")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarGary R Hook <gary.hook@amd.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      90ff6dd4
    • Nadav Amit's avatar
      VMCI: Release resource if the work is already queued · 3c3c2337
      Nadav Amit authored
      commit ba03a9bb upstream.
      
      Francois reported that VMware balloon gets stuck after a balloon reset,
      when the VMCI doorbell is removed. A similar error can occur when the
      balloon driver is removed with the following splat:
      
      [ 1088.622000] INFO: task modprobe:3565 blocked for more than 120 seconds.
      [ 1088.622035]       Tainted: G        W         5.2.0 #4
      [ 1088.622087] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      [ 1088.622205] modprobe        D    0  3565   1450 0x00000000
      [ 1088.622210] Call Trace:
      [ 1088.622246]  __schedule+0x2a8/0x690
      [ 1088.622248]  schedule+0x2d/0x90
      [ 1088.622250]  schedule_timeout+0x1d3/0x2f0
      [ 1088.622252]  wait_for_completion+0xba/0x140
      [ 1088.622320]  ? wake_up_q+0x80/0x80
      [ 1088.622370]  vmci_resource_remove+0xb9/0xc0 [vmw_vmci]
      [ 1088.622373]  vmci_doorbell_destroy+0x9e/0xd0 [vmw_vmci]
      [ 1088.622379]  vmballoon_vmci_cleanup+0x6e/0xf0 [vmw_balloon]
      [ 1088.622381]  vmballoon_exit+0x18/0xcc8 [vmw_balloon]
      [ 1088.622394]  __x64_sys_delete_module+0x146/0x280
      [ 1088.622408]  do_syscall_64+0x5a/0x130
      [ 1088.622410]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [ 1088.622415] RIP: 0033:0x7f54f62791b7
      [ 1088.622421] Code: Bad RIP value.
      [ 1088.622421] RSP: 002b:00007fff2a949008 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
      [ 1088.622426] RAX: ffffffffffffffda RBX: 000055dff8b55d00 RCX: 00007f54f62791b7
      [ 1088.622426] RDX: 0000000000000000 RSI: 0000000000000800 RDI: 000055dff8b55d68
      [ 1088.622427] RBP: 000055dff8b55d00 R08: 00007fff2a947fb1 R09: 0000000000000000
      [ 1088.622427] R10: 00007f54f62f5cc0 R11: 0000000000000206 R12: 000055dff8b55d68
      [ 1088.622428] R13: 0000000000000001 R14: 000055dff8b55d68 R15: 00007fff2a94a3f0
      
      The cause for the bug is that when the "delayed" doorbell is invoked, it
      takes a reference on the doorbell entry and schedules work that is
      supposed to run the appropriate code and drop the doorbell entry
      reference. The code ignores the fact that if the work is already queued,
      it will not be scheduled to run one more time. As a result one of the
      references would not be dropped. When the code waits for the reference
      to get to zero, during balloon reset or module removal, it gets stuck.
      
      Fix it. Drop the reference if schedule_work() indicates that the work is
      already queued.
      
      Note that this bug got more apparent (or apparent at all) due to
      commit ce664331 ("vmw_balloon: VMCI_DOORBELL_SET does not check status").
      
      Fixes: 83e2ec76
      
       ("VMCI: doorbell implementation.")
      Reported-by: default avatarFrancois Rigault <rigault.francois@gmail.com>
      Cc: Jorgen Hansen <jhansen@vmware.com>
      Cc: Adit Ranadive <aditr@vmware.com>
      Cc: Alexios Zavras <alexios.zavras@intel.com>
      Cc: Vishnu DASA <vdasa@vmware.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNadav Amit <namit@vmware.com>
      Reviewed-by: default avatarVishnu Dasa <vdasa@vmware.com>
      Link: https://lore.kernel.org/r/20190820202638.49003-1-namit@vmware.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3c3c2337
    • John Garry's avatar
      bus: hisi_lpc: Add .remove method to avoid driver unbind crash · 6992ae83
      John Garry authored
      commit 10e62b47 upstream.
      
      The original driver author seemed to be under the impression that a driver
      cannot be removed if it does not have a .remove method. Or maybe if it is
      a built-in platform driver.
      
      This is not true. This crash can be created:
      
      root@ubuntu:/sys/bus/platform/drivers/hisi-lpc# echo HISI0191\:00 > unbind
      root@ubuntu:/sys/bus/platform/drivers/hisi-lpc# ipmitool raw 6 1
       Unable to handle kernel paging request at virtual address ffff000010035010
       Mem abort info:
         ESR = 0x96000047
         Exception class = DABT (current EL), IL = 32 bits
         SET = 0, FnV = 0
         EA = 0, S1PTW = 0
       Data abort info:
         ISV = 0, ISS = 0x00000047
         CM = 0, WnR = 1
       swapper pgtable: 4k pages, 48-bit VAs, pgdp=000000000118b000
       [ffff000010035010] pgd=0000041ffbfff003, pud=0000041ffbffe003, pmd=0000041ffbffd003, pte=0000000000000000
       Internal error: Oops: 96000047 [#1] PREEMPT SMP
       Modules linked in:
       CPU: 17 PID: 1473 Comm: ipmitool Not tainted 5.2.0-rc5-00003-gf68c53b414a3-dirty #198
       Hardware name: Huawei Taishan 2280 /D05, BIOS Hisilicon D05 IT21 Nemo 2.0 RC0 04/18/2018
       pstate: 20000085 (nzCv daIf -PAN -UAO)
       pc : hisi_lpc_target_in+0x7c/0x120
       lr : hisi_lpc_target_in+0x70/0x120
       sp : ffff00001efe3930
       x29: ffff00001efe3930 x28: ffff841f9f599200
       x27: 0000000000000002 x26: 0000000000000000
       x25: 0000000000000080 x24: 00000000000000e4
       x23: 0000000000000000 x22: 0000000000000064
       x21: ffff801fb667d280 x20: 0000000000000001
       x19: ffff00001efe39ac x18: 0000000000000000
       x17: 0000000000000000 x16: 0000000000000000
       x15: 0000000000000000 x14: 0000000000000000
       x13: 0000000000000000 x12: 0000000000000000
       x11: 0000000000000000 x10: 0000000000000000
       x9 : 0000000000000000 x8 : ffff841febe60340
       x7 : ffff801fb55c52e8 x6 : 0000000000000000
       x5 : 0000000000ffc0e3 x4 : 0000000000000001
       x3 : ffff801fb667d280 x2 : 0000000000000001
       x1 : ffff000010035010 x0 : ffff000010035000
       Call trace:
        hisi_lpc_target_in+0x7c/0x120
        hisi_lpc_comm_in+0x88/0x98
        logic_inb+0x5c/0xb8
        port_inb+0x18/0x20
        bt_event+0x38/0x808
        smi_event_handler+0x4c/0x5a0
        check_start_timer_thread.part.4+0x40/0x58
        sender+0x78/0x88
        smi_send.isra.6+0x94/0x108
        i_ipmi_request+0x2c4/0x8f8
        ipmi_request_settime+0x124/0x160
        handle_send_req+0x19c/0x208
        ipmi_ioctl+0x2c0/0x990
        do_vfs_ioctl+0xb8/0x8f8
        ksys_ioctl+0x80/0xb8
        __arm64_sys_ioctl+0x1c/0x28
        el0_svc_common.constprop.0+0x64/0x160
        el0_svc_handler+0x28/0x78
        el0_svc+0x8/0xc
       Code: 941d1511 aa0003f9 f94006a0 91004001 (b9000034)
       ---[ end trace aa842b86af7069e4 ]---
      
      The problem here is that the host goes away but the associated logical PIO
      region remains registered, as do the children devices.
      
      Fix by adding a .remove method to tidy-up by removing the child devices
      and unregistering the logical PIO region.
      
      Cc: stable@vger.kernel.org
      Fixes: adf38bb0
      
       ("HISI LPC: Support the LPC host on Hip06/Hip07 with DT bindings")
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarWei Xu <xuwei5@hisilicon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6992ae83
    • John Garry's avatar
      bus: hisi_lpc: Unregister logical PIO range to avoid potential use-after-free · 0a6caa4e
      John Garry authored
      commit 1b15a563 upstream.
      
      If, after registering a logical PIO range, the driver probe later fails,
      the logical PIO range memory will be released automatically.
      
      This causes an issue, in that the logical PIO range is not unregistered
      and the released range memory may be later referenced.
      
      Fix by unregistering the logical PIO range.
      
      And since we now unregister the logical PIO range for probe failure, avoid
      the special ordering of setting logical PIO range ops, which was the
      previous (poor) attempt at a safeguard against this.
      
      Cc: stable@vger.kernel.org
      Fixes: adf38bb0
      
       ("HISI LPC: Support the LPC host on Hip06/Hip07 with DT bindings")
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarWei Xu <xuwei5@hisilicon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0a6caa4e
    • Andrew Cooks's avatar
      i2c: piix4: Fix port selection for AMD Family 16h Model 30h · 3e3bf9df
      Andrew Cooks authored
      commit c7c06a15 upstream.
      
      Family 16h Model 30h SMBus controller needs the same port selection fix
      as described and fixed in commit 0fe16195 ("i2c: piix4: Fix SMBus port
      selection for AMD Family 17h chips")
      
      commit 6befa3fd
      
       ("i2c: piix4: Support alternative port selection
      register") also fixed the port selection for Hudson2, but unfortunately
      this is not the exact same device and the AMD naming and PCI Device IDs
      aren't particularly helpful here.
      
      The SMBus port selection register is common to the following Families
      and models, as documented in AMD's publicly available BIOS and Kernel
      Developer Guides:
      
       50742 - Family 15h Model 60h-6Fh (PCI_DEVICE_ID_AMD_KERNCZ_SMBUS)
       55072 - Family 15h Model 70h-7Fh (PCI_DEVICE_ID_AMD_KERNCZ_SMBUS)
       52740 - Family 16h Model 30h-3Fh (PCI_DEVICE_ID_AMD_HUDSON2_SMBUS)
      
      The Hudson2 PCI Device ID (PCI_DEVICE_ID_AMD_HUDSON2_SMBUS) is shared
      between Bolton FCH and Family 16h Model 30h, but the location of the
      SmBus0Sel port selection bits are different:
      
       51192 - Bolton Register Reference Guide
      
      We distinguish between Bolton and Family 16h Model 30h using the PCI
      Revision ID:
      
        Bolton is device 0x780b, revision 0x15
        Family 16h Model 30h is device 0x780b, revision 0x1F
        Family 15h Model 60h and 70h are both device 0x790b, revision 0x4A.
      
      The following additional public AMD BKDG documents were checked and do
      not share the same port selection register:
      
       42301 - Family 15h Model 00h-0Fh doesn't mention any
       42300 - Family 15h Model 10h-1Fh doesn't mention any
       49125 - Family 15h Model 30h-3Fh doesn't mention any
      
       48751 - Family 16h Model 00h-0Fh uses the previously supported
               index register SB800_PIIX4_PORT_IDX_ALT at 0x2e
      
      Signed-off-by: default avatarAndrew Cooks <andrew.cooks@opengear.com>
      Signed-off-by: default avatarJean Delvare <jdelvare@suse.de>
      Cc: stable@vger.kernel.org [v4.6+]
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3e3bf9df
    • Lyude Paul's avatar
      drm/i915: Call dma_set_max_seg_size() in i915_driver_hw_probe() · 71202932
      Lyude Paul authored
      commit 32f0a982 upstream.
      
      Currently, we don't call dma_set_max_seg_size() for i915 because we
      intentionally do not limit the segment length that the device supports.
      However, this results in a warning being emitted if we try to map
      anything larger than SZ_64K on a kernel with CONFIG_DMA_API_DEBUG_SG
      enabled:
      
      [    7.751926] DMA-API: i915 0000:00:02.0: mapping sg segment longer
      than device claims to support [len=98304] [max=65536]
      [    7.751934] WARNING: CPU: 5 PID: 474 at kernel/dma/debug.c:1220
      debug_dma_map_sg+0x20f/0x340
      
      This was originally brought up on
      https://bugs.freedesktop.org/show_bug.cgi?id=108517 , and the consensus
      there was it wasn't really useful to set a limit (and that dma-debug
      isn't really all that useful for i915 in the first place). Unfortunately
      though, CONFIG_DMA_API_DEBUG_SG is enabled in the debug configs for
      various distro kernels. Since a WARN_ON() will disable automatic problem
      reporting (and cause any CI with said option enabled to start
      complaining), we really should just fix the problem.
      
      Note that as me and Chris Wilson discussed, the other solution for this
      would be to make DMA-API not make such assumptions when a driver hasn't
      explicitly set a maximum segment size. But, taking a look at the commit
      which originally introduced this behavior, commit 78c47830
      
      
      ("dma-debug: check scatterlist segments"), there is an explicit mention
      of this assumption and how it applies to devices with no segment size:
      
      	Conversely, devices which are less limited than the rather
      	conservative defaults, or indeed have no limitations at all
      	(e.g. GPUs with their own internal MMU), should be encouraged to
      	set appropriate dma_parms, as they may get more efficient DMA
      	mapping performance out of it.
      
      So unless there's any concerns (I'm open to discussion!), let's just
      follow suite and call dma_set_max_seg_size() with UINT_MAX as our limit
      to silence any warnings.
      
      Changes since v3:
      * Drop patch for enabling CONFIG_DMA_API_DEBUG_SG in CI. It looks like
        just turning it on causes the kernel to spit out bogus WARN_ONs()
        during some igt tests which would otherwise require teaching igt to
        disable the various DMA-API debugging options causing this. This is
        too much work to be worth it, since DMA-API debugging is useless for
        us. So, we'll just settle with this single patch to squelch WARN_ONs()
        during driver load for users that have CONFIG_DMA_API_DEBUG_SG turned
        on for some reason.
      * Move dma_set_max_seg_size() call into i915_driver_hw_probe() - Chris
        Wilson
      
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: <stable@vger.kernel.org> # v4.18+
      Link: https://patchwork.freedesktop.org/patch/msgid/20190823205251.14298-1-lyude@redhat.com
      (cherry picked from commit acd674af
      
      )
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      71202932
    • Xiong Zhang's avatar
      drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest · 0573f44d
      Xiong Zhang authored
      commit 0a3dfbb5 upstream.
      
      The following call trace may exist in linux guest dmesg when guest i915
      driver is unloaded.
      [   90.776610] [drm:vgt_deballoon_space.isra.0 [i915]] deballoon space: range [0x0 - 0x0] 0 KiB.
      [   90.776621] BUG: unable to handle kernel NULL pointer dereference at 00000000000000c0
      [   90.776691] IP: drm_mm_remove_node+0x4d/0x320 [drm]
      [   90.776718] PGD 800000012c7d0067 P4D 800000012c7d0067 PUD 138e4c067 PMD 0
      [   90.777091] task: ffff9adab60f2f00 task.stack: ffffaf39c0fe0000
      [   90.777142] RIP: 0010:drm_mm_remove_node+0x4d/0x320 [drm]
      [   90.777573] Call Trace:
      [   90.777653]  intel_vgt_deballoon+0x4c/0x60 [i915]
      [   90.777729]  i915_ggtt_cleanup_hw+0x121/0x190 [i915]
      [   90.777792]  i915_driver_unload+0x145/0x180 [i915]
      [   90.777856]  i915_pci_remove+0x15/0x20 [i915]
      [   90.777890]  pci_device_remove+0x3b/0xc0
      [   90.777916]  device_release_driver_internal+0x157/0x220
      [   90.777945]  driver_detach+0x39/0x70
      [   90.777967]  bus_remove_driver+0x51/0xd0
      [   90.777990]  pci_unregister_driver+0x23/0x90
      [   90.778019]  SyS_delete_module+0x1da/0x240
      [   90.778045]  entry_SYSCALL_64_fastpath+0x24/0x87
      [   90.778072] RIP: 0033:0x7f34312af067
      [   90.778092] RSP: 002b:00007ffdea3da0d8 EFLAGS: 00000206
      [   90.778297] RIP: drm_mm_remove_node+0x4d/0x320 [drm] RSP: ffffaf39c0fe3dc0
      [   90.778344] ---[ end trace f4b1bc8305fc59dd ]---
      
      Four drm_mm_node are used to reserve guest ggtt space, but some of them
      may be skipped and not initialised due to space constraints in
      intel_vgt_balloon(). If drm_mm_remove_node() is called with
      uninitialized drm_mm_node, the above call trace occurs.
      
      This patch check drm_mm_node's validity before calling
      drm_mm_remove_node().
      
      Fixes: ff8f7975
      
      ("drm/i915: return the correct usable aperture size under gvt environment")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarXiong Zhang <xiong.y.zhang@intel.com>
      Acked-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Link: https://patchwork.freedesktop.org/patch/msgid/1566279978-9659-1-git-send-email-xiong.y.zhang@intel.com
      (cherry picked from commit 4776f352
      
      )
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0573f44d
    • Aaron Liu's avatar
      drm/amdgpu: fix GFXOFF on Picasso and Raven2 · f78e0d81
      Aaron Liu authored
      commit 41940ff5 upstream.
      
      For picasso(adev->pdev->device == 0x15d8)&raven2(adev->rev_id >= 0x8),
      firmware is sufficient to support gfxoff.
      In commit 98f58ada, for picasso&raven2,
      return directly and cause gfxoff disabled.
      
      Fixes: 98f58ada
      
       ("drm/amdgpu/gfx9: update pg_flags after determining if gfx off is possible")
      Reviewed-by: default avatarHuang Rui <ray.huang@amd.com>
      Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarAaron Liu <aaron.liu@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f78e0d81
    • Kai-Heng Feng's avatar
      drm/amdgpu: Add APTX quirk for Dell Latitude 5495 · 4c7ee7bd
      Kai-Heng Feng authored
      commit 317a3aae
      
       upstream.
      
      Needs ATPX rather than _PR3 to really turn off the dGPU. This can save
      ~5W when dGPU is runtime-suspended.
      
      Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4c7ee7bd