From eefa541cd573a1278c0fd7052bcef8dff1dcdf56 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Fri, 5 Feb 2021 07:39:46 -0500 Subject: [PATCH] Fixes for 5.10 Signed-off-by: Sasha Levin --- ...lderlake-p-pci-id-and-hdmi-codec-vid.patch | 52 +++++++ .../alsa-hda-add-cometlake-r-pci-id.patch | 37 +++++ ...da-resume-codec-to-do-jack-detection.patch | 41 ++++++ ...allow-pstate-chnage-when-no-displays.patch | 54 +++++++ ...change-function-decide_dp_link_setti.patch | 45 ++++++ ...fixed-corruptions-on-hpdrx-link-loss.patch | 51 +++++++ ...update-dram_clock_change_latency-for.patch | 45 ++++++ ...use-hardware-sequencer-functions-for.patch | 83 +++++++++++ ...-disable-fw-events-on-device-removal.patch | 42 ++++++ ...backward-compatibility-of-idle-check.patch | 35 +++++ ...dma_addr-passed-to-dma_mmap_coherent.patch | 56 +++++++ ...pci-counters-packet-before-submit-to.patch | 46 ++++++ ...-i2c_writesl_vi-to-use-with-vi-i2c-f.patch | 77 ++++++++++ .../kthread-extract-kthread_is_per_cpu.patch | 111 ++++++++++++++ ...avoid-noinstr-warning-for-debug_lock.patch | 52 +++++++ ...ryption-key-selection-for-802.3-xmit.patch | 69 +++++++++ ...ac80211-fix-fast-rx-encryption-check.patch | 36 +++++ ...ncorrect-strlen-of-.write-in-debugfs.patch | 139 ++++++++++++++++++ ...rinfo-bit-before-deciding-the-host-b.patch | 53 +++++++ ...allow-use-of-cmb-on-v1.4-controllers.patch | 94 ++++++++++++ ...request-double-completion-for-concur.patch | 97 ++++++++++++ ...equest-double-completion-for-concurr.patch | 92 ++++++++++++ ...ght-status-on-error-in-id-ns-handler.patch | 96 ++++++++++++ ...on-t-add-empty-symbols-to-the-rbtree.patch | 63 ++++++++ ...ail-the-kernel-build-on-fatal-errors.patch | 61 ++++++++ ...x-warning-for-missing-regulator_disa.patch | 82 +++++++++++ ...el-vbtn-support-for-tablet-mode-on-d.patch | 41 ++++++ ...nkpad_acpi-add-p53-73-firmware-to-fa.patch | 36 +++++ ...chscreen_dmi-add-swap-x-y-quirk-for-.patch | 85 +++++++++++ ...fix-memleak-in-vnic_dev_init_devcmd2.patch | 58 ++++++++ ...default-timeout-to-avoid-crash-durin.patch | 85 +++++++++++ ...-invoking-response-handler-twice-if-.patch | 95 ++++++++++++ ...ort_srp-don-t-block-target-in-failfa.patch | 45 ++++++ ...rpc-only-test-lwm-stmw-on-big-endian.patch | 61 ++++++++ queue-5.10/series | 40 +++++ ...intel-speed-select-set-higher-of-cpu.patch | 54 +++++++ ...intel-speed-select-set-scaling_max_f.patch | 82 +++++++++++ ...lem-that-the-disc-content-is-not-dis.patch | 74 ++++++++++ ...-restrict-affinity-change-to-rescuer.patch | 58 ++++++++ .../x86-__always_inline-__-rd-wr-msr.patch | 48 ++++++ ...her-alder-lake-cpu-to-the-intel-fami.patch | 35 +++++ 41 files changed, 2606 insertions(+) create mode 100644 queue-5.10/alsa-hda-add-alderlake-p-pci-id-and-hdmi-codec-vid.patch create mode 100644 queue-5.10/alsa-hda-add-cometlake-r-pci-id.patch create mode 100644 queue-5.10/asoc-sof-intel-hda-resume-codec-to-do-jack-detection.patch create mode 100644 queue-5.10/drm-amd-display-allow-pstate-chnage-when-no-displays.patch create mode 100644 queue-5.10/drm-amd-display-change-function-decide_dp_link_setti.patch create mode 100644 queue-5.10/drm-amd-display-fixed-corruptions-on-hpdrx-link-loss.patch create mode 100644 queue-5.10/drm-amd-display-update-dram_clock_change_latency-for.patch create mode 100644 queue-5.10/drm-amd-display-use-hardware-sequencer-functions-for.patch create mode 100644 queue-5.10/habanalabs-disable-fw-events-on-device-removal.patch create mode 100644 queue-5.10/habanalabs-fix-backward-compatibility-of-idle-check.patch create mode 100644 queue-5.10/habanalabs-fix-dma_addr-passed-to-dma_mmap_coherent.patch create mode 100644 queue-5.10/habanalabs-zero-pci-counters-packet-before-submit-to.patch create mode 100644 queue-5.10/i2c-tegra-create-i2c_writesl_vi-to-use-with-vi-i2c-f.patch create mode 100644 queue-5.10/kthread-extract-kthread_is_per_cpu.patch create mode 100644 queue-5.10/locking-lockdep-avoid-noinstr-warning-for-debug_lock.patch create mode 100644 queue-5.10/mac80211-fix-encryption-key-selection-for-802.3-xmit.patch create mode 100644 queue-5.10/mac80211-fix-fast-rx-encryption-check.patch create mode 100644 queue-5.10/mac80211-fix-incorrect-strlen-of-.write-in-debugfs.patch create mode 100644 queue-5.10/nvme-check-the-prinfo-bit-before-deciding-the-host-b.patch create mode 100644 queue-5.10/nvme-pci-allow-use-of-cmb-on-v1.4-controllers.patch create mode 100644 queue-5.10/nvme-rdma-avoid-request-double-completion-for-concur.patch create mode 100644 queue-5.10/nvme-tcp-avoid-request-double-completion-for-concurr.patch create mode 100644 queue-5.10/nvmet-set-right-status-on-error-in-id-ns-handler.patch create mode 100644 queue-5.10/objtool-don-t-add-empty-symbols-to-the-rbtree.patch create mode 100644 queue-5.10/objtool-don-t-fail-the-kernel-build-on-fatal-errors.patch create mode 100644 queue-5.10/phy-cpcap-usb-fix-warning-for-missing-regulator_disa.patch create mode 100644 queue-5.10/platform-x86-intel-vbtn-support-for-tablet-mode-on-d.patch create mode 100644 queue-5.10/platform-x86-thinkpad_acpi-add-p53-73-firmware-to-fa.patch create mode 100644 queue-5.10/platform-x86-touchscreen_dmi-add-swap-x-y-quirk-for-.patch create mode 100644 queue-5.10/scsi-fnic-fix-memleak-in-vnic_dev_init_devcmd2.patch create mode 100644 queue-5.10/scsi-ibmvfc-set-default-timeout-to-avoid-crash-durin.patch create mode 100644 queue-5.10/scsi-libfc-avoid-invoking-response-handler-twice-if-.patch create mode 100644 queue-5.10/scsi-scsi_transport_srp-don-t-block-target-in-failfa.patch create mode 100644 queue-5.10/selftests-powerpc-only-test-lwm-stmw-on-big-endian.patch create mode 100644 queue-5.10/tools-power-x86-intel-speed-select-set-higher-of-cpu.patch create mode 100644 queue-5.10/tools-power-x86-intel-speed-select-set-scaling_max_f.patch create mode 100644 queue-5.10/udf-fix-the-problem-that-the-disc-content-is-not-dis.patch create mode 100644 queue-5.10/workqueue-restrict-affinity-change-to-rescuer.patch create mode 100644 queue-5.10/x86-__always_inline-__-rd-wr-msr.patch create mode 100644 queue-5.10/x86-cpu-add-another-alder-lake-cpu-to-the-intel-fami.patch diff --git a/queue-5.10/alsa-hda-add-alderlake-p-pci-id-and-hdmi-codec-vid.patch b/queue-5.10/alsa-hda-add-alderlake-p-pci-id-and-hdmi-codec-vid.patch new file mode 100644 index 00000000000..44eaf236c0c --- /dev/null +++ b/queue-5.10/alsa-hda-add-alderlake-p-pci-id-and-hdmi-codec-vid.patch @@ -0,0 +1,52 @@ +From abe4f6d481bc5b5165bbcfc8fedace31f1fe3227 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Jan 2021 17:56:29 +0200 +Subject: ALSA: hda: Add AlderLake-P PCI ID and HDMI codec vid + +From: Kai Vehmanen + +[ Upstream commit 5e941fc033e411118fb3a7d9e0b97f8cf702cd39 ] + +Add HD Audio PCI ID and HDMI codec vendor ID for Intel AlderLake-P. + +Signed-off-by: Kai Vehmanen +Reviewed-by: Ranjani Sridharan +Reviewed-by: Pierre-Louis Bossart +Reviewed-by: Guennadi Liakhovetski +Link: https://lore.kernel.org/r/20210113155629.4097057-1-kai.vehmanen@linux.intel.com +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/pci/hda/hda_intel.c | 3 +++ + sound/pci/hda/patch_hdmi.c | 1 + + 2 files changed, 4 insertions(+) + +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c +index 770ad25f1907c..246d660164691 100644 +--- a/sound/pci/hda/hda_intel.c ++++ b/sound/pci/hda/hda_intel.c +@@ -2507,6 +2507,9 @@ static const struct pci_device_id azx_ids[] = { + /* Alderlake-S */ + { PCI_DEVICE(0x8086, 0x7ad0), + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, ++ /* Alderlake-P */ ++ { PCI_DEVICE(0x8086, 0x51c8), ++ .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, + /* Elkhart Lake */ + { PCI_DEVICE(0x8086, 0x4b55), + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, +diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c +index d12b4799c3cb7..dc1ab4fc93a5b 100644 +--- a/sound/pci/hda/patch_hdmi.c ++++ b/sound/pci/hda/patch_hdmi.c +@@ -4349,6 +4349,7 @@ HDA_CODEC_ENTRY(0x8086280f, "Icelake HDMI", patch_i915_icl_hdmi), + HDA_CODEC_ENTRY(0x80862812, "Tigerlake HDMI", patch_i915_tgl_hdmi), + HDA_CODEC_ENTRY(0x80862814, "DG1 HDMI", patch_i915_tgl_hdmi), + HDA_CODEC_ENTRY(0x80862815, "Alderlake HDMI", patch_i915_tgl_hdmi), ++HDA_CODEC_ENTRY(0x8086281c, "Alderlake-P HDMI", patch_i915_tgl_hdmi), + HDA_CODEC_ENTRY(0x80862816, "Rocketlake HDMI", patch_i915_tgl_hdmi), + HDA_CODEC_ENTRY(0x8086281a, "Jasperlake HDMI", patch_i915_icl_hdmi), + HDA_CODEC_ENTRY(0x8086281b, "Elkhartlake HDMI", patch_i915_icl_hdmi), +-- +2.27.0 + diff --git a/queue-5.10/alsa-hda-add-cometlake-r-pci-id.patch b/queue-5.10/alsa-hda-add-cometlake-r-pci-id.patch new file mode 100644 index 00000000000..2923dbaa56c --- /dev/null +++ b/queue-5.10/alsa-hda-add-cometlake-r-pci-id.patch @@ -0,0 +1,37 @@ +From a7bd489405b7dc957e62d85d009cdcf7086a9457 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 15 Jan 2021 11:15:15 +0800 +Subject: ALSA: hda: Add Cometlake-R PCI ID + +From: Kai-Chuan Hsieh + +[ Upstream commit f84d3a1ec375e46a55cc3ba85c04272b24bd3921 ] + +Add HD Audio Device PCI ID for the Intel Cometlake-R platform + +Reviewed-by: Kai Vehmanen +Signed-off-by: Kai-Chuan Hsieh +Link: https://lore.kernel.org/r/20210115031515.13100-1-kaichuan.hsieh@canonical.com +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/pci/hda/hda_intel.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c +index 246d660164691..d393401db1ec5 100644 +--- a/sound/pci/hda/hda_intel.c ++++ b/sound/pci/hda/hda_intel.c +@@ -2484,6 +2484,9 @@ static const struct pci_device_id azx_ids[] = { + /* CometLake-S */ + { PCI_DEVICE(0x8086, 0xa3f0), + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, ++ /* CometLake-R */ ++ { PCI_DEVICE(0x8086, 0xf0c8), ++ .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, + /* Icelake */ + { PCI_DEVICE(0x8086, 0x34c8), + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, +-- +2.27.0 + diff --git a/queue-5.10/asoc-sof-intel-hda-resume-codec-to-do-jack-detection.patch b/queue-5.10/asoc-sof-intel-hda-resume-codec-to-do-jack-detection.patch new file mode 100644 index 00000000000..9ba43e9bdb4 --- /dev/null +++ b/queue-5.10/asoc-sof-intel-hda-resume-codec-to-do-jack-detection.patch @@ -0,0 +1,41 @@ +From 7f094caba6e5240e68a4f175885091c799fc8838 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Jan 2021 02:11:23 +0800 +Subject: ASoC: SOF: Intel: hda: Resume codec to do jack detection + +From: Kai-Heng Feng + +[ Upstream commit bcd7059abc19e6ec5b2260dff6a008fb99c4eef9 ] + +Instead of queueing jackpoll_work, runtime resume the codec to let it +use different jack detection methods based on jackpoll_interval. + +This partially matches SOF driver's behavior with commit a6e7d0a4bdb0 +("ALSA: hda: fix jack detection with Realtek codecs when in D3"), the +difference is SOF unconditionally resumes the codec. + +Signed-off-by: Kai-Heng Feng +Link: https://lore.kernel.org/r/20210112181128.1229827-1-kai.heng.feng@canonical.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/sof/intel/hda-codec.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c +index 8b0ddc4b8227b..8d65004c917a1 100644 +--- a/sound/soc/sof/intel/hda-codec.c ++++ b/sound/soc/sof/intel/hda-codec.c +@@ -93,8 +93,7 @@ void hda_codec_jack_check(struct snd_sof_dev *sdev) + * has been recorded in STATESTS + */ + if (codec->jacktbl.used) +- schedule_delayed_work(&codec->jackpoll_work, +- codec->jackpoll_interval); ++ pm_request_resume(&codec->core.dev); + } + #else + void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev) {} +-- +2.27.0 + diff --git a/queue-5.10/drm-amd-display-allow-pstate-chnage-when-no-displays.patch b/queue-5.10/drm-amd-display-allow-pstate-chnage-when-no-displays.patch new file mode 100644 index 00000000000..54ed72daded --- /dev/null +++ b/queue-5.10/drm-amd-display-allow-pstate-chnage-when-no-displays.patch @@ -0,0 +1,54 @@ +From 7191ee4f9fcfab4743d889fe4671fedcb3f6a8d0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 29 Oct 2020 17:45:19 -0400 +Subject: drm/amd/display: Allow PSTATE chnage when no displays are enabled + +From: Aric Cyr + +[ Upstream commit 8bc3d461d0a95bbcc2a0a908bbadc87e198a86a8 ] + +[Why] +When no displays are currently enabled, display driver should not +disallow PSTATE switching. + +[How] +Allow PSTATE switching if either the active configuration supports it, +or there are no active displays. + +Tested-by: Daniel Wheeler +Signed-off-by: Aric Cyr +Reviewed-by: Jun Lei +Acked-by: Anson Jacob +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + .../gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c +index b0e9b0509568c..95d883482227e 100644 +--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c ++++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c +@@ -239,6 +239,7 @@ static void dcn3_update_clocks(struct clk_mgr *clk_mgr_base, + struct dmcu *dmcu = clk_mgr_base->ctx->dc->res_pool->dmcu; + bool force_reset = false; + bool update_uclk = false; ++ bool p_state_change_support; + + if (dc->work_arounds.skip_clock_update || !clk_mgr->smu_present) + return; +@@ -279,8 +280,9 @@ static void dcn3_update_clocks(struct clk_mgr *clk_mgr_base, + clk_mgr_base->clks.socclk_khz = new_clocks->socclk_khz; + + clk_mgr_base->clks.prev_p_state_change_support = clk_mgr_base->clks.p_state_change_support; +- if (should_update_pstate_support(safe_to_lower, new_clocks->p_state_change_support, clk_mgr_base->clks.p_state_change_support)) { +- clk_mgr_base->clks.p_state_change_support = new_clocks->p_state_change_support; ++ p_state_change_support = new_clocks->p_state_change_support || (display_count == 0); ++ if (should_update_pstate_support(safe_to_lower, p_state_change_support, clk_mgr_base->clks.p_state_change_support)) { ++ clk_mgr_base->clks.p_state_change_support = p_state_change_support; + + /* to disable P-State switching, set UCLK min = max */ + if (!clk_mgr_base->clks.p_state_change_support) +-- +2.27.0 + diff --git a/queue-5.10/drm-amd-display-change-function-decide_dp_link_setti.patch b/queue-5.10/drm-amd-display-change-function-decide_dp_link_setti.patch new file mode 100644 index 00000000000..979b93d86e0 --- /dev/null +++ b/queue-5.10/drm-amd-display-change-function-decide_dp_link_setti.patch @@ -0,0 +1,45 @@ +From a72fc27090d862092ad65be04bd595afb5e58c5b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Jan 2021 14:09:41 -0500 +Subject: drm/amd/display: Change function decide_dp_link_settings to avoid + infinite looping + +From: Bing Guo + +[ Upstream commit 4716a7c50c5c66d6ddc42401e1e0ba13b492e105 ] + +Why: +Function decide_dp_link_settings() loops infinitely when required bandwidth +can't be supported. + +How: +Check the required bandwidth against verified_link_cap before trying to +find a link setting for it. + +Tested-by: Daniel Wheeler +Signed-off-by: Bing Guo +Reviewed-by: Jun Lei +Acked-by: Anson Jacob +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +index 98464886341f6..004e2b32e02fa 100644 +--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c ++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +@@ -2375,6 +2375,9 @@ static bool decide_dp_link_settings(struct dc_link *link, struct dc_link_setting + initial_link_setting; + uint32_t link_bw; + ++ if (req_bw > dc_link_bandwidth_kbps(link, &link->verified_link_cap)) ++ return false; ++ + /* search for the minimum link setting that: + * 1. is supported according to the link training result + * 2. could support the b/w requested by the timing +-- +2.27.0 + diff --git a/queue-5.10/drm-amd-display-fixed-corruptions-on-hpdrx-link-loss.patch b/queue-5.10/drm-amd-display-fixed-corruptions-on-hpdrx-link-loss.patch new file mode 100644 index 00000000000..ac44a395d84 --- /dev/null +++ b/queue-5.10/drm-amd-display-fixed-corruptions-on-hpdrx-link-loss.patch @@ -0,0 +1,51 @@ +From 9a73bd947a476528213bd46ed5657e68ebf519b5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Jan 2021 12:05:26 -0500 +Subject: drm/amd/display: Fixed corruptions on HPDRX link loss restore + +From: Vladimir Stempen + +[ Upstream commit 4b08d8c78360241d270396a9de6eb774e88acd00 ] + +[why] +Heavy corruption or blank screen reported on wake, +with 6k display connected and FEC enabled + +[how] +When Disable/Enable stream for display pipes on HPDRX, +DC should take into account ODM split pipes. + +Tested-by: Daniel Wheeler +Signed-off-by: Vladimir Stempen +Reviewed-by: Aric Cyr +Acked-by: Anson Jacob +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +index 004e2b32e02fa..17e6fd8201395 100644 +--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c ++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +@@ -3023,14 +3023,14 @@ bool dc_link_handle_hpd_rx_irq(struct dc_link *link, union hpd_irq_data *out_hpd + for (i = 0; i < MAX_PIPES; i++) { + pipe_ctx = &link->dc->current_state->res_ctx.pipe_ctx[i]; + if (pipe_ctx && pipe_ctx->stream && !pipe_ctx->stream->dpms_off && +- pipe_ctx->stream->link == link) ++ pipe_ctx->stream->link == link && !pipe_ctx->prev_odm_pipe) + core_link_disable_stream(pipe_ctx); + } + + for (i = 0; i < MAX_PIPES; i++) { + pipe_ctx = &link->dc->current_state->res_ctx.pipe_ctx[i]; + if (pipe_ctx && pipe_ctx->stream && !pipe_ctx->stream->dpms_off && +- pipe_ctx->stream->link == link) ++ pipe_ctx->stream->link == link && !pipe_ctx->prev_odm_pipe) + core_link_enable_stream(link->dc->current_state, pipe_ctx); + } + +-- +2.27.0 + diff --git a/queue-5.10/drm-amd-display-update-dram_clock_change_latency-for.patch b/queue-5.10/drm-amd-display-update-dram_clock_change_latency-for.patch new file mode 100644 index 00000000000..79701fbbf0c --- /dev/null +++ b/queue-5.10/drm-amd-display-update-dram_clock_change_latency-for.patch @@ -0,0 +1,45 @@ +From fb0807a5795809a500c27b65a1fb288831ccd358 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 8 Jan 2021 12:27:51 -0500 +Subject: drm/amd/display: Update dram_clock_change_latency for DCN2.1 + +From: Jake Wang + +[ Upstream commit 901c1ec05ef277ce9d43cb806a225b28b3efe89a ] + +[WHY] +dram clock change latencies get updated using ddr4 latency table, but +does that update does not happen before validation. This value +should not be the default and should be number received from +df for better mode support. +This may cause a PState hang on high refresh panels with short vblanks +such as on 1080p 360hz or 300hz panels. + +[HOW] +Update latency from 23.84 to 11.72. + +Signed-off-by: Sung Lee +Reviewed-by: Tony Cheng +Acked-by: Aurabindo Pillai +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +index e73785e74cba8..20441127783ba 100644 +--- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +@@ -295,7 +295,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_1_soc = { + .num_banks = 8, + .num_chans = 4, + .vmm_page_size_bytes = 4096, +- .dram_clock_change_latency_us = 23.84, ++ .dram_clock_change_latency_us = 11.72, + .return_bus_width_bytes = 64, + .dispclk_dppclk_vco_speed_mhz = 3600, + .xfc_bus_transport_time_us = 4, +-- +2.27.0 + diff --git a/queue-5.10/drm-amd-display-use-hardware-sequencer-functions-for.patch b/queue-5.10/drm-amd-display-use-hardware-sequencer-functions-for.patch new file mode 100644 index 00000000000..57a584284a3 --- /dev/null +++ b/queue-5.10/drm-amd-display-use-hardware-sequencer-functions-for.patch @@ -0,0 +1,83 @@ +From ae8f354bf05d482d21fc573d454bf4d8a84de49e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 13 Dec 2020 10:59:01 -0500 +Subject: drm/amd/display: Use hardware sequencer functions for PG control + +From: Nicholas Kazlauskas + +[ Upstream commit c74f865f14318217350aa33363577cb95b06eb82 ] + +[Why & How] +These can differ per ASIC or not be present. Don't call the dcn20 ones +directly but rather the ones defined by the ASIC init table. + +Tested-by: Daniel Wheeler +Signed-off-by: Nicholas Kazlauskas +Reviewed-by: Eric Yang +Acked-by: Anson Jacob +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 18 ++++++++++++++---- + .../gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 9 +++++++-- + 2 files changed, 21 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +index d0f3bf953d027..0d1e7b56fb395 100644 +--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +@@ -646,8 +646,13 @@ static void power_on_plane( + if (REG(DC_IP_REQUEST_CNTL)) { + REG_SET(DC_IP_REQUEST_CNTL, 0, + IP_REQUEST_EN, 1); +- hws->funcs.dpp_pg_control(hws, plane_id, true); +- hws->funcs.hubp_pg_control(hws, plane_id, true); ++ ++ if (hws->funcs.dpp_pg_control) ++ hws->funcs.dpp_pg_control(hws, plane_id, true); ++ ++ if (hws->funcs.hubp_pg_control) ++ hws->funcs.hubp_pg_control(hws, plane_id, true); ++ + REG_SET(DC_IP_REQUEST_CNTL, 0, + IP_REQUEST_EN, 0); + DC_LOG_DEBUG( +@@ -1079,8 +1084,13 @@ void dcn10_plane_atomic_power_down(struct dc *dc, + if (REG(DC_IP_REQUEST_CNTL)) { + REG_SET(DC_IP_REQUEST_CNTL, 0, + IP_REQUEST_EN, 1); +- hws->funcs.dpp_pg_control(hws, dpp->inst, false); +- hws->funcs.hubp_pg_control(hws, hubp->inst, false); ++ ++ if (hws->funcs.dpp_pg_control) ++ hws->funcs.dpp_pg_control(hws, dpp->inst, false); ++ ++ if (hws->funcs.hubp_pg_control) ++ hws->funcs.hubp_pg_control(hws, hubp->inst, false); ++ + dpp->funcs->dpp_reset(dpp); + REG_SET(DC_IP_REQUEST_CNTL, 0, + IP_REQUEST_EN, 0); +diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +index 01530e686f437..f1e9b3b06b924 100644 +--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +@@ -1069,8 +1069,13 @@ static void dcn20_power_on_plane( + if (REG(DC_IP_REQUEST_CNTL)) { + REG_SET(DC_IP_REQUEST_CNTL, 0, + IP_REQUEST_EN, 1); +- dcn20_dpp_pg_control(hws, pipe_ctx->plane_res.dpp->inst, true); +- dcn20_hubp_pg_control(hws, pipe_ctx->plane_res.hubp->inst, true); ++ ++ if (hws->funcs.dpp_pg_control) ++ hws->funcs.dpp_pg_control(hws, pipe_ctx->plane_res.dpp->inst, true); ++ ++ if (hws->funcs.hubp_pg_control) ++ hws->funcs.hubp_pg_control(hws, pipe_ctx->plane_res.hubp->inst, true); ++ + REG_SET(DC_IP_REQUEST_CNTL, 0, + IP_REQUEST_EN, 0); + DC_LOG_DEBUG( +-- +2.27.0 + diff --git a/queue-5.10/habanalabs-disable-fw-events-on-device-removal.patch b/queue-5.10/habanalabs-disable-fw-events-on-device-removal.patch new file mode 100644 index 00000000000..cbab164f11f --- /dev/null +++ b/queue-5.10/habanalabs-disable-fw-events-on-device-removal.patch @@ -0,0 +1,42 @@ +From 9ebec7b7a17810b61e81a0059dbbced367e91e6f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 18 Jan 2021 21:39:46 +0200 +Subject: habanalabs: disable FW events on device removal + +From: Oded Gabbay + +[ Upstream commit 2dc4a6d79168e7e426e8ddf8e7219c9ffd13b2b1 ] + +When device is removed, we need to make sure the F/W won't send us +any more events because during the remove process we disable the +interrupts. + +Signed-off-by: Oded Gabbay +Signed-off-by: Sasha Levin +--- + drivers/misc/habanalabs/common/device.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c +index 09c328ee65da8..71b3a4d5adc65 100644 +--- a/drivers/misc/habanalabs/common/device.c ++++ b/drivers/misc/habanalabs/common/device.c +@@ -1425,6 +1425,15 @@ void hl_device_fini(struct hl_device *hdev) + } + } + ++ /* Disable PCI access from device F/W so it won't send us additional ++ * interrupts. We disable MSI/MSI-X at the halt_engines function and we ++ * can't have the F/W sending us interrupts after that. We need to ++ * disable the access here because if the device is marked disable, the ++ * message won't be send. Also, in case of heartbeat, the device CPU is ++ * marked as disable so this message won't be sent ++ */ ++ hl_fw_send_pci_access_msg(hdev, CPUCP_PACKET_DISABLE_PCI_ACCESS); ++ + /* Mark device as disabled */ + hdev->disabled = true; + +-- +2.27.0 + diff --git a/queue-5.10/habanalabs-fix-backward-compatibility-of-idle-check.patch b/queue-5.10/habanalabs-fix-backward-compatibility-of-idle-check.patch new file mode 100644 index 00000000000..e01bbcca4c6 --- /dev/null +++ b/queue-5.10/habanalabs-fix-backward-compatibility-of-idle-check.patch @@ -0,0 +1,35 @@ +From b126114e200a5c73b961afc34c193229ebafc633 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 18 Jan 2021 13:19:51 +0200 +Subject: habanalabs: fix backward compatibility of idle check + +From: Oded Gabbay + +[ Upstream commit f8abaf379bfe19600f96ae79a6759eb37039ae05 ] + +Need to take the lower 32 bits of the driver's 64-bit idle mask and put +it in the legacy 32-bit variable that the userspace reads to know the +idle mask. + +Signed-off-by: Oded Gabbay +Signed-off-by: Sasha Levin +--- + drivers/misc/habanalabs/common/habanalabs_ioctl.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/misc/habanalabs/common/habanalabs_ioctl.c b/drivers/misc/habanalabs/common/habanalabs_ioctl.c +index 07317ea491295..35401148969f5 100644 +--- a/drivers/misc/habanalabs/common/habanalabs_ioctl.c ++++ b/drivers/misc/habanalabs/common/habanalabs_ioctl.c +@@ -133,6 +133,8 @@ static int hw_idle(struct hl_device *hdev, struct hl_info_args *args) + + hw_idle.is_idle = hdev->asic_funcs->is_device_idle(hdev, + &hw_idle.busy_engines_mask_ext, NULL); ++ hw_idle.busy_engines_mask = ++ lower_32_bits(hw_idle.busy_engines_mask_ext); + + return copy_to_user(out, &hw_idle, + min((size_t) max_size, sizeof(hw_idle))) ? -EFAULT : 0; +-- +2.27.0 + diff --git a/queue-5.10/habanalabs-fix-dma_addr-passed-to-dma_mmap_coherent.patch b/queue-5.10/habanalabs-fix-dma_addr-passed-to-dma_mmap_coherent.patch new file mode 100644 index 00000000000..53c961c891b --- /dev/null +++ b/queue-5.10/habanalabs-fix-dma_addr-passed-to-dma_mmap_coherent.patch @@ -0,0 +1,56 @@ +From ffa5722aa20016b490bfa087840721939d18df67 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Jan 2021 13:49:38 +0200 +Subject: habanalabs: fix dma_addr passed to dma_mmap_coherent + +From: Oded Gabbay + +[ Upstream commit a9d4ef643430d638de1910377f50e0d492d85a43 ] + +When doing dma_alloc_coherent in the driver, we add a certain hard-coded +offset to the DMA address before returning to the callee function. This +offset is needed when our device use this DMA address to perform +outbound transactions to the host. + +However, if we want to map the DMA'able memory to the user via +dma_mmap_coherent(), we need to pass the original dma address, without +this offset. Otherwise, we will get erronouos mapping. + +Signed-off-by: Oded Gabbay +Signed-off-by: Sasha Levin +--- + drivers/misc/habanalabs/gaudi/gaudi.c | 3 ++- + drivers/misc/habanalabs/goya/goya.c | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c +index ed1bd41262ecd..68f661aca3ff2 100644 +--- a/drivers/misc/habanalabs/gaudi/gaudi.c ++++ b/drivers/misc/habanalabs/gaudi/gaudi.c +@@ -3119,7 +3119,8 @@ static int gaudi_cb_mmap(struct hl_device *hdev, struct vm_area_struct *vma, + vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP | + VM_DONTCOPY | VM_NORESERVE; + +- rc = dma_mmap_coherent(hdev->dev, vma, cpu_addr, dma_addr, size); ++ rc = dma_mmap_coherent(hdev->dev, vma, cpu_addr, ++ (dma_addr - HOST_PHYS_BASE), size); + if (rc) + dev_err(hdev->dev, "dma_mmap_coherent error %d", rc); + +diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c +index 235d47b2420f5..986ed3c072088 100644 +--- a/drivers/misc/habanalabs/goya/goya.c ++++ b/drivers/misc/habanalabs/goya/goya.c +@@ -2675,7 +2675,8 @@ static int goya_cb_mmap(struct hl_device *hdev, struct vm_area_struct *vma, + vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP | + VM_DONTCOPY | VM_NORESERVE; + +- rc = dma_mmap_coherent(hdev->dev, vma, cpu_addr, dma_addr, size); ++ rc = dma_mmap_coherent(hdev->dev, vma, cpu_addr, ++ (dma_addr - HOST_PHYS_BASE), size); + if (rc) + dev_err(hdev->dev, "dma_mmap_coherent error %d", rc); + +-- +2.27.0 + diff --git a/queue-5.10/habanalabs-zero-pci-counters-packet-before-submit-to.patch b/queue-5.10/habanalabs-zero-pci-counters-packet-before-submit-to.patch new file mode 100644 index 00000000000..934f242fdf2 --- /dev/null +++ b/queue-5.10/habanalabs-zero-pci-counters-packet-before-submit-to.patch @@ -0,0 +1,46 @@ +From 6e7f899cd741a92b83c208d08a2b3881bd831f28 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 17 Jan 2021 09:39:37 +0200 +Subject: habanalabs: zero pci counters packet before submit to FW + +From: Ofir Bitton + +[ Upstream commit 9354f1b421f76f8368be13954f87d07bcbd6fffe ] + +Driver does not zero some pci counters packets before sending +to FW. This causes an out of sync PI/CI between driver and FW. + +Signed-off-by: Ofir Bitton +Reviewed-by: Oded Gabbay +Signed-off-by: Oded Gabbay +Signed-off-by: Sasha Levin +--- + drivers/misc/habanalabs/common/firmware_if.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/misc/habanalabs/common/firmware_if.c b/drivers/misc/habanalabs/common/firmware_if.c +index cd41c7ceb0e78..13c6eebd4fa63 100644 +--- a/drivers/misc/habanalabs/common/firmware_if.c ++++ b/drivers/misc/habanalabs/common/firmware_if.c +@@ -385,6 +385,10 @@ int hl_fw_cpucp_pci_counters_get(struct hl_device *hdev, + } + counters->rx_throughput = result; + ++ memset(&pkt, 0, sizeof(pkt)); ++ pkt.ctl = cpu_to_le32(CPUCP_PACKET_PCIE_THROUGHPUT_GET << ++ CPUCP_PKT_CTL_OPCODE_SHIFT); ++ + /* Fetch PCI tx counter */ + pkt.index = cpu_to_le32(cpucp_pcie_throughput_tx); + rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt), +@@ -397,6 +401,7 @@ int hl_fw_cpucp_pci_counters_get(struct hl_device *hdev, + counters->tx_throughput = result; + + /* Fetch PCI replay counter */ ++ memset(&pkt, 0, sizeof(pkt)); + pkt.ctl = cpu_to_le32(CPUCP_PACKET_PCIE_REPLAY_CNT_GET << + CPUCP_PKT_CTL_OPCODE_SHIFT); + +-- +2.27.0 + diff --git a/queue-5.10/i2c-tegra-create-i2c_writesl_vi-to-use-with-vi-i2c-f.patch b/queue-5.10/i2c-tegra-create-i2c_writesl_vi-to-use-with-vi-i2c-f.patch new file mode 100644 index 00000000000..87526ea6801 --- /dev/null +++ b/queue-5.10/i2c-tegra-create-i2c_writesl_vi-to-use-with-vi-i2c-f.patch @@ -0,0 +1,77 @@ +From 72f79a085f6501dcfaeeb83241c6e9c2f7484942 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Jan 2021 11:02:41 -0800 +Subject: i2c: tegra: Create i2c_writesl_vi() to use with VI I2C for filling TX + FIFO + +From: Sowjanya Komatineni + +[ Upstream commit 2f3a0828d46166d4e7df227479ed31766ee67e4a ] + +VI I2C controller has known hardware bug where immediate multiple +writes to TX_FIFO register gets stuck. + +Recommended software work around is to read I2C register after +each write to TX_FIFO register to flush out the data. + +This patch implements this work around for VI I2C controller. + +Signed-off-by: Sowjanya Komatineni +Reviewed-by: Dmitry Osipenko +Acked-by: Thierry Reding +Signed-off-by: Wolfram Sang +Signed-off-by: Sasha Levin +--- + drivers/i2c/busses/i2c-tegra.c | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) + +diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c +index 0727383f49402..8b113ae32dc71 100644 +--- a/drivers/i2c/busses/i2c-tegra.c ++++ b/drivers/i2c/busses/i2c-tegra.c +@@ -326,6 +326,8 @@ static void i2c_writel(struct tegra_i2c_dev *i2c_dev, u32 val, unsigned int reg) + /* read back register to make sure that register writes completed */ + if (reg != I2C_TX_FIFO) + readl_relaxed(i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg)); ++ else if (i2c_dev->is_vi) ++ readl_relaxed(i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, I2C_INT_STATUS)); + } + + static u32 i2c_readl(struct tegra_i2c_dev *i2c_dev, unsigned int reg) +@@ -339,6 +341,21 @@ static void i2c_writesl(struct tegra_i2c_dev *i2c_dev, void *data, + writesl(i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg), data, len); + } + ++static void i2c_writesl_vi(struct tegra_i2c_dev *i2c_dev, void *data, ++ unsigned int reg, unsigned int len) ++{ ++ u32 *data32 = data; ++ ++ /* ++ * VI I2C controller has known hardware bug where writes get stuck ++ * when immediate multiple writes happen to TX_FIFO register. ++ * Recommended software work around is to read I2C register after ++ * each write to TX_FIFO register to flush out the data. ++ */ ++ while (len--) ++ i2c_writel(i2c_dev, *data32++, reg); ++} ++ + static void i2c_readsl(struct tegra_i2c_dev *i2c_dev, void *data, + unsigned int reg, unsigned int len) + { +@@ -811,7 +828,10 @@ static int tegra_i2c_fill_tx_fifo(struct tegra_i2c_dev *i2c_dev) + i2c_dev->msg_buf_remaining = buf_remaining; + i2c_dev->msg_buf = buf + words_to_transfer * BYTES_PER_FIFO_WORD; + +- i2c_writesl(i2c_dev, buf, I2C_TX_FIFO, words_to_transfer); ++ if (i2c_dev->is_vi) ++ i2c_writesl_vi(i2c_dev, buf, I2C_TX_FIFO, words_to_transfer); ++ else ++ i2c_writesl(i2c_dev, buf, I2C_TX_FIFO, words_to_transfer); + + buf += words_to_transfer * BYTES_PER_FIFO_WORD; + } +-- +2.27.0 + diff --git a/queue-5.10/kthread-extract-kthread_is_per_cpu.patch b/queue-5.10/kthread-extract-kthread_is_per_cpu.patch new file mode 100644 index 00000000000..59a454d9f5d --- /dev/null +++ b/queue-5.10/kthread-extract-kthread_is_per_cpu.patch @@ -0,0 +1,111 @@ +From 50a27e15e2050fc6eccecfcec90dab9f84b46f73 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Jan 2021 11:24:04 +0100 +Subject: kthread: Extract KTHREAD_IS_PER_CPU + +From: Peter Zijlstra + +[ Upstream commit ac687e6e8c26181a33270efd1a2e2241377924b0 ] + +There is a need to distinguish geniune per-cpu kthreads from kthreads +that happen to have a single CPU affinity. + +Geniune per-cpu kthreads are kthreads that are CPU affine for +correctness, these will obviously have PF_KTHREAD set, but must also +have PF_NO_SETAFFINITY set, lest userspace modify their affinity and +ruins things. + +However, these two things are not sufficient, PF_NO_SETAFFINITY is +also set on other tasks that have their affinities controlled through +other means, like for instance workqueues. + +Therefore another bit is needed; it turns out kthread_create_per_cpu() +already has such a bit: KTHREAD_IS_PER_CPU, which is used to make +kthread_park()/kthread_unpark() work correctly. + +Expose this flag and remove the implicit setting of it from +kthread_create_on_cpu(); the io_uring usage of it seems dubious at +best. + +Signed-off-by: Peter Zijlstra (Intel) +Reviewed-by: Valentin Schneider +Tested-by: Valentin Schneider +Link: https://lkml.kernel.org/r/20210121103506.557620262@infradead.org +Signed-off-by: Sasha Levin +--- + include/linux/kthread.h | 3 +++ + kernel/kthread.c | 27 ++++++++++++++++++++++++++- + kernel/smpboot.c | 1 + + 3 files changed, 30 insertions(+), 1 deletion(-) + +diff --git a/include/linux/kthread.h b/include/linux/kthread.h +index 65b81e0c494d2..2484ed97e72f5 100644 +--- a/include/linux/kthread.h ++++ b/include/linux/kthread.h +@@ -33,6 +33,9 @@ struct task_struct *kthread_create_on_cpu(int (*threadfn)(void *data), + unsigned int cpu, + const char *namefmt); + ++void kthread_set_per_cpu(struct task_struct *k, int cpu); ++bool kthread_is_per_cpu(struct task_struct *k); ++ + /** + * kthread_run - create and wake a thread. + * @threadfn: the function to run until signal_pending(current). +diff --git a/kernel/kthread.c b/kernel/kthread.c +index 933a625621b8d..5edf7e19ab262 100644 +--- a/kernel/kthread.c ++++ b/kernel/kthread.c +@@ -493,11 +493,36 @@ struct task_struct *kthread_create_on_cpu(int (*threadfn)(void *data), + return p; + kthread_bind(p, cpu); + /* CPU hotplug need to bind once again when unparking the thread. */ +- set_bit(KTHREAD_IS_PER_CPU, &to_kthread(p)->flags); + to_kthread(p)->cpu = cpu; + return p; + } + ++void kthread_set_per_cpu(struct task_struct *k, int cpu) ++{ ++ struct kthread *kthread = to_kthread(k); ++ if (!kthread) ++ return; ++ ++ WARN_ON_ONCE(!(k->flags & PF_NO_SETAFFINITY)); ++ ++ if (cpu < 0) { ++ clear_bit(KTHREAD_IS_PER_CPU, &kthread->flags); ++ return; ++ } ++ ++ kthread->cpu = cpu; ++ set_bit(KTHREAD_IS_PER_CPU, &kthread->flags); ++} ++ ++bool kthread_is_per_cpu(struct task_struct *k) ++{ ++ struct kthread *kthread = to_kthread(k); ++ if (!kthread) ++ return false; ++ ++ return test_bit(KTHREAD_IS_PER_CPU, &kthread->flags); ++} ++ + /** + * kthread_unpark - unpark a thread created by kthread_create(). + * @k: thread created by kthread_create(). +diff --git a/kernel/smpboot.c b/kernel/smpboot.c +index 2efe1e206167c..f25208e8df836 100644 +--- a/kernel/smpboot.c ++++ b/kernel/smpboot.c +@@ -188,6 +188,7 @@ __smpboot_create_thread(struct smp_hotplug_thread *ht, unsigned int cpu) + kfree(td); + return PTR_ERR(tsk); + } ++ kthread_set_per_cpu(tsk, cpu); + /* + * Park the thread so that it could start right on the CPU + * when it is available. +-- +2.27.0 + diff --git a/queue-5.10/locking-lockdep-avoid-noinstr-warning-for-debug_lock.patch b/queue-5.10/locking-lockdep-avoid-noinstr-warning-for-debug_lock.patch new file mode 100644 index 00000000000..aac39a4318a --- /dev/null +++ b/queue-5.10/locking-lockdep-avoid-noinstr-warning-for-debug_lock.patch @@ -0,0 +1,52 @@ +From 4810a2f33b0576f7c4219fcbf5b9fa4375736f41 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Jan 2021 15:36:23 +0100 +Subject: locking/lockdep: Avoid noinstr warning for DEBUG_LOCKDEP + +From: Peter Zijlstra + +[ Upstream commit 77ca93a6b1223e210e58e1000c09d8d420403c94 ] + + vmlinux.o: warning: objtool: lock_is_held_type()+0x60: call to check_flags.part.0() leaves .noinstr.text section + +Signed-off-by: Peter Zijlstra (Intel) +Signed-off-by: Thomas Gleixner +Link: https://lore.kernel.org/r/20210106144017.652218215@infradead.org +Signed-off-by: Sasha Levin +--- + kernel/locking/lockdep.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c +index 02bc5b8f1eb27..bdaf4829098c0 100644 +--- a/kernel/locking/lockdep.c ++++ b/kernel/locking/lockdep.c +@@ -5271,12 +5271,15 @@ static void __lock_unpin_lock(struct lockdep_map *lock, struct pin_cookie cookie + /* + * Check whether we follow the irq-flags state precisely: + */ +-static void check_flags(unsigned long flags) ++static noinstr void check_flags(unsigned long flags) + { + #if defined(CONFIG_PROVE_LOCKING) && defined(CONFIG_DEBUG_LOCKDEP) + if (!debug_locks) + return; + ++ /* Get the warning out.. */ ++ instrumentation_begin(); ++ + if (irqs_disabled_flags(flags)) { + if (DEBUG_LOCKS_WARN_ON(lockdep_hardirqs_enabled())) { + printk("possible reason: unannotated irqs-off.\n"); +@@ -5304,6 +5307,8 @@ static void check_flags(unsigned long flags) + + if (!debug_locks) + print_irqtrace_events(current); ++ ++ instrumentation_end(); + #endif + } + +-- +2.27.0 + diff --git a/queue-5.10/mac80211-fix-encryption-key-selection-for-802.3-xmit.patch b/queue-5.10/mac80211-fix-encryption-key-selection-for-802.3-xmit.patch new file mode 100644 index 00000000000..f6f113c7c6a --- /dev/null +++ b/queue-5.10/mac80211-fix-encryption-key-selection-for-802.3-xmit.patch @@ -0,0 +1,69 @@ +From 3fd55a560d7ceead355021a0de80b0788a9acb82 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 18 Dec 2020 19:47:16 +0100 +Subject: mac80211: fix encryption key selection for 802.3 xmit + +From: Felix Fietkau + +[ Upstream commit b101dd2d22f45d203010b40c739df346a0cbebef ] + +When using WEP, the default unicast key needs to be selected, instead of +the STA PTK. + +Signed-off-by: Felix Fietkau +Link: https://lore.kernel.org/r/20201218184718.93650-4-nbd@nbd.name +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/mac80211/tx.c | 27 +++++++++++++++------------ + 1 file changed, 15 insertions(+), 12 deletions(-) + +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c +index ca1e9de388910..88868bf300513 100644 +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -4278,7 +4278,6 @@ netdev_tx_t ieee80211_subif_start_xmit_8023(struct sk_buff *skb, + struct ethhdr *ehdr = (struct ethhdr *)skb->data; + struct ieee80211_key *key; + struct sta_info *sta; +- bool offload = true; + + if (unlikely(skb->len < ETH_HLEN)) { + kfree_skb(skb); +@@ -4294,18 +4293,22 @@ netdev_tx_t ieee80211_subif_start_xmit_8023(struct sk_buff *skb, + + if (unlikely(IS_ERR_OR_NULL(sta) || !sta->uploaded || + !test_sta_flag(sta, WLAN_STA_AUTHORIZED) || +- sdata->control_port_protocol == ehdr->h_proto)) +- offload = false; +- else if ((key = rcu_dereference(sta->ptk[sta->ptk_idx])) && +- (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) || +- key->conf.cipher == WLAN_CIPHER_SUITE_TKIP)) +- offload = false; +- +- if (offload) +- ieee80211_8023_xmit(sdata, dev, sta, key, skb); +- else +- ieee80211_subif_start_xmit(skb, dev); ++ sdata->control_port_protocol == ehdr->h_proto)) ++ goto skip_offload; ++ ++ key = rcu_dereference(sta->ptk[sta->ptk_idx]); ++ if (!key) ++ key = rcu_dereference(sdata->default_unicast_key); ++ ++ if (key && (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) || ++ key->conf.cipher == WLAN_CIPHER_SUITE_TKIP)) ++ goto skip_offload; ++ ++ ieee80211_8023_xmit(sdata, dev, sta, key, skb); ++ goto out; + ++skip_offload: ++ ieee80211_subif_start_xmit(skb, dev); + out: + rcu_read_unlock(); + +-- +2.27.0 + diff --git a/queue-5.10/mac80211-fix-fast-rx-encryption-check.patch b/queue-5.10/mac80211-fix-fast-rx-encryption-check.patch new file mode 100644 index 00000000000..04f847da5fa --- /dev/null +++ b/queue-5.10/mac80211-fix-fast-rx-encryption-check.patch @@ -0,0 +1,36 @@ +From d3c1907501739d813d93c44e9b444fc595bdbbda Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 18 Dec 2020 19:47:17 +0100 +Subject: mac80211: fix fast-rx encryption check + +From: Felix Fietkau + +[ Upstream commit 622d3b4e39381262da7b18ca1ed1311df227de86 ] + +When using WEP, the default unicast key needs to be selected, instead of +the STA PTK. + +Signed-off-by: Felix Fietkau +Link: https://lore.kernel.org/r/20201218184718.93650-5-nbd@nbd.name +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/mac80211/rx.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c +index 2a5a11f92b03e..98517423b0b76 100644 +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -4191,6 +4191,8 @@ void ieee80211_check_fast_rx(struct sta_info *sta) + + rcu_read_lock(); + key = rcu_dereference(sta->ptk[sta->ptk_idx]); ++ if (!key) ++ key = rcu_dereference(sdata->default_unicast_key); + if (key) { + switch (key->conf.cipher) { + case WLAN_CIPHER_SUITE_TKIP: +-- +2.27.0 + diff --git a/queue-5.10/mac80211-fix-incorrect-strlen-of-.write-in-debugfs.patch b/queue-5.10/mac80211-fix-incorrect-strlen-of-.write-in-debugfs.patch new file mode 100644 index 00000000000..d3e85f4970f --- /dev/null +++ b/queue-5.10/mac80211-fix-incorrect-strlen-of-.write-in-debugfs.patch @@ -0,0 +1,139 @@ +From 976ca7b8a7b7eae1e68e3b93914f775a2174ea53 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Jan 2021 11:20:28 +0800 +Subject: mac80211: fix incorrect strlen of .write in debugfs + +From: Shayne Chen + +[ Upstream commit 6020d534fa012b80c6d13811dc4d2dfedca2e403 ] + +This fixes strlen mismatch problems happening in some .write callbacks +of debugfs. + +When trying to configure airtime_flags in debugfs, an error appeared: +ash: write error: Invalid argument + +The error is returned from kstrtou16() since a wrong length makes it +miss the real end of input string. To fix this, use count as the string +length, and set proper end of string for a char buffer. + +The debug print is shown - airtime_flags_write: count = 2, len = 8, +where the actual length is 2, but "len = strlen(buf)" gets 8. + +Also cleanup the other similar cases for the sake of consistency. + +Signed-off-by: Sujuan Chen +Signed-off-by: Ryder Lee +Signed-off-by: Shayne Chen +Link: https://lore.kernel.org/r/20210112032028.7482-1-shayne.chen@mediatek.com +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/mac80211/debugfs.c | 44 +++++++++++++++++++----------------------- + 1 file changed, 20 insertions(+), 24 deletions(-) + +diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c +index 90470392fdaa7..de5cd3818690c 100644 +--- a/net/mac80211/debugfs.c ++++ b/net/mac80211/debugfs.c +@@ -120,18 +120,17 @@ static ssize_t aqm_write(struct file *file, + { + struct ieee80211_local *local = file->private_data; + char buf[100]; +- size_t len; + +- if (count > sizeof(buf)) ++ if (count >= sizeof(buf)) + return -EINVAL; + + if (copy_from_user(buf, user_buf, count)) + return -EFAULT; + +- buf[sizeof(buf) - 1] = '\0'; +- len = strlen(buf); +- if (len > 0 && buf[len-1] == '\n') +- buf[len-1] = 0; ++ if (count && buf[count - 1] == '\n') ++ buf[count - 1] = '\0'; ++ else ++ buf[count] = '\0'; + + if (sscanf(buf, "fq_limit %u", &local->fq.limit) == 1) + return count; +@@ -177,18 +176,17 @@ static ssize_t airtime_flags_write(struct file *file, + { + struct ieee80211_local *local = file->private_data; + char buf[16]; +- size_t len; + +- if (count > sizeof(buf)) ++ if (count >= sizeof(buf)) + return -EINVAL; + + if (copy_from_user(buf, user_buf, count)) + return -EFAULT; + +- buf[sizeof(buf) - 1] = 0; +- len = strlen(buf); +- if (len > 0 && buf[len - 1] == '\n') +- buf[len - 1] = 0; ++ if (count && buf[count - 1] == '\n') ++ buf[count - 1] = '\0'; ++ else ++ buf[count] = '\0'; + + if (kstrtou16(buf, 0, &local->airtime_flags)) + return -EINVAL; +@@ -237,20 +235,19 @@ static ssize_t aql_txq_limit_write(struct file *file, + { + struct ieee80211_local *local = file->private_data; + char buf[100]; +- size_t len; + u32 ac, q_limit_low, q_limit_high, q_limit_low_old, q_limit_high_old; + struct sta_info *sta; + +- if (count > sizeof(buf)) ++ if (count >= sizeof(buf)) + return -EINVAL; + + if (copy_from_user(buf, user_buf, count)) + return -EFAULT; + +- buf[sizeof(buf) - 1] = 0; +- len = strlen(buf); +- if (len > 0 && buf[len - 1] == '\n') +- buf[len - 1] = 0; ++ if (count && buf[count - 1] == '\n') ++ buf[count - 1] = '\0'; ++ else ++ buf[count] = '\0'; + + if (sscanf(buf, "%u %u %u", &ac, &q_limit_low, &q_limit_high) != 3) + return -EINVAL; +@@ -306,18 +303,17 @@ static ssize_t force_tx_status_write(struct file *file, + { + struct ieee80211_local *local = file->private_data; + char buf[3]; +- size_t len; + +- if (count > sizeof(buf)) ++ if (count >= sizeof(buf)) + return -EINVAL; + + if (copy_from_user(buf, user_buf, count)) + return -EFAULT; + +- buf[sizeof(buf) - 1] = '\0'; +- len = strlen(buf); +- if (len > 0 && buf[len - 1] == '\n') +- buf[len - 1] = 0; ++ if (count && buf[count - 1] == '\n') ++ buf[count - 1] = '\0'; ++ else ++ buf[count] = '\0'; + + if (buf[0] == '0' && buf[1] == '\0') + local->force_tx_status = 0; +-- +2.27.0 + diff --git a/queue-5.10/nvme-check-the-prinfo-bit-before-deciding-the-host-b.patch b/queue-5.10/nvme-check-the-prinfo-bit-before-deciding-the-host-b.patch new file mode 100644 index 00000000000..cf6e01eb24c --- /dev/null +++ b/queue-5.10/nvme-check-the-prinfo-bit-before-deciding-the-host-b.patch @@ -0,0 +1,53 @@ +From ce54327851a81f4f45c2ff87474bf96725bc3369 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 Jan 2021 18:55:07 -0700 +Subject: nvme: check the PRINFO bit before deciding the host buffer length + +From: Revanth Rajashekar + +[ Upstream commit 4d6b1c95b974761c01cbad92321b82232b66d2a2 ] + +According to NVMe spec v1.4, section 8.3.1, the PRINFO bit and +the metadata size play a vital role in deteriming the host buffer size. + +If PRIFNO bit is set and MS==8, the host doesn't add the metadata buffer, +instead the controller adds it. + +Signed-off-by: Revanth Rajashekar +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/core.c | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index 34cb59b2fcd67..4ec5f05dabe1d 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -1489,8 +1489,21 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) + } + + length = (io.nblocks + 1) << ns->lba_shift; +- meta_len = (io.nblocks + 1) * ns->ms; +- metadata = nvme_to_user_ptr(io.metadata); ++ ++ if ((io.control & NVME_RW_PRINFO_PRACT) && ++ ns->ms == sizeof(struct t10_pi_tuple)) { ++ /* ++ * Protection information is stripped/inserted by the ++ * controller. ++ */ ++ if (nvme_to_user_ptr(io.metadata)) ++ return -EINVAL; ++ meta_len = 0; ++ metadata = NULL; ++ } else { ++ meta_len = (io.nblocks + 1) * ns->ms; ++ metadata = nvme_to_user_ptr(io.metadata); ++ } + + if (ns->features & NVME_NS_EXT_LBAS) { + length += meta_len; +-- +2.27.0 + diff --git a/queue-5.10/nvme-pci-allow-use-of-cmb-on-v1.4-controllers.patch b/queue-5.10/nvme-pci-allow-use-of-cmb-on-v1.4-controllers.patch new file mode 100644 index 00000000000..d12c363be69 --- /dev/null +++ b/queue-5.10/nvme-pci-allow-use-of-cmb-on-v1.4-controllers.patch @@ -0,0 +1,94 @@ +From d3fc6beac8837232133dce28d752829a53750615 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 15 Jan 2021 07:30:46 +0100 +Subject: nvme-pci: allow use of cmb on v1.4 controllers + +From: Klaus Jensen + +[ Upstream commit 20d3bb92e84d417b0494a3b6867f0c86713db257 ] + +Since NVMe v1.4 the Controller Memory Buffer must be explicitly enabled +by the host. + +Signed-off-by: Klaus Jensen +[hch: avoid a local variable and add a comment] +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/pci.c | 14 ++++++++++++++ + include/linux/nvme.h | 6 ++++++ + 2 files changed, 20 insertions(+) + +diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c +index 77f615568194d..a3486c1c27f0c 100644 +--- a/drivers/nvme/host/pci.c ++++ b/drivers/nvme/host/pci.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -1825,6 +1826,9 @@ static void nvme_map_cmb(struct nvme_dev *dev) + if (dev->cmb_size) + return; + ++ if (NVME_CAP_CMBS(dev->ctrl.cap)) ++ writel(NVME_CMBMSC_CRE, dev->bar + NVME_REG_CMBMSC); ++ + dev->cmbsz = readl(dev->bar + NVME_REG_CMBSZ); + if (!dev->cmbsz) + return; +@@ -1838,6 +1842,16 @@ static void nvme_map_cmb(struct nvme_dev *dev) + if (offset > bar_size) + return; + ++ /* ++ * Tell the controller about the host side address mapping the CMB, ++ * and enable CMB decoding for the NVMe 1.4+ scheme: ++ */ ++ if (NVME_CAP_CMBS(dev->ctrl.cap)) { ++ hi_lo_writeq(NVME_CMBMSC_CRE | NVME_CMBMSC_CMSE | ++ (pci_bus_address(pdev, bar) + offset), ++ dev->bar + NVME_REG_CMBMSC); ++ } ++ + /* + * Controllers may support a CMB size larger than their BAR, + * for example, due to being behind a bridge. Reduce the CMB to +diff --git a/include/linux/nvme.h b/include/linux/nvme.h +index d925359976873..bfed36e342ccb 100644 +--- a/include/linux/nvme.h ++++ b/include/linux/nvme.h +@@ -116,6 +116,9 @@ enum { + NVME_REG_BPMBL = 0x0048, /* Boot Partition Memory Buffer + * Location + */ ++ NVME_REG_CMBMSC = 0x0050, /* Controller Memory Buffer Memory ++ * Space Control ++ */ + NVME_REG_PMRCAP = 0x0e00, /* Persistent Memory Capabilities */ + NVME_REG_PMRCTL = 0x0e04, /* Persistent Memory Region Control */ + NVME_REG_PMRSTS = 0x0e08, /* Persistent Memory Region Status */ +@@ -135,6 +138,7 @@ enum { + #define NVME_CAP_CSS(cap) (((cap) >> 37) & 0xff) + #define NVME_CAP_MPSMIN(cap) (((cap) >> 48) & 0xf) + #define NVME_CAP_MPSMAX(cap) (((cap) >> 52) & 0xf) ++#define NVME_CAP_CMBS(cap) (((cap) >> 57) & 0x1) + + #define NVME_CMB_BIR(cmbloc) ((cmbloc) & 0x7) + #define NVME_CMB_OFST(cmbloc) (((cmbloc) >> 12) & 0xfffff) +@@ -192,6 +196,8 @@ enum { + NVME_CSTS_SHST_OCCUR = 1 << 2, + NVME_CSTS_SHST_CMPLT = 2 << 2, + NVME_CSTS_SHST_MASK = 3 << 2, ++ NVME_CMBMSC_CRE = 1 << 0, ++ NVME_CMBMSC_CMSE = 1 << 1, + }; + + struct nvme_id_power_state { +-- +2.27.0 + diff --git a/queue-5.10/nvme-rdma-avoid-request-double-completion-for-concur.patch b/queue-5.10/nvme-rdma-avoid-request-double-completion-for-concur.patch new file mode 100644 index 00000000000..14800430832 --- /dev/null +++ b/queue-5.10/nvme-rdma-avoid-request-double-completion-for-concur.patch @@ -0,0 +1,97 @@ +From f97a5516db0e0c3b318e6ced5b0bfbdf4212d967 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 Jan 2021 17:09:25 +0800 +Subject: nvme-rdma: avoid request double completion for concurrent + nvme_rdma_timeout + +From: Chao Leng + +[ Upstream commit 7674073b2ed35ac951a49c425dec6b39d5a57140 ] + +A crash happens when inject completing request long time(nearly 30s). +Each name space has a request queue, when inject completing request long +time, multi request queues may have time out requests at the same time, +nvme_rdma_timeout will execute concurrently. Multi requests in different +request queues may be queued in the same rdma queue, multi +nvme_rdma_timeout may call nvme_rdma_stop_queue at the same time. +The first nvme_rdma_timeout will clear NVME_RDMA_Q_LIVE and continue +stopping the rdma queue(drain qp), but the others check NVME_RDMA_Q_LIVE +is already cleared, and then directly complete the requests, complete +request before the qp is fully drained may lead to a use-after-free +condition. + +Add a multex lock to serialize nvme_rdma_stop_queue. + +Signed-off-by: Chao Leng +Tested-by: Israel Rukshin +Reviewed-by: Israel Rukshin +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/rdma.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c +index 65e3d0ef36e1a..493ed7ba86ed2 100644 +--- a/drivers/nvme/host/rdma.c ++++ b/drivers/nvme/host/rdma.c +@@ -97,6 +97,7 @@ struct nvme_rdma_queue { + struct completion cm_done; + bool pi_support; + int cq_size; ++ struct mutex queue_lock; + }; + + struct nvme_rdma_ctrl { +@@ -579,6 +580,7 @@ static int nvme_rdma_alloc_queue(struct nvme_rdma_ctrl *ctrl, + int ret; + + queue = &ctrl->queues[idx]; ++ mutex_init(&queue->queue_lock); + queue->ctrl = ctrl; + if (idx && ctrl->ctrl.max_integrity_segments) + queue->pi_support = true; +@@ -598,7 +600,8 @@ static int nvme_rdma_alloc_queue(struct nvme_rdma_ctrl *ctrl, + if (IS_ERR(queue->cm_id)) { + dev_info(ctrl->ctrl.device, + "failed to create CM ID: %ld\n", PTR_ERR(queue->cm_id)); +- return PTR_ERR(queue->cm_id); ++ ret = PTR_ERR(queue->cm_id); ++ goto out_destroy_mutex; + } + + if (ctrl->ctrl.opts->mask & NVMF_OPT_HOST_TRADDR) +@@ -628,6 +631,8 @@ static int nvme_rdma_alloc_queue(struct nvme_rdma_ctrl *ctrl, + out_destroy_cm_id: + rdma_destroy_id(queue->cm_id); + nvme_rdma_destroy_queue_ib(queue); ++out_destroy_mutex: ++ mutex_destroy(&queue->queue_lock); + return ret; + } + +@@ -639,9 +644,10 @@ static void __nvme_rdma_stop_queue(struct nvme_rdma_queue *queue) + + static void nvme_rdma_stop_queue(struct nvme_rdma_queue *queue) + { +- if (!test_and_clear_bit(NVME_RDMA_Q_LIVE, &queue->flags)) +- return; +- __nvme_rdma_stop_queue(queue); ++ mutex_lock(&queue->queue_lock); ++ if (test_and_clear_bit(NVME_RDMA_Q_LIVE, &queue->flags)) ++ __nvme_rdma_stop_queue(queue); ++ mutex_unlock(&queue->queue_lock); + } + + static void nvme_rdma_free_queue(struct nvme_rdma_queue *queue) +@@ -651,6 +657,7 @@ static void nvme_rdma_free_queue(struct nvme_rdma_queue *queue) + + nvme_rdma_destroy_queue_ib(queue); + rdma_destroy_id(queue->cm_id); ++ mutex_destroy(&queue->queue_lock); + } + + static void nvme_rdma_free_io_queues(struct nvme_rdma_ctrl *ctrl) +-- +2.27.0 + diff --git a/queue-5.10/nvme-tcp-avoid-request-double-completion-for-concurr.patch b/queue-5.10/nvme-tcp-avoid-request-double-completion-for-concurr.patch new file mode 100644 index 00000000000..4dc670ff86a --- /dev/null +++ b/queue-5.10/nvme-tcp-avoid-request-double-completion-for-concurr.patch @@ -0,0 +1,92 @@ +From 16c2d89243453073effc79163957c3adf9043f56 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 Jan 2021 17:09:26 +0800 +Subject: nvme-tcp: avoid request double completion for concurrent + nvme_tcp_timeout + +From: Chao Leng + +[ Upstream commit 9ebbfe495ecd2e51bc92ac21ed5817c3b9e223ce ] + +Each name space has a request queue, if complete request long time, +multi request queues may have time out requests at the same time, +nvme_tcp_timeout will execute concurrently. Multi requests in different +request queues may be queued in the same tcp queue, multi +nvme_tcp_timeout may call nvme_tcp_stop_queue at the same time. +The first nvme_tcp_stop_queue will clear NVME_TCP_Q_LIVE and continue +stopping the tcp queue(cancel io_work), but the others check +NVME_TCP_Q_LIVE is already cleared, and then directly complete the +requests, complete request before the io work is completely canceled may +lead to a use-after-free condition. +Add a multex lock to serialize nvme_tcp_stop_queue. + +Signed-off-by: Chao Leng +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/tcp.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c +index 81db2331f6d78..6487b7897d1fb 100644 +--- a/drivers/nvme/host/tcp.c ++++ b/drivers/nvme/host/tcp.c +@@ -76,6 +76,7 @@ struct nvme_tcp_queue { + struct work_struct io_work; + int io_cpu; + ++ struct mutex queue_lock; + struct mutex send_mutex; + struct llist_head req_list; + struct list_head send_list; +@@ -1219,6 +1220,7 @@ static void nvme_tcp_free_queue(struct nvme_ctrl *nctrl, int qid) + + sock_release(queue->sock); + kfree(queue->pdu); ++ mutex_destroy(&queue->queue_lock); + } + + static int nvme_tcp_init_connection(struct nvme_tcp_queue *queue) +@@ -1380,6 +1382,7 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, + struct nvme_tcp_queue *queue = &ctrl->queues[qid]; + int ret, rcv_pdu_size; + ++ mutex_init(&queue->queue_lock); + queue->ctrl = ctrl; + init_llist_head(&queue->req_list); + INIT_LIST_HEAD(&queue->send_list); +@@ -1398,7 +1401,7 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, + if (ret) { + dev_err(nctrl->device, + "failed to create socket: %d\n", ret); +- return ret; ++ goto err_destroy_mutex; + } + + /* Single syn retry */ +@@ -1507,6 +1510,8 @@ err_crypto: + err_sock: + sock_release(queue->sock); + queue->sock = NULL; ++err_destroy_mutex: ++ mutex_destroy(&queue->queue_lock); + return ret; + } + +@@ -1534,9 +1539,10 @@ static void nvme_tcp_stop_queue(struct nvme_ctrl *nctrl, int qid) + struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl); + struct nvme_tcp_queue *queue = &ctrl->queues[qid]; + +- if (!test_and_clear_bit(NVME_TCP_Q_LIVE, &queue->flags)) +- return; +- __nvme_tcp_stop_queue(queue); ++ mutex_lock(&queue->queue_lock); ++ if (test_and_clear_bit(NVME_TCP_Q_LIVE, &queue->flags)) ++ __nvme_tcp_stop_queue(queue); ++ mutex_unlock(&queue->queue_lock); + } + + static int nvme_tcp_start_queue(struct nvme_ctrl *nctrl, int idx) +-- +2.27.0 + diff --git a/queue-5.10/nvmet-set-right-status-on-error-in-id-ns-handler.patch b/queue-5.10/nvmet-set-right-status-on-error-in-id-ns-handler.patch new file mode 100644 index 00000000000..e491c5581c0 --- /dev/null +++ b/queue-5.10/nvmet-set-right-status-on-error-in-id-ns-handler.patch @@ -0,0 +1,96 @@ +From 2078c26647b256d4775cd2ebb3d28dec8126d24b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Jan 2021 17:33:51 -0800 +Subject: nvmet: set right status on error in id-ns handler + +From: Chaitanya Kulkarni + +[ Upstream commit bffcd507780ea614b5543c66f2e37ce0d55cd449 ] + +The function nvmet_execute_identify_ns() doesn't set the status if call +to nvmet_find_namespace() fails. In that case we set the status of the +request to the value return by the nvmet_copy_sgl(). + +Set the status to NVME_SC_INVALID_NS and adjust the code such that +request will have the right status on nvmet_find_namespace() failure. + +Without this patch :- +NVME Identify Namespace 3: +nsze : 0 +ncap : 0 +nuse : 0 +nsfeat : 0 +nlbaf : 0 +flbas : 0 +mc : 0 +dpc : 0 +dps : 0 +nmic : 0 +rescap : 0 +fpi : 0 +dlfeat : 0 +nawun : 0 +nawupf : 0 +nacwu : 0 +nabsn : 0 +nabo : 0 +nabspf : 0 +noiob : 0 +nvmcap : 0 +mssrl : 0 +mcl : 0 +msrc : 0 +nsattr : 0 +nvmsetid: 0 +anagrpid: 0 +endgid : 0 +nguid : 00000000000000000000000000000000 +eui64 : 0000000000000000 +lbaf 0 : ms:0 lbads:0 rp:0 (in use) + +With this patch-series :- +feb3b88b501e (HEAD -> nvme-5.11) nvmet: remove extra variable in identify ns +6302aa67210a nvmet: remove extra variable in id-desclist +ed57951da453 nvmet: remove extra variable in smart log nsid +be384b8c24dc nvmet: set right status on error in id-ns handler + +NVMe status: INVALID_NS: The namespace or the format of that namespace is invalid(0xb) + +Signed-off-by: Chaitanya Kulkarni +Reviewed-by: Sagi Grimberg +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/target/admin-cmd.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c +index dca34489a1dc9..92ca23bc8dbfc 100644 +--- a/drivers/nvme/target/admin-cmd.c ++++ b/drivers/nvme/target/admin-cmd.c +@@ -487,8 +487,10 @@ static void nvmet_execute_identify_ns(struct nvmet_req *req) + + /* return an all zeroed buffer if we can't find an active namespace */ + ns = nvmet_find_namespace(ctrl, req->cmd->identify.nsid); +- if (!ns) ++ if (!ns) { ++ status = NVME_SC_INVALID_NS; + goto done; ++ } + + nvmet_ns_revalidate(ns); + +@@ -541,7 +543,9 @@ static void nvmet_execute_identify_ns(struct nvmet_req *req) + id->nsattr |= (1 << 0); + nvmet_put_namespace(ns); + done: +- status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id)); ++ if (!status) ++ status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id)); ++ + kfree(id); + out: + nvmet_req_complete(req, status); +-- +2.27.0 + diff --git a/queue-5.10/objtool-don-t-add-empty-symbols-to-the-rbtree.patch b/queue-5.10/objtool-don-t-add-empty-symbols-to-the-rbtree.patch new file mode 100644 index 00000000000..0f9b9054022 --- /dev/null +++ b/queue-5.10/objtool-don-t-add-empty-symbols-to-the-rbtree.patch @@ -0,0 +1,63 @@ +From c13297973c3383eb0615d7b75afe8162f9cf2ff4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 5 Jan 2021 18:04:20 -0600 +Subject: objtool: Don't add empty symbols to the rbtree + +From: Josh Poimboeuf + +[ Upstream commit a2e38dffcd93541914aba52b30c6a52acca35201 ] + +Building with the Clang assembler shows the following warning: + + arch/x86/kernel/ftrace_64.o: warning: objtool: missing symbol for insn at offset 0x16 + +The Clang assembler strips section symbols. That ends up giving +objtool's find_func_containing() much more test coverage than normal. +Turns out, find_func_containing() doesn't work so well for overlapping +symbols: + + 2: 000000000000000e 0 NOTYPE LOCAL DEFAULT 2 fgraph_trace + 3: 000000000000000f 0 NOTYPE LOCAL DEFAULT 2 trace + 4: 0000000000000000 165 FUNC GLOBAL DEFAULT 2 __fentry__ + 5: 000000000000000e 0 NOTYPE GLOBAL DEFAULT 2 ftrace_stub + +The zero-length NOTYPE symbols are inside __fentry__(), confusing the +rbtree search for any __fentry__() offset coming after a NOTYPE. + +Try to avoid this problem by not adding zero-length symbols to the +rbtree. They're rare and aren't needed in the rbtree anyway. + +One caveat, this actually might not end up being the right fix. +Non-empty overlapping symbols, if they exist, could have the same +problem. But that would need bigger changes, let's see if we can get +away with the easy fix for now. + +Reported-by: Arnd Bergmann +Acked-by: Peter Zijlstra (Intel) +Signed-off-by: Josh Poimboeuf +Signed-off-by: Sasha Levin +--- + tools/objtool/elf.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c +index 9452cfb01ef19..f4f3e8d995930 100644 +--- a/tools/objtool/elf.c ++++ b/tools/objtool/elf.c +@@ -425,6 +425,13 @@ static int read_symbols(struct elf *elf) + list_add(&sym->list, entry); + elf_hash_add(elf->symbol_hash, &sym->hash, sym->idx); + elf_hash_add(elf->symbol_name_hash, &sym->name_hash, str_hash(sym->name)); ++ ++ /* ++ * Don't store empty STT_NOTYPE symbols in the rbtree. They ++ * can exist within a function, confusing the sorting. ++ */ ++ if (!sym->len) ++ rb_erase(&sym->node, &sym->sec->symbol_tree); + } + + if (stats) +-- +2.27.0 + diff --git a/queue-5.10/objtool-don-t-fail-the-kernel-build-on-fatal-errors.patch b/queue-5.10/objtool-don-t-fail-the-kernel-build-on-fatal-errors.patch new file mode 100644 index 00000000000..af55896256a --- /dev/null +++ b/queue-5.10/objtool-don-t-fail-the-kernel-build-on-fatal-errors.patch @@ -0,0 +1,61 @@ +From aa7f60fdca6a1aa7a1d900a7df9dd6fd20d50639 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 Jan 2021 16:32:42 -0600 +Subject: objtool: Don't fail the kernel build on fatal errors + +From: Josh Poimboeuf + +[ Upstream commit 655cf86548a3938538642a6df27dd359e13c86bd ] + +This is basically a revert of commit 644592d32837 ("objtool: Fail the +kernel build on fatal errors"). + +That change turned out to be more trouble than it's worth. Failing the +build is an extreme measure which sometimes gets too much attention and +blocks CI build testing. + +These fatal-type warnings aren't yet as rare as we'd hope, due to the +ever-increasing matrix of supported toolchains/plugins and their +fast-changing nature as of late. + +Also, there are more people (and bots) looking for objtool warnings than +ever before, so even non-fatal warnings aren't likely to be ignored for +long. + +Suggested-by: Nick Desaulniers +Reviewed-by: Miroslav Benes +Reviewed-by: Nick Desaulniers +Reviewed-by: Kamalesh Babulal +Signed-off-by: Josh Poimboeuf +Signed-off-by: Sasha Levin +--- + tools/objtool/check.c | 14 +++++--------- + 1 file changed, 5 insertions(+), 9 deletions(-) + +diff --git a/tools/objtool/check.c b/tools/objtool/check.c +index c6ab44543c92a..956383d5fa62e 100644 +--- a/tools/objtool/check.c ++++ b/tools/objtool/check.c +@@ -2921,14 +2921,10 @@ int check(struct objtool_file *file) + warnings += ret; + + out: +- if (ret < 0) { +- /* +- * Fatal error. The binary is corrupt or otherwise broken in +- * some way, or objtool itself is broken. Fail the kernel +- * build. +- */ +- return ret; +- } +- ++ /* ++ * For now, don't fail the kernel build on fatal warnings. These ++ * errors are still fairly common due to the growing matrix of ++ * supported toolchains and their recent pace of change. ++ */ + return 0; + } +-- +2.27.0 + diff --git a/queue-5.10/phy-cpcap-usb-fix-warning-for-missing-regulator_disa.patch b/queue-5.10/phy-cpcap-usb-fix-warning-for-missing-regulator_disa.patch new file mode 100644 index 00000000000..45d6fc12c7f --- /dev/null +++ b/queue-5.10/phy-cpcap-usb-fix-warning-for-missing-regulator_disa.patch @@ -0,0 +1,82 @@ +From 311816eef5c6607f367dd56a79c68dac5340b0e6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 30 Dec 2020 12:21:05 +0200 +Subject: phy: cpcap-usb: Fix warning for missing regulator_disable + +From: Tony Lindgren + +[ Upstream commit 764257d9069a9c19758b626cc1ba4ae079335d9e ] + +On deferred probe, we will get the following splat: + +cpcap-usb-phy cpcap-usb-phy.0: could not initialize VBUS or ID IIO: -517 +WARNING: CPU: 0 PID: 21 at drivers/regulator/core.c:2123 regulator_put+0x68/0x78 +... +(regulator_put) from [] (release_nodes+0x1b4/0x1fc) +(release_nodes) from [] (really_probe+0x104/0x4a0) +(really_probe) from [] (driver_probe_device+0x58/0xb4) + +Signed-off-by: Tony Lindgren +Link: https://lore.kernel.org/r/20201230102105.11826-1-tony@atomide.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/phy/motorola/phy-cpcap-usb.c | 19 +++++++++++++------ + 1 file changed, 13 insertions(+), 6 deletions(-) + +diff --git a/drivers/phy/motorola/phy-cpcap-usb.c b/drivers/phy/motorola/phy-cpcap-usb.c +index 442522ba487f0..4728e2bff6620 100644 +--- a/drivers/phy/motorola/phy-cpcap-usb.c ++++ b/drivers/phy/motorola/phy-cpcap-usb.c +@@ -662,35 +662,42 @@ static int cpcap_usb_phy_probe(struct platform_device *pdev) + generic_phy = devm_phy_create(ddata->dev, NULL, &ops); + if (IS_ERR(generic_phy)) { + error = PTR_ERR(generic_phy); +- return PTR_ERR(generic_phy); ++ goto out_reg_disable; + } + + phy_set_drvdata(generic_phy, ddata); + + phy_provider = devm_of_phy_provider_register(ddata->dev, + of_phy_simple_xlate); +- if (IS_ERR(phy_provider)) +- return PTR_ERR(phy_provider); ++ if (IS_ERR(phy_provider)) { ++ error = PTR_ERR(phy_provider); ++ goto out_reg_disable; ++ } + + error = cpcap_usb_init_optional_pins(ddata); + if (error) +- return error; ++ goto out_reg_disable; + + cpcap_usb_init_optional_gpios(ddata); + + error = cpcap_usb_init_iio(ddata); + if (error) +- return error; ++ goto out_reg_disable; + + error = cpcap_usb_init_interrupts(pdev, ddata); + if (error) +- return error; ++ goto out_reg_disable; + + usb_add_phy_dev(&ddata->phy); + atomic_set(&ddata->active, 1); + schedule_delayed_work(&ddata->detect_work, msecs_to_jiffies(1)); + + return 0; ++ ++out_reg_disable: ++ regulator_disable(ddata->vusb); ++ ++ return error; + } + + static int cpcap_usb_phy_remove(struct platform_device *pdev) +-- +2.27.0 + diff --git a/queue-5.10/platform-x86-intel-vbtn-support-for-tablet-mode-on-d.patch b/queue-5.10/platform-x86-intel-vbtn-support-for-tablet-mode-on-d.patch new file mode 100644 index 00000000000..473e32a10b8 --- /dev/null +++ b/queue-5.10/platform-x86-intel-vbtn-support-for-tablet-mode-on-d.patch @@ -0,0 +1,41 @@ +From 6257712ffbc6e08a932c4b93187e7ab7e221ca30 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 26 Dec 2020 15:53:06 -0500 +Subject: platform/x86: intel-vbtn: Support for tablet mode on Dell Inspiron + 7352 + +From: Arnold Gozum + +[ Upstream commit fcd38f178b785623c0325958225744f0d8a075c0 ] + +The Dell Inspiron 7352 is a 2-in-1 model that has chassis-type "Notebook". +Add this model to the dmi_switches_allow_list. + +Signed-off-by: Arnold Gozum +Link: https://lore.kernel.org/r/20201226205307.249659-1-arngozum@gmail.com +Signed-off-by: Hans de Goede +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/intel-vbtn.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c +index 65fb3a3031470..30a9062d2b4b8 100644 +--- a/drivers/platform/x86/intel-vbtn.c ++++ b/drivers/platform/x86/intel-vbtn.c +@@ -216,6 +216,12 @@ static const struct dmi_system_id dmi_switches_allow_list[] = { + DMI_MATCH(DMI_PRODUCT_NAME, "Switch SA5-271"), + }, + }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7352"), ++ }, ++ }, + {} /* Array terminator */ + }; + +-- +2.27.0 + diff --git a/queue-5.10/platform-x86-thinkpad_acpi-add-p53-73-firmware-to-fa.patch b/queue-5.10/platform-x86-thinkpad_acpi-add-p53-73-firmware-to-fa.patch new file mode 100644 index 00000000000..07c2ec97819 --- /dev/null +++ b/queue-5.10/platform-x86-thinkpad_acpi-add-p53-73-firmware-to-fa.patch @@ -0,0 +1,36 @@ +From 6d523f72b59a1decc04a3f9865e70a22ebbc1aaa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 15 Jan 2021 16:06:30 +0000 +Subject: platform/x86: thinkpad_acpi: Add P53/73 firmware to fan_quirk_table + for dual fan control + +From: Jeannie Stevenson + +[ Upstream commit 173aac2fef96972e42d33c0e1189e6f756a0d719 ] + +This commit enables dual fan control for the new Lenovo P53 and P73 +laptop models. + +Signed-off-by: Jeannie Stevenson +Link: https://lore.kernel.org/r/Pn_Xii4XYpQRFtgkf4PbNgieE89BAkHgLI1kWIq-zFudwh2A1DY5J_DJVHK06rMW_hGPHx_mPE33gd8mg9-8BxqJTaSC6hhPqAsfZlcNGH0=@protonmail.com +Signed-off-by: Hans de Goede +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/thinkpad_acpi.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c +index c404706379d92..69402758b99c3 100644 +--- a/drivers/platform/x86/thinkpad_acpi.c ++++ b/drivers/platform/x86/thinkpad_acpi.c +@@ -8782,6 +8782,7 @@ static const struct tpacpi_quirk fan_quirk_table[] __initconst = { + TPACPI_Q_LNV3('N', '1', 'T', TPACPI_FAN_2CTL), /* P71 */ + TPACPI_Q_LNV3('N', '1', 'U', TPACPI_FAN_2CTL), /* P51 */ + TPACPI_Q_LNV3('N', '2', 'C', TPACPI_FAN_2CTL), /* P52 / P72 */ ++ TPACPI_Q_LNV3('N', '2', 'N', TPACPI_FAN_2CTL), /* P53 / P73 */ + TPACPI_Q_LNV3('N', '2', 'E', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (1st gen) */ + TPACPI_Q_LNV3('N', '2', 'O', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (2nd gen) */ + TPACPI_Q_LNV3('N', '2', 'V', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (3nd gen) */ +-- +2.27.0 + diff --git a/queue-5.10/platform-x86-touchscreen_dmi-add-swap-x-y-quirk-for-.patch b/queue-5.10/platform-x86-touchscreen_dmi-add-swap-x-y-quirk-for-.patch new file mode 100644 index 00000000000..3d66a48922f --- /dev/null +++ b/queue-5.10/platform-x86-touchscreen_dmi-add-swap-x-y-quirk-for-.patch @@ -0,0 +1,85 @@ +From b3a85c3b758603228c3a27cc6841653ad5451ac6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 24 Dec 2020 14:51:58 +0100 +Subject: platform/x86: touchscreen_dmi: Add swap-x-y quirk for Goodix + touchscreen on Estar Beauty HD tablet + +From: Hans de Goede + +[ Upstream commit 46c54cf2706122c37497896d56d67b0c0aca2ede ] + +The Estar Beauty HD (MID 7316R) tablet uses a Goodix touchscreen, +with the X and Y coordinates swapped compared to the LCD panel. + +Add a touchscreen_dmi entry for this adding a "touchscreen-swapped-x-y" +device-property to the i2c-client instantiated for this device before +the driver binds. + +This is the first entry of a Goodix touchscreen to touchscreen_dmi.c, +so far DMI quirks for Goodix touchscreen's have been added directly +to drivers/input/touchscreen/goodix.c. Currently there are 3 +DMI tables in goodix.c: +1. rotated_screen[] for devices where the touchscreen is rotated + 180 degrees vs the LCD panel +2. inverted_x_screen[] for devices where the X axis is inverted +3. nine_bytes_report[] for devices which use a non standard touch + report size + +Arguably only 3. really needs to be inside the driver and the other +2 cases are better handled through the generic touchscreen DMI quirk +mechanism from touchscreen_dmi.c, which allows adding device-props to +any i2c-client. Esp. now that goodix.c is using the generic +touchscreen_properties code. + +Alternative to the approach from this patch we could add a 4th +dmi_system_id table for devices with swapped-x-y axis to goodix.c, +but that seems undesirable. + +Cc: Bastien Nocera +Cc: Dmitry Torokhov +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20201224135158.10976-1-hdegoede@redhat.com +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/touchscreen_dmi.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c +index 5783139d0a119..c4de932302d6b 100644 +--- a/drivers/platform/x86/touchscreen_dmi.c ++++ b/drivers/platform/x86/touchscreen_dmi.c +@@ -263,6 +263,16 @@ static const struct ts_dmi_data digma_citi_e200_data = { + .properties = digma_citi_e200_props, + }; + ++static const struct property_entry estar_beauty_hd_props[] = { ++ PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"), ++ { } ++}; ++ ++static const struct ts_dmi_data estar_beauty_hd_data = { ++ .acpi_name = "GDIX1001:00", ++ .properties = estar_beauty_hd_props, ++}; ++ + static const struct property_entry gp_electronic_t701_props[] = { + PROPERTY_ENTRY_U32("touchscreen-size-x", 960), + PROPERTY_ENTRY_U32("touchscreen-size-y", 640), +@@ -942,6 +952,14 @@ const struct dmi_system_id touchscreen_dmi_table[] = { + DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), + }, + }, ++ { ++ /* Estar Beauty HD (MID 7316R) */ ++ .driver_data = (void *)&estar_beauty_hd_data, ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Estar"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "eSTAR BEAUTY HD Intel Quad core"), ++ }, ++ }, + { + /* GP-electronic T701 */ + .driver_data = (void *)&gp_electronic_t701_data, +-- +2.27.0 + diff --git a/queue-5.10/scsi-fnic-fix-memleak-in-vnic_dev_init_devcmd2.patch b/queue-5.10/scsi-fnic-fix-memleak-in-vnic_dev_init_devcmd2.patch new file mode 100644 index 00000000000..55c06616d55 --- /dev/null +++ b/queue-5.10/scsi-fnic-fix-memleak-in-vnic_dev_init_devcmd2.patch @@ -0,0 +1,58 @@ +From fafe60f7d11682fa813ccea0b6838d3c7754069e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 25 Dec 2020 16:35:20 +0800 +Subject: scsi: fnic: Fix memleak in vnic_dev_init_devcmd2 + +From: Dinghao Liu + +[ Upstream commit d6e3ae76728ccde49271d9f5acfebbea0c5625a3 ] + +When ioread32() returns 0xFFFFFFFF, we should execute cleanup functions +like other error handling paths before returning. + +Link: https://lore.kernel.org/r/20201225083520.22015-1-dinghao.liu@zju.edu.cn +Acked-by: Karan Tilak Kumar +Signed-off-by: Dinghao Liu +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/fnic/vnic_dev.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/drivers/scsi/fnic/vnic_dev.c b/drivers/scsi/fnic/vnic_dev.c +index a2beee6e09f06..5988c300cc82e 100644 +--- a/drivers/scsi/fnic/vnic_dev.c ++++ b/drivers/scsi/fnic/vnic_dev.c +@@ -444,7 +444,8 @@ static int vnic_dev_init_devcmd2(struct vnic_dev *vdev) + fetch_index = ioread32(&vdev->devcmd2->wq.ctrl->fetch_index); + if (fetch_index == 0xFFFFFFFF) { /* check for hardware gone */ + pr_err("error in devcmd2 init"); +- return -ENODEV; ++ err = -ENODEV; ++ goto err_free_wq; + } + + /* +@@ -460,7 +461,7 @@ static int vnic_dev_init_devcmd2(struct vnic_dev *vdev) + err = vnic_dev_alloc_desc_ring(vdev, &vdev->devcmd2->results_ring, + DEVCMD2_RING_SIZE, DEVCMD2_DESC_SIZE); + if (err) +- goto err_free_wq; ++ goto err_disable_wq; + + vdev->devcmd2->result = + (struct devcmd2_result *) vdev->devcmd2->results_ring.descs; +@@ -481,8 +482,9 @@ static int vnic_dev_init_devcmd2(struct vnic_dev *vdev) + + err_free_desc_ring: + vnic_dev_free_desc_ring(vdev, &vdev->devcmd2->results_ring); +-err_free_wq: ++err_disable_wq: + vnic_wq_disable(&vdev->devcmd2->wq); ++err_free_wq: + vnic_wq_free(&vdev->devcmd2->wq); + err_free_devcmd2: + kfree(vdev->devcmd2); +-- +2.27.0 + diff --git a/queue-5.10/scsi-ibmvfc-set-default-timeout-to-avoid-crash-durin.patch b/queue-5.10/scsi-ibmvfc-set-default-timeout-to-avoid-crash-durin.patch new file mode 100644 index 00000000000..8bee96b242e --- /dev/null +++ b/queue-5.10/scsi-ibmvfc-set-default-timeout-to-avoid-crash-durin.patch @@ -0,0 +1,85 @@ +From 907d6e40c1fc4248a3b6d40147c6368e48a9de22 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Jan 2021 09:06:38 -0600 +Subject: scsi: ibmvfc: Set default timeout to avoid crash during migration + +From: Brian King + +[ Upstream commit 764907293edc1af7ac857389af9dc858944f53dc ] + +While testing live partition mobility, we have observed occasional crashes +of the Linux partition. What we've seen is that during the live migration, +for specific configurations with large amounts of memory, slow network +links, and workloads that are changing memory a lot, the partition can end +up being suspended for 30 seconds or longer. This resulted in the following +scenario: + +CPU 0 CPU 1 +------------------------------- ---------------------------------- +scsi_queue_rq migration_store + -> blk_mq_start_request -> rtas_ibm_suspend_me + -> blk_add_timer -> on_each_cpu(rtas_percpu_suspend_me + _______________________________________V + | + V + -> IPI from CPU 1 + -> rtas_percpu_suspend_me + -> __rtas_suspend_last_cpu + +-- Linux partition suspended for > 30 seconds -- + -> for_each_online_cpu(cpu) + plpar_hcall_norets(H_PROD + -> scsi_dispatch_cmd + -> scsi_times_out + -> scsi_abort_command + -> queue_delayed_work + -> ibmvfc_queuecommand_lck + -> ibmvfc_send_event + -> ibmvfc_send_crq + - returns H_CLOSED + <- returns SCSI_MLQUEUE_HOST_BUSY +-> __blk_mq_requeue_request + + -> scmd_eh_abort_handler + -> scsi_try_to_abort_cmd + - returns SUCCESS + -> scsi_queue_insert + +Normally, the SCMD_STATE_COMPLETE bit would protect against the command +completion and the timeout, but that doesn't work here, since we don't +check that at all in the SCSI_MLQUEUE_HOST_BUSY path. + +In this case we end up calling scsi_queue_insert on a request that has +already been queued, or possibly even freed, and we crash. + +The patch below simply increases the default I/O timeout to avoid this race +condition. This is also the timeout value that nearly all IBM SAN storage +recommends setting as the default value. + +Link: https://lore.kernel.org/r/1610463998-19791-1-git-send-email-brking@linux.vnet.ibm.com +Signed-off-by: Brian King +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/ibmvscsi/ibmvfc.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c +index 070cf516b98fe..57c9a71fa33a7 100644 +--- a/drivers/scsi/ibmvscsi/ibmvfc.c ++++ b/drivers/scsi/ibmvscsi/ibmvfc.c +@@ -2957,8 +2957,10 @@ static int ibmvfc_slave_configure(struct scsi_device *sdev) + unsigned long flags = 0; + + spin_lock_irqsave(shost->host_lock, flags); +- if (sdev->type == TYPE_DISK) ++ if (sdev->type == TYPE_DISK) { + sdev->allow_restart = 1; ++ blk_queue_rq_timeout(sdev->request_queue, 120 * HZ); ++ } + spin_unlock_irqrestore(shost->host_lock, flags); + return 0; + } +-- +2.27.0 + diff --git a/queue-5.10/scsi-libfc-avoid-invoking-response-handler-twice-if-.patch b/queue-5.10/scsi-libfc-avoid-invoking-response-handler-twice-if-.patch new file mode 100644 index 00000000000..5c4c2638b41 --- /dev/null +++ b/queue-5.10/scsi-libfc-avoid-invoking-response-handler-twice-if-.patch @@ -0,0 +1,95 @@ +From 91c9b5c2919679edfbfcbce7a6bc82c41747021e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 15 Dec 2020 11:47:31 -0800 +Subject: scsi: libfc: Avoid invoking response handler twice if ep is already + completed +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Javed Hasan + +[ Upstream commit b2b0f16fa65e910a3ec8771206bb49ee87a54ac5 ] + +A race condition exists between the response handler getting called because +of exchange_mgr_reset() (which clears out all the active XIDs) and the +response we get via an interrupt. + +Sequence of events: + + rport ba0200: Port timeout, state PLOGI + rport ba0200: Port entered PLOGI state from PLOGI state + xid 1052: Exchange timer armed : 20000 msecs  xid timer armed here + rport ba0200: Received LOGO request while in state PLOGI + rport ba0200: Delete port + rport ba0200: work event 3 + rport ba0200: lld callback ev 3 + bnx2fc: rport_event_hdlr: event = 3, port_id = 0xba0200 + bnx2fc: ba0200 - rport not created Yet!! + /* Here we reset any outstanding exchanges before + freeing rport using the exch_mgr_reset() */ + xid 1052: Exchange timer canceled + /* Here we got two responses for one xid */ + xid 1052: invoking resp(), esb 20000000 state 3 + xid 1052: invoking resp(), esb 20000000 state 3 + xid 1052: fc_rport_plogi_resp() : ep->resp_active 2 + xid 1052: fc_rport_plogi_resp() : ep->resp_active 2 + +Skip the response if the exchange is already completed. + +Link: https://lore.kernel.org/r/20201215194731.2326-1-jhasan@marvell.com +Signed-off-by: Javed Hasan +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/libfc/fc_exch.c | 16 ++++++++++++++-- + 1 file changed, 14 insertions(+), 2 deletions(-) + +diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c +index 96a2952cf626b..a50f1eef0e0cd 100644 +--- a/drivers/scsi/libfc/fc_exch.c ++++ b/drivers/scsi/libfc/fc_exch.c +@@ -1624,8 +1624,13 @@ static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) + rc = fc_exch_done_locked(ep); + WARN_ON(fc_seq_exch(sp) != ep); + spin_unlock_bh(&ep->ex_lock); +- if (!rc) ++ if (!rc) { + fc_exch_delete(ep); ++ } else { ++ FC_EXCH_DBG(ep, "ep is completed already," ++ "hence skip calling the resp\n"); ++ goto skip_resp; ++ } + } + + /* +@@ -1644,6 +1649,7 @@ static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) + if (!fc_invoke_resp(ep, sp, fp)) + fc_frame_free(fp); + ++skip_resp: + fc_exch_release(ep); + return; + rel: +@@ -1900,10 +1906,16 @@ static void fc_exch_reset(struct fc_exch *ep) + + fc_exch_hold(ep); + +- if (!rc) ++ if (!rc) { + fc_exch_delete(ep); ++ } else { ++ FC_EXCH_DBG(ep, "ep is completed already," ++ "hence skip calling the resp\n"); ++ goto skip_resp; ++ } + + fc_invoke_resp(ep, sp, ERR_PTR(-FC_EX_CLOSED)); ++skip_resp: + fc_seq_set_resp(sp, NULL, ep->arg); + fc_exch_release(ep); + } +-- +2.27.0 + diff --git a/queue-5.10/scsi-scsi_transport_srp-don-t-block-target-in-failfa.patch b/queue-5.10/scsi-scsi_transport_srp-don-t-block-target-in-failfa.patch new file mode 100644 index 00000000000..ee3c70ee531 --- /dev/null +++ b/queue-5.10/scsi-scsi_transport_srp-don-t-block-target-in-failfa.patch @@ -0,0 +1,45 @@ +From 0cdda86961ceeed90f7ac2770eec5b3ac7357d4a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Jan 2021 15:25:41 +0100 +Subject: scsi: scsi_transport_srp: Don't block target in failfast state + +From: Martin Wilck + +[ Upstream commit 72eeb7c7151302ef007f1acd018cbf6f30e50321 ] + +If the port is in SRP_RPORT_FAIL_FAST state when srp_reconnect_rport() is +entered, a transition to SDEV_BLOCK would be illegal, and a kernel WARNING +would be triggered. Skip scsi_target_block() in this case. + +Link: https://lore.kernel.org/r/20210111142541.21534-1-mwilck@suse.com +Reviewed-by: Bart Van Assche +Signed-off-by: Martin Wilck +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/scsi_transport_srp.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c +index cba1cf6a1c12d..1e939a2a387f3 100644 +--- a/drivers/scsi/scsi_transport_srp.c ++++ b/drivers/scsi/scsi_transport_srp.c +@@ -541,7 +541,14 @@ int srp_reconnect_rport(struct srp_rport *rport) + res = mutex_lock_interruptible(&rport->mutex); + if (res) + goto out; +- scsi_target_block(&shost->shost_gendev); ++ if (rport->state != SRP_RPORT_FAIL_FAST) ++ /* ++ * sdev state must be SDEV_TRANSPORT_OFFLINE, transition ++ * to SDEV_BLOCK is illegal. Calling scsi_target_unblock() ++ * later is ok though, scsi_internal_device_unblock_nowait() ++ * treats SDEV_TRANSPORT_OFFLINE like SDEV_BLOCK. ++ */ ++ scsi_target_block(&shost->shost_gendev); + res = rport->state != SRP_RPORT_LOST ? i->f->reconnect(rport) : -ENODEV; + pr_debug("%s (state %d): transport.reconnect() returned %d\n", + dev_name(&shost->shost_gendev), rport->state, res); +-- +2.27.0 + diff --git a/queue-5.10/selftests-powerpc-only-test-lwm-stmw-on-big-endian.patch b/queue-5.10/selftests-powerpc-only-test-lwm-stmw-on-big-endian.patch new file mode 100644 index 00000000000..9072d9a90b9 --- /dev/null +++ b/queue-5.10/selftests-powerpc-only-test-lwm-stmw-on-big-endian.patch @@ -0,0 +1,61 @@ +From 8957c4f597e153efaf0d18befed4404ffc830926 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Jan 2021 15:18:00 +1100 +Subject: selftests/powerpc: Only test lwm/stmw on big endian + +From: Michael Ellerman + +[ Upstream commit dd3a44c06f7b4f14e90065bf05d62c255b20005f ] + +Newer binutils (>= 2.36) refuse to assemble lmw/stmw when building in +little endian mode. That breaks compilation of our alignment handler +test: + + /tmp/cco4l14N.s: Assembler messages: + /tmp/cco4l14N.s:1440: Error: `lmw' invalid when little-endian + /tmp/cco4l14N.s:1814: Error: `stmw' invalid when little-endian + make[2]: *** [../../lib.mk:139: /output/kselftest/powerpc/alignment/alignment_handler] Error 1 + +These tests do pass on little endian machines, as the kernel will +still emulate those instructions even when running little +endian (which is arguably a kernel bug). + +But we don't really need to test that case, so ifdef those +instructions out to get the alignment test building again. + +Reported-by: Libor Pechacek +Signed-off-by: Michael Ellerman +Tested-by: Libor Pechacek +Link: https://lore.kernel.org/r/20210119041800.3093047-1-mpe@ellerman.id.au +Signed-off-by: Sasha Levin +--- + .../testing/selftests/powerpc/alignment/alignment_handler.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/tools/testing/selftests/powerpc/alignment/alignment_handler.c b/tools/testing/selftests/powerpc/alignment/alignment_handler.c +index cb53a8b777e68..c25cf7cd45e9f 100644 +--- a/tools/testing/selftests/powerpc/alignment/alignment_handler.c ++++ b/tools/testing/selftests/powerpc/alignment/alignment_handler.c +@@ -443,7 +443,6 @@ int test_alignment_handler_integer(void) + LOAD_DFORM_TEST(ldu); + LOAD_XFORM_TEST(ldx); + LOAD_XFORM_TEST(ldux); +- LOAD_DFORM_TEST(lmw); + STORE_DFORM_TEST(stb); + STORE_XFORM_TEST(stbx); + STORE_DFORM_TEST(stbu); +@@ -462,7 +461,11 @@ int test_alignment_handler_integer(void) + STORE_XFORM_TEST(stdx); + STORE_DFORM_TEST(stdu); + STORE_XFORM_TEST(stdux); ++ ++#ifdef __BIG_ENDIAN__ ++ LOAD_DFORM_TEST(lmw); + STORE_DFORM_TEST(stmw); ++#endif + + return rc; + } +-- +2.27.0 + diff --git a/queue-5.10/series b/queue-5.10/series index 078885c3285..2047a683221 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -15,3 +15,43 @@ arm64-do-not-pass-tagged-addresses-to-__is_lm_address.patch revert-x86-setup-don-t-remove-e820_type_ram-for-pfn-0.patch arm-9025-1-kconfig-cpu_big_endian-depends-on-ld_is_lld.patch iommu-vt-d-do-not-use-flush-queue-when-caching-mode-is-on.patch +phy-cpcap-usb-fix-warning-for-missing-regulator_disa.patch +tools-power-x86-intel-speed-select-set-scaling_max_f.patch +tools-power-x86-intel-speed-select-set-higher-of-cpu.patch +platform-x86-touchscreen_dmi-add-swap-x-y-quirk-for-.patch +platform-x86-intel-vbtn-support-for-tablet-mode-on-d.patch +habanalabs-fix-dma_addr-passed-to-dma_mmap_coherent.patch +locking-lockdep-avoid-noinstr-warning-for-debug_lock.patch +x86-__always_inline-__-rd-wr-msr.patch +scsi-scsi_transport_srp-don-t-block-target-in-failfa.patch +scsi-libfc-avoid-invoking-response-handler-twice-if-.patch +scsi-fnic-fix-memleak-in-vnic_dev_init_devcmd2.patch +asoc-sof-intel-hda-resume-codec-to-do-jack-detection.patch +alsa-hda-add-alderlake-p-pci-id-and-hdmi-codec-vid.patch +objtool-don-t-add-empty-symbols-to-the-rbtree.patch +mac80211-fix-incorrect-strlen-of-.write-in-debugfs.patch +mac80211-fix-fast-rx-encryption-check.patch +mac80211-fix-encryption-key-selection-for-802.3-xmit.patch +scsi-ibmvfc-set-default-timeout-to-avoid-crash-durin.patch +alsa-hda-add-cometlake-r-pci-id.patch +i2c-tegra-create-i2c_writesl_vi-to-use-with-vi-i2c-f.patch +udf-fix-the-problem-that-the-disc-content-is-not-dis.patch +nvme-check-the-prinfo-bit-before-deciding-the-host-b.patch +nvme-rdma-avoid-request-double-completion-for-concur.patch +nvme-tcp-avoid-request-double-completion-for-concurr.patch +nvme-pci-allow-use-of-cmb-on-v1.4-controllers.patch +nvmet-set-right-status-on-error-in-id-ns-handler.patch +platform-x86-thinkpad_acpi-add-p53-73-firmware-to-fa.patch +selftests-powerpc-only-test-lwm-stmw-on-big-endian.patch +drm-amd-display-update-dram_clock_change_latency-for.patch +drm-amd-display-allow-pstate-chnage-when-no-displays.patch +drm-amd-display-change-function-decide_dp_link_setti.patch +drm-amd-display-use-hardware-sequencer-functions-for.patch +drm-amd-display-fixed-corruptions-on-hpdrx-link-loss.patch +habanalabs-zero-pci-counters-packet-before-submit-to.patch +habanalabs-fix-backward-compatibility-of-idle-check.patch +habanalabs-disable-fw-events-on-device-removal.patch +objtool-don-t-fail-the-kernel-build-on-fatal-errors.patch +x86-cpu-add-another-alder-lake-cpu-to-the-intel-fami.patch +kthread-extract-kthread_is_per_cpu.patch +workqueue-restrict-affinity-change-to-rescuer.patch diff --git a/queue-5.10/tools-power-x86-intel-speed-select-set-higher-of-cpu.patch b/queue-5.10/tools-power-x86-intel-speed-select-set-higher-of-cpu.patch new file mode 100644 index 00000000000..46019c00410 --- /dev/null +++ b/queue-5.10/tools-power-x86-intel-speed-select-set-higher-of-cpu.patch @@ -0,0 +1,54 @@ +From b95a53a7e2c5451e6dd4e09fb59c17a575bf53e1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 20 Dec 2020 23:18:59 -0800 +Subject: tools/power/x86/intel-speed-select: Set higher of cpuinfo_max_freq or + base_frequency + +From: Srinivas Pandruvada + +[ Upstream commit bbaa2e95e23e74791dd75b90d5ad9aad535acc6e ] + +In some case when BIOS disabled turbo, cpufreq cpuinfo_max_freq can be +lower than base_frequency at higher config level. So, in that case set +scaling_min_freq to base_frequency. + +Signed-off-by: Srinivas Pandruvada +Link: https://lore.kernel.org/r/20201221071859.2783957-3-srinivas.pandruvada@linux.intel.com +Signed-off-by: Hans de Goede +Signed-off-by: Sasha Levin +--- + tools/power/x86/intel-speed-select/isst-config.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/tools/power/x86/intel-speed-select/isst-config.c b/tools/power/x86/intel-speed-select/isst-config.c +index 97755f35d9910..ead9e51f75ada 100644 +--- a/tools/power/x86/intel-speed-select/isst-config.c ++++ b/tools/power/x86/intel-speed-select/isst-config.c +@@ -1457,6 +1457,16 @@ static void adjust_scaling_max_from_base_freq(int cpu) + set_cpufreq_scaling_min_max(cpu, 1, base_freq); + } + ++static void adjust_scaling_min_from_base_freq(int cpu) ++{ ++ int base_freq, scaling_min_freq; ++ ++ scaling_min_freq = parse_int_file(0, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_min_freq", cpu); ++ base_freq = get_cpufreq_base_freq(cpu); ++ if (scaling_min_freq < base_freq) ++ set_cpufreq_scaling_min_max(cpu, 0, base_freq); ++} ++ + static int set_clx_pbf_cpufreq_scaling_min_max(int cpu) + { + struct isst_pkg_ctdp_level_info *ctdp_level; +@@ -1554,6 +1564,7 @@ static void set_scaling_min_to_cpuinfo_max(int cpu) + continue; + + set_cpufreq_scaling_min_max_from_cpuinfo(i, 1, 0); ++ adjust_scaling_min_from_base_freq(i); + } + } + +-- +2.27.0 + diff --git a/queue-5.10/tools-power-x86-intel-speed-select-set-scaling_max_f.patch b/queue-5.10/tools-power-x86-intel-speed-select-set-scaling_max_f.patch new file mode 100644 index 00000000000..5ef20a5f2e1 --- /dev/null +++ b/queue-5.10/tools-power-x86-intel-speed-select-set-scaling_max_f.patch @@ -0,0 +1,82 @@ +From b28f656f75c2503f0fafec1a87f12b63909318b2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 20 Dec 2020 23:18:58 -0800 +Subject: tools/power/x86/intel-speed-select: Set scaling_max_freq to + base_frequency + +From: Srinivas Pandruvada + +[ Upstream commit f981dc171c04c6cf5a35c712543b231ebf805832 ] + +When BIOS disables turbo, The scaling_max_freq in cpufreq sysfs will be +limited to config level 0 base frequency. But when user selects a higher +config levels, this will result in higher base frequency. But since +scaling_max_freq is still old base frequency, the performance will still +be limited. So when the turbo is disabled and cpufreq base_frequency is +higher than scaling_max_freq, update the scaling_max_freq to the +base_frequency. + +Signed-off-by: Srinivas Pandruvada +Link: https://lore.kernel.org/r/20201221071859.2783957-2-srinivas.pandruvada@linux.intel.com +Signed-off-by: Hans de Goede +Signed-off-by: Sasha Levin +--- + .../x86/intel-speed-select/isst-config.c | 21 +++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/tools/power/x86/intel-speed-select/isst-config.c b/tools/power/x86/intel-speed-select/isst-config.c +index cd089a5058594..97755f35d9910 100644 +--- a/tools/power/x86/intel-speed-select/isst-config.c ++++ b/tools/power/x86/intel-speed-select/isst-config.c +@@ -1245,6 +1245,8 @@ static void dump_isst_config(int arg) + isst_ctdp_display_information_end(outf); + } + ++static void adjust_scaling_max_from_base_freq(int cpu); ++ + static void set_tdp_level_for_cpu(int cpu, void *arg1, void *arg2, void *arg3, + void *arg4) + { +@@ -1263,6 +1265,9 @@ static void set_tdp_level_for_cpu(int cpu, void *arg1, void *arg2, void *arg3, + int pkg_id = get_physical_package_id(cpu); + int die_id = get_physical_die_id(cpu); + ++ /* Wait for updated base frequencies */ ++ usleep(2000); ++ + fprintf(stderr, "Option is set to online/offline\n"); + ctdp_level.core_cpumask_size = + alloc_cpu_set(&ctdp_level.core_cpumask); +@@ -1279,6 +1284,7 @@ static void set_tdp_level_for_cpu(int cpu, void *arg1, void *arg2, void *arg3, + if (CPU_ISSET_S(i, ctdp_level.core_cpumask_size, ctdp_level.core_cpumask)) { + fprintf(stderr, "online cpu %d\n", i); + set_cpu_online_offline(i, 1); ++ adjust_scaling_max_from_base_freq(i); + } else { + fprintf(stderr, "offline cpu %d\n", i); + set_cpu_online_offline(i, 0); +@@ -1436,6 +1442,21 @@ static int set_cpufreq_scaling_min_max(int cpu, int max, int freq) + return 0; + } + ++static int no_turbo(void) ++{ ++ return parse_int_file(0, "/sys/devices/system/cpu/intel_pstate/no_turbo"); ++} ++ ++static void adjust_scaling_max_from_base_freq(int cpu) ++{ ++ int base_freq, scaling_max_freq; ++ ++ scaling_max_freq = parse_int_file(0, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_max_freq", cpu); ++ base_freq = get_cpufreq_base_freq(cpu); ++ if (scaling_max_freq < base_freq || no_turbo()) ++ set_cpufreq_scaling_min_max(cpu, 1, base_freq); ++} ++ + static int set_clx_pbf_cpufreq_scaling_min_max(int cpu) + { + struct isst_pkg_ctdp_level_info *ctdp_level; +-- +2.27.0 + diff --git a/queue-5.10/udf-fix-the-problem-that-the-disc-content-is-not-dis.patch b/queue-5.10/udf-fix-the-problem-that-the-disc-content-is-not-dis.patch new file mode 100644 index 00000000000..8a4ee65bd64 --- /dev/null +++ b/queue-5.10/udf-fix-the-problem-that-the-disc-content-is-not-dis.patch @@ -0,0 +1,74 @@ +From 079ae59c064b50ddaccc72c67dc4bd7c3cf76da0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 Jan 2021 15:57:41 +0800 +Subject: udf: fix the problem that the disc content is not displayed + +From: lianzhi chang + +[ Upstream commit 5cdc4a6950a883594e9640b1decb3fcf6222a594 ] + +When the capacity of the disc is too large (assuming the 4.7G +specification), the disc (UDF file system) will be burned +multiple times in the windows (Multisession Usage). When the +remaining capacity of the CD is less than 300M (estimated +value, for reference only), open the CD in the Linux system, +the content of the CD is displayed as blank (the kernel will +say "No VRS found"). Windows can display the contents of the +CD normally. +Through analysis, in the "fs/udf/super.c": udf_check_vsd +function, the actual value of VSD_MAX_SECTOR_OFFSET may +be much larger than 0x800000. According to the current code +logic, it is found that the type of sbi->s_session is "__s32", + when the remaining capacity of the disc is less than 300M +(take a set of test values: sector=3154903040, +sbi->s_session=1540464, sb->s_blocksize_bits=11 ), the +calculation result of "sbi->s_session << sb->s_blocksize_bits" + will overflow. Therefore, it is necessary to convert the +type of s_session to "loff_t" (when udf_check_vsd starts, +assign a value to _sector, which is also converted in this +way), so that the result will not overflow, and then the +content of the disc can be displayed normally. + +Link: https://lore.kernel.org/r/20210114075741.30448-1-changlianzhi@uniontech.com +Signed-off-by: lianzhi chang +Signed-off-by: Jan Kara +Signed-off-by: Sasha Levin +--- + fs/udf/super.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/fs/udf/super.c b/fs/udf/super.c +index 5bef3a68395d8..d0df217f4712a 100644 +--- a/fs/udf/super.c ++++ b/fs/udf/super.c +@@ -705,6 +705,7 @@ static int udf_check_vsd(struct super_block *sb) + struct buffer_head *bh = NULL; + int nsr = 0; + struct udf_sb_info *sbi; ++ loff_t session_offset; + + sbi = UDF_SB(sb); + if (sb->s_blocksize < sizeof(struct volStructDesc)) +@@ -712,7 +713,8 @@ static int udf_check_vsd(struct super_block *sb) + else + sectorsize = sb->s_blocksize; + +- sector += (((loff_t)sbi->s_session) << sb->s_blocksize_bits); ++ session_offset = (loff_t)sbi->s_session << sb->s_blocksize_bits; ++ sector += session_offset; + + udf_debug("Starting at sector %u (%lu byte sectors)\n", + (unsigned int)(sector >> sb->s_blocksize_bits), +@@ -757,8 +759,7 @@ static int udf_check_vsd(struct super_block *sb) + + if (nsr > 0) + return 1; +- else if (!bh && sector - (sbi->s_session << sb->s_blocksize_bits) == +- VSD_FIRST_SECTOR_OFFSET) ++ else if (!bh && sector - session_offset == VSD_FIRST_SECTOR_OFFSET) + return -1; + else + return 0; +-- +2.27.0 + diff --git a/queue-5.10/workqueue-restrict-affinity-change-to-rescuer.patch b/queue-5.10/workqueue-restrict-affinity-change-to-rescuer.patch new file mode 100644 index 00000000000..9f0377cb233 --- /dev/null +++ b/queue-5.10/workqueue-restrict-affinity-change-to-rescuer.patch @@ -0,0 +1,58 @@ +From c90bd4951e33c21cb6c73c7cb79f359e1a182d97 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 15 Jan 2021 19:08:36 +0100 +Subject: workqueue: Restrict affinity change to rescuer + +From: Peter Zijlstra + +[ Upstream commit 640f17c82460e9724fd256f0a1f5d99e7ff0bda4 ] + +create_worker() will already set the right affinity using +kthread_bind_mask(), this means only the rescuer will need to change +it's affinity. + +Howveer, while in cpu-hot-unplug a regular task is not allowed to run +on online&&!active as it would be pushed away quite agressively. We +need KTHREAD_IS_PER_CPU to survive in that environment. + +Therefore set the affinity after getting that magic flag. + +Signed-off-by: Peter Zijlstra (Intel) +Reviewed-by: Valentin Schneider +Tested-by: Valentin Schneider +Link: https://lkml.kernel.org/r/20210121103506.826629830@infradead.org +Signed-off-by: Sasha Levin +--- + kernel/workqueue.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/kernel/workqueue.c b/kernel/workqueue.c +index 0695c7895c892..1d99c52cc99a6 100644 +--- a/kernel/workqueue.c ++++ b/kernel/workqueue.c +@@ -1845,12 +1845,6 @@ static void worker_attach_to_pool(struct worker *worker, + { + mutex_lock(&wq_pool_attach_mutex); + +- /* +- * set_cpus_allowed_ptr() will fail if the cpumask doesn't have any +- * online CPUs. It'll be re-applied when any of the CPUs come up. +- */ +- set_cpus_allowed_ptr(worker->task, pool->attrs->cpumask); +- + /* + * The wq_pool_attach_mutex ensures %POOL_DISASSOCIATED remains + * stable across this function. See the comments above the flag +@@ -1859,6 +1853,9 @@ static void worker_attach_to_pool(struct worker *worker, + if (pool->flags & POOL_DISASSOCIATED) + worker->flags |= WORKER_UNBOUND; + ++ if (worker->rescue_wq) ++ set_cpus_allowed_ptr(worker->task, pool->attrs->cpumask); ++ + list_add_tail(&worker->node, &pool->workers); + worker->pool = pool; + +-- +2.27.0 + diff --git a/queue-5.10/x86-__always_inline-__-rd-wr-msr.patch b/queue-5.10/x86-__always_inline-__-rd-wr-msr.patch new file mode 100644 index 00000000000..b5a2f0dc85e --- /dev/null +++ b/queue-5.10/x86-__always_inline-__-rd-wr-msr.patch @@ -0,0 +1,48 @@ +From 3e9ac6a121a6cced53854f7fd2917434680cf9f6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Jan 2021 11:14:25 +0100 +Subject: x86: __always_inline __{rd,wr}msr() + +From: Peter Zijlstra + +[ Upstream commit 66a425011c61e71560c234492d204e83cfb73d1d ] + +When the compiler choses to not inline the trivial MSR helpers: + + vmlinux.o: warning: objtool: __sev_es_nmi_complete()+0xce: call to __wrmsr.constprop.14() leaves .noinstr.text section + +Reported-by: Randy Dunlap +Signed-off-by: Peter Zijlstra (Intel) +Signed-off-by: Thomas Gleixner +Acked-by: Randy Dunlap # build-tested +Link: https://lore.kernel.org/r/X/bf3gV+BW7kGEsB@hirez.programming.kicks-ass.net +Signed-off-by: Sasha Levin +--- + arch/x86/include/asm/msr.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h +index 0b4920a7238e3..e16cccdd04207 100644 +--- a/arch/x86/include/asm/msr.h ++++ b/arch/x86/include/asm/msr.h +@@ -86,7 +86,7 @@ static inline void do_trace_rdpmc(unsigned int msr, u64 val, int failed) {} + * think of extending them - you will be slapped with a stinking trout or a frozen + * shark will reach you, wherever you are! You've been warned. + */ +-static inline unsigned long long notrace __rdmsr(unsigned int msr) ++static __always_inline unsigned long long __rdmsr(unsigned int msr) + { + DECLARE_ARGS(val, low, high); + +@@ -98,7 +98,7 @@ static inline unsigned long long notrace __rdmsr(unsigned int msr) + return EAX_EDX_VAL(val, low, high); + } + +-static inline void notrace __wrmsr(unsigned int msr, u32 low, u32 high) ++static __always_inline void __wrmsr(unsigned int msr, u32 low, u32 high) + { + asm volatile("1: wrmsr\n" + "2:\n" +-- +2.27.0 + diff --git a/queue-5.10/x86-cpu-add-another-alder-lake-cpu-to-the-intel-fami.patch b/queue-5.10/x86-cpu-add-another-alder-lake-cpu-to-the-intel-fami.patch new file mode 100644 index 00000000000..bd89a22ae9c --- /dev/null +++ b/queue-5.10/x86-cpu-add-another-alder-lake-cpu-to-the-intel-fami.patch @@ -0,0 +1,35 @@ +From 23b02267be107144720c9052f1b09876d2391208 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 21 Jan 2021 13:50:04 -0800 +Subject: x86/cpu: Add another Alder Lake CPU to the Intel family + +From: Gayatri Kammela + +[ Upstream commit 6e1239c13953f3c2a76e70031f74ddca9ae57cd3 ] + +Add Alder Lake mobile CPU model number to Intel family. + +Signed-off-by: Gayatri Kammela +Signed-off-by: Tony Luck +Signed-off-by: Borislav Petkov +Link: https://lkml.kernel.org/r/20210121215004.11618-1-tony.luck@intel.com +Signed-off-by: Sasha Levin +--- + arch/x86/include/asm/intel-family.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/x86/include/asm/intel-family.h b/arch/x86/include/asm/intel-family.h +index 5e658ba2654a7..9abe842dbd843 100644 +--- a/arch/x86/include/asm/intel-family.h ++++ b/arch/x86/include/asm/intel-family.h +@@ -97,6 +97,7 @@ + + #define INTEL_FAM6_LAKEFIELD 0x8A + #define INTEL_FAM6_ALDERLAKE 0x97 ++#define INTEL_FAM6_ALDERLAKE_L 0x9A + + /* "Small Core" Processors (Atom) */ + +-- +2.27.0 + -- 2.47.3