]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 6.0
authorSasha Levin <sashal@kernel.org>
Tue, 27 Dec 2022 02:31:07 +0000 (21:31 -0500)
committerSasha Levin <sashal@kernel.org>
Tue, 27 Dec 2022 02:31:07 +0000 (21:31 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
26 files changed:
queue-6.0/afs-fix-lost-servers_outstanding-count.patch [new file with mode: 0644]
queue-6.0/alsa-hda-add-snd_hdac_stop_streams-helper.patch [new file with mode: 0644]
queue-6.0/alsa-hda-hdmi-fix-i915-silent-stream-programming-flo.patch [new file with mode: 0644]
queue-6.0/alsa-hda-hdmi-fix-stream-id-config-keep-alive-for-rt.patch [new file with mode: 0644]
queue-6.0/alsa-hda-hdmi-set-default-audio-parameters-for-kae-s.patch [new file with mode: 0644]
queue-6.0/alsa-hda-hdmi-use-only-dynamic-pcm-device-allocation.patch [new file with mode: 0644]
queue-6.0/asoc-audio-graph-card-fix-refcount-leak-of-cpu_ep-in.patch [new file with mode: 0644]
queue-6.0/asoc-intel-skylake-fix-driver-hang-during-shutdown.patch [new file with mode: 0644]
queue-6.0/asoc-mediatek-mt8173-rt5650-rt5514-fix-refcount-leak.patch [new file with mode: 0644]
queue-6.0/asoc-mediatek-mt8183-fix-refcount-leak-in-mt8183_mt6.patch [new file with mode: 0644]
queue-6.0/asoc-rockchip-pdm-add-missing-clk_disable_unprepare-.patch [new file with mode: 0644]
queue-6.0/asoc-rockchip-spdif-add-missing-clk_disable_unprepar.patch [new file with mode: 0644]
queue-6.0/asoc-rt5670-remove-unbalanced-pm_runtime_put.patch [new file with mode: 0644]
queue-6.0/asoc-sof_es8336-fix-possible-use-after-free-in-sof_e.patch [new file with mode: 0644]
queue-6.0/asoc-wm8994-fix-potential-deadlock.patch [new file with mode: 0644]
queue-6.0/drm-amd-pm-avoid-large-variable-on-kernel-stack.patch [new file with mode: 0644]
queue-6.0/drm-i915-display-don-t-disable-ddi-transcoder-when-s.patch [new file with mode: 0644]
queue-6.0/ima-simplify-ima_lsm_copy_rule.patch [new file with mode: 0644]
queue-6.0/lkdtm-cfi-make-pac-test-work-with-gcc-7-and-8.patch [new file with mode: 0644]
queue-6.0/loadpin-ignore-the-contents-argument-of-the-lsm-hook.patch [new file with mode: 0644]
queue-6.0/mips-ralink-mt7621-avoid-to-init-common-ralink-reset.patch [new file with mode: 0644]
queue-6.0/perf-debug-set-debug_peo_args-and-redirect_to_stderr.patch [new file with mode: 0644]
queue-6.0/perf-test-fix-all-pmu-test-to-skip-parametrized-even.patch [new file with mode: 0644]
queue-6.0/pstore-make-sure-config_pstore_pmsg-selects-config_r.patch [new file with mode: 0644]
queue-6.0/pstore-switch-pmsg_lock-to-an-rt_mutex-to-avoid-prio.patch [new file with mode: 0644]
queue-6.0/series

diff --git a/queue-6.0/afs-fix-lost-servers_outstanding-count.patch b/queue-6.0/afs-fix-lost-servers_outstanding-count.patch
new file mode 100644 (file)
index 0000000..841106a
--- /dev/null
@@ -0,0 +1,59 @@
+From 99114f706b08fea083977ed347f6afccee5aaa6f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 21 Dec 2022 14:30:48 +0000
+Subject: afs: Fix lost servers_outstanding count
+
+From: David Howells <dhowells@redhat.com>
+
+[ Upstream commit 36f82c93ee0bd88f1c95a52537906b8178b537f1 ]
+
+The afs_fs_probe_dispatcher() work function is passed a count on
+net->servers_outstanding when it is scheduled (which may come via its
+timer).  This is passed back to the work_item, passed to the timer or
+dropped at the end of the dispatcher function.
+
+But, at the top of the dispatcher function, there are two checks which
+skip the rest of the function: if the network namespace is being destroyed
+or if there are no fileservers to probe.  These two return paths, however,
+do not drop the count passed to the dispatcher, and so, sometimes, the
+destruction of a network namespace, such as induced by rmmod of the kafs
+module, may get stuck in afs_purge_servers(), waiting for
+net->servers_outstanding to become zero.
+
+Fix this by adding the missing decrements in afs_fs_probe_dispatcher().
+
+Fixes: f6cbb368bcb0 ("afs: Actively poll fileservers to maintain NAT or firewall openings")
+Reported-by: Marc Dionne <marc.dionne@auristor.com>
+Signed-off-by: David Howells <dhowells@redhat.com>
+Tested-by: Marc Dionne <marc.dionne@auristor.com>
+cc: linux-afs@lists.infradead.org
+Link: https://lore.kernel.org/r/167164544917.2072364.3759519569649459359.stgit@warthog.procyon.org.uk/
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/afs/fs_probe.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/fs/afs/fs_probe.c b/fs/afs/fs_probe.c
+index 3ac5fcf98d0d..daaf3810cc92 100644
+--- a/fs/afs/fs_probe.c
++++ b/fs/afs/fs_probe.c
+@@ -366,12 +366,15 @@ void afs_fs_probe_dispatcher(struct work_struct *work)
+       unsigned long nowj, timer_at, poll_at;
+       bool first_pass = true, set_timer = false;
+-      if (!net->live)
++      if (!net->live) {
++              afs_dec_servers_outstanding(net);
+               return;
++      }
+       _enter("");
+       if (list_empty(&net->fs_probe_fast) && list_empty(&net->fs_probe_slow)) {
++              afs_dec_servers_outstanding(net);
+               _leave(" [none]");
+               return;
+       }
+-- 
+2.35.1
+
diff --git a/queue-6.0/alsa-hda-add-snd_hdac_stop_streams-helper.patch b/queue-6.0/alsa-hda-add-snd_hdac_stop_streams-helper.patch
new file mode 100644 (file)
index 0000000..8475fad
--- /dev/null
@@ -0,0 +1,95 @@
+From 258097b4b6bbdc8f0c1142495409bbe4b40a433a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 19 Sep 2022 14:10:38 +0200
+Subject: ALSA: hda: add snd_hdac_stop_streams() helper
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+
+[ Upstream commit 24ad3835a6db4f8857975effa6bf47730371a5ff ]
+
+Minor code reuse, no functionality change.
+
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
+Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
+Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Link: https://lore.kernel.org/r/20220919121041.43463-6-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Stable-dep-of: 171107237246 ("ASoC: Intel: Skylake: Fix driver hang during shutdown")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/sound/hdaudio.h        |  1 +
+ sound/hda/hdac_stream.c        | 17 ++++++++++++++---
+ sound/pci/hda/hda_controller.c |  4 +---
+ 3 files changed, 16 insertions(+), 6 deletions(-)
+
+diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h
+index 797bf67a164d..ceaa7b7cfdc3 100644
+--- a/include/sound/hdaudio.h
++++ b/include/sound/hdaudio.h
+@@ -562,6 +562,7 @@ int snd_hdac_stream_set_params(struct hdac_stream *azx_dev,
+ void snd_hdac_stream_start(struct hdac_stream *azx_dev, bool fresh_start);
+ void snd_hdac_stream_clear(struct hdac_stream *azx_dev);
+ void snd_hdac_stream_stop(struct hdac_stream *azx_dev);
++void snd_hdac_stop_streams(struct hdac_bus *bus);
+ void snd_hdac_stop_streams_and_chip(struct hdac_bus *bus);
+ void snd_hdac_stream_reset(struct hdac_stream *azx_dev);
+ void snd_hdac_stream_sync_trigger(struct hdac_stream *azx_dev, bool set,
+diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c
+index f3582012d22f..eea22cf72aef 100644
+--- a/sound/hda/hdac_stream.c
++++ b/sound/hda/hdac_stream.c
+@@ -142,17 +142,28 @@ void snd_hdac_stream_stop(struct hdac_stream *azx_dev)
+ }
+ EXPORT_SYMBOL_GPL(snd_hdac_stream_stop);
++/**
++ * snd_hdac_stop_streams - stop all streams
++ * @bus: HD-audio core bus
++ */
++void snd_hdac_stop_streams(struct hdac_bus *bus)
++{
++      struct hdac_stream *stream;
++
++      list_for_each_entry(stream, &bus->stream_list, list)
++              snd_hdac_stream_stop(stream);
++}
++EXPORT_SYMBOL_GPL(snd_hdac_stop_streams);
++
+ /**
+  * snd_hdac_stop_streams_and_chip - stop all streams and chip if running
+  * @bus: HD-audio core bus
+  */
+ void snd_hdac_stop_streams_and_chip(struct hdac_bus *bus)
+ {
+-      struct hdac_stream *stream;
+       if (bus->chip_init) {
+-              list_for_each_entry(stream, &bus->stream_list, list)
+-                      snd_hdac_stream_stop(stream);
++              snd_hdac_stop_streams(bus);
+               snd_hdac_bus_stop_chip(bus);
+       }
+ }
+diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
+index 75dcb14ff20a..0ff286b7b66b 100644
+--- a/sound/pci/hda/hda_controller.c
++++ b/sound/pci/hda/hda_controller.c
+@@ -1033,10 +1033,8 @@ EXPORT_SYMBOL_GPL(azx_init_chip);
+ void azx_stop_all_streams(struct azx *chip)
+ {
+       struct hdac_bus *bus = azx_bus(chip);
+-      struct hdac_stream *s;
+-      list_for_each_entry(s, &bus->stream_list, list)
+-              snd_hdac_stream_stop(s);
++      snd_hdac_stop_streams(bus);
+ }
+ EXPORT_SYMBOL_GPL(azx_stop_all_streams);
+-- 
+2.35.1
+
diff --git a/queue-6.0/alsa-hda-hdmi-fix-i915-silent-stream-programming-flo.patch b/queue-6.0/alsa-hda-hdmi-fix-i915-silent-stream-programming-flo.patch
new file mode 100644 (file)
index 0000000..f4e9a1c
--- /dev/null
@@ -0,0 +1,74 @@
+From de55c9148aeb23fc16ecb586f3f5752ed9c1a127 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 9 Dec 2022 12:18:20 +0200
+Subject: ALSA: hda/hdmi: fix i915 silent stream programming flow
+
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+
+[ Upstream commit ada261b690ecd5c2f55f0c51bdf11d852a4561a6 ]
+
+The i915 display codec may not successfully transition to
+normal audio streaming mode, if the stream id is programmed
+while codec is actively transmitting data. This can happen
+when silent stream is enabled in KAE mode.
+
+Fix the issue by implementing a i915 specific programming
+flow, where the silent streaming is temporarily stopped,
+a small delay is applied to ensure display codec becomes
+idle, and then proceed with reprogramming the stream ID.
+
+Fixes: 15175a4f2bbb ("ALSA: hda/hdmi: add keep-alive support for ADL-P and DG2")
+Link: https://gitlab.freedesktop.org/drm/intel/-/issues/7353
+Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Tested-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
+Link: https://lore.kernel.org/r/20221209101822.3893675-2-kai.vehmanen@linux.intel.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/patch_hdmi.c | 28 ++++++++++++++++++++++++++--
+ 1 file changed, 26 insertions(+), 2 deletions(-)
+
+diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
+index 287f4f78e7b1..3655584fc37b 100644
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -2963,9 +2963,33 @@ static int i915_hsw_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
+                                hda_nid_t pin_nid, int dev_id, u32 stream_tag,
+                                int format)
+ {
++      struct hdmi_spec *spec = codec->spec;
++      int pin_idx = pin_id_to_pin_index(codec, pin_nid, dev_id);
++      struct hdmi_spec_per_pin *per_pin;
++      int res;
++
++      if (pin_idx < 0)
++              per_pin = NULL;
++      else
++              per_pin = get_pin(spec, pin_idx);
++
+       haswell_verify_D0(codec, cvt_nid, pin_nid);
+-      return hdmi_setup_stream(codec, cvt_nid, pin_nid, dev_id,
+-                               stream_tag, format);
++
++      if (spec->silent_stream_type == SILENT_STREAM_KAE && per_pin && per_pin->silent_stream) {
++              silent_stream_set_kae(codec, per_pin, false);
++              /* wait for pending transfers in codec to clear */
++              usleep_range(100, 200);
++      }
++
++      res = hdmi_setup_stream(codec, cvt_nid, pin_nid, dev_id,
++                              stream_tag, format);
++
++      if (spec->silent_stream_type == SILENT_STREAM_KAE && per_pin && per_pin->silent_stream) {
++              usleep_range(100, 200);
++              silent_stream_set_kae(codec, per_pin, true);
++      }
++
++      return res;
+ }
+ /* pin_cvt_fixup ops override for HSW+ and VLV+ */
+-- 
+2.35.1
+
diff --git a/queue-6.0/alsa-hda-hdmi-fix-stream-id-config-keep-alive-for-rt.patch b/queue-6.0/alsa-hda-hdmi-fix-stream-id-config-keep-alive-for-rt.patch
new file mode 100644 (file)
index 0000000..d5ac197
--- /dev/null
@@ -0,0 +1,176 @@
+From e206a2a6a428093ba0d9835a163f07b271356e7b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 9 Dec 2022 12:18:22 +0200
+Subject: ALSA: hda/hdmi: fix stream-id config keep-alive for rt suspend
+
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+
+[ Upstream commit ee0b089d660021792e4ab4dda191b097ce1e964f ]
+
+When the new style KAE keep-alive implementation is used on compatible
+Intel hardware, the clocks are maintained when codec is in D3. The
+generic code in hda_cleanup_all_streams() can however interfere with
+generation of audio samples in this mode, by setting the stream and
+channel ids to zero.
+
+To get full benefit of the keepalive, set the new
+no_stream_clean_at_suspend quirk bit on affected Intel hardware. When
+this bit is set, stream cleanup is skipped in hda_call_codec_suspend().
+
+Special handling is needed for the case when system goes to suspend. The
+stream id programming can be lost in this case. This will also cause
+codec->cvt_setups to be out of sync. Handle this by implementing custom
+suspend/resume handlers. If keep-alive is active for any converter, set
+the quirk flags no_stream_clean_at_suspend and forced_resume. Upon
+resume, keepalive programming is restored if needed.
+
+Fixes: 15175a4f2bbb ("ALSA: hda/hdmi: add keep-alive support for ADL-P and DG2")
+Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20221209101822.3893675-4-kai.vehmanen@linux.intel.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/sound/hda_codec.h  |  1 +
+ sound/pci/hda/hda_codec.c  |  3 +-
+ sound/pci/hda/patch_hdmi.c | 90 +++++++++++++++++++++++++++++++++++++-
+ 3 files changed, 92 insertions(+), 2 deletions(-)
+
+diff --git a/include/sound/hda_codec.h b/include/sound/hda_codec.h
+index 684e6131737e..ec2a2ba21cc3 100644
+--- a/include/sound/hda_codec.h
++++ b/include/sound/hda_codec.h
+@@ -258,6 +258,7 @@ struct hda_codec {
+       unsigned int link_down_at_suspend:1; /* link down at runtime suspend */
+       unsigned int relaxed_resume:1;  /* don't resume forcibly for jack */
+       unsigned int forced_resume:1; /* forced resume for jack */
++      unsigned int no_stream_clean_at_suspend:1; /* do not clean streams at suspend */
+ #ifdef CONFIG_PM
+       unsigned long power_on_acct;
+diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
+index 384426d7e9dd..c853cba7fc2b 100644
+--- a/sound/pci/hda/hda_codec.c
++++ b/sound/pci/hda/hda_codec.c
+@@ -2893,7 +2893,8 @@ static unsigned int hda_call_codec_suspend(struct hda_codec *codec)
+       snd_hdac_enter_pm(&codec->core);
+       if (codec->patch_ops.suspend)
+               codec->patch_ops.suspend(codec);
+-      hda_cleanup_all_streams(codec);
++      if (!codec->no_stream_clean_at_suspend)
++              hda_cleanup_all_streams(codec);
+       state = hda_set_power_state(codec, AC_PWRST_D3);
+       update_power_acct(codec, true);
+       snd_hdac_leave_pm(&codec->core);
+diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
+index 36df152b63ba..1e44c6b3ecc9 100644
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -2925,6 +2925,88 @@ static void i915_pin_cvt_fixup(struct hda_codec *codec,
+       }
+ }
++#ifdef CONFIG_PM
++static int i915_adlp_hdmi_suspend(struct hda_codec *codec)
++{
++      struct hdmi_spec *spec = codec->spec;
++      bool silent_streams = false;
++      int pin_idx, res;
++
++      res = generic_hdmi_suspend(codec);
++
++      for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
++              struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
++
++              if (per_pin->silent_stream) {
++                      silent_streams = true;
++                      break;
++              }
++      }
++
++      if (silent_streams && spec->silent_stream_type == SILENT_STREAM_KAE) {
++              /*
++               * stream-id should remain programmed when codec goes
++               * to runtime suspend
++               */
++              codec->no_stream_clean_at_suspend = 1;
++
++              /*
++               * the system might go to S3, in which case keep-alive
++               * must be reprogrammed upon resume
++               */
++              codec->forced_resume = 1;
++
++              codec_dbg(codec, "HDMI: KAE active at suspend\n");
++      } else {
++              codec->no_stream_clean_at_suspend = 0;
++              codec->forced_resume = 0;
++      }
++
++      return res;
++}
++
++static int i915_adlp_hdmi_resume(struct hda_codec *codec)
++{
++      struct hdmi_spec *spec = codec->spec;
++      int pin_idx, res;
++
++      res = generic_hdmi_resume(codec);
++
++      /* KAE not programmed at suspend, nothing to do here */
++      if (!codec->no_stream_clean_at_suspend)
++              return res;
++
++      for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
++              struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
++
++              /*
++               * If system was in suspend with monitor connected,
++               * the codec setting may have been lost. Re-enable
++               * keep-alive.
++               */
++              if (per_pin->silent_stream) {
++                      unsigned int param;
++
++                      param = snd_hda_codec_read(codec, per_pin->cvt_nid, 0,
++                                                 AC_VERB_GET_CONV, 0);
++                      if (!param) {
++                              codec_dbg(codec, "HDMI: KAE: restore stream id\n");
++                              silent_stream_enable_i915(codec, per_pin);
++                      }
++
++                      param = snd_hda_codec_read(codec, per_pin->cvt_nid, 0,
++                                                 AC_VERB_GET_DIGI_CONVERT_1, 0);
++                      if (!(param & (AC_DIG3_KAE << 16))) {
++                              codec_dbg(codec, "HDMI: KAE: restore DIG3_KAE\n");
++                              silent_stream_set_kae(codec, per_pin, true);
++                      }
++              }
++      }
++
++      return res;
++}
++#endif
++
+ /* precondition and allocation for Intel codecs */
+ static int alloc_intel_hdmi(struct hda_codec *codec)
+ {
+@@ -3055,8 +3137,14 @@ static int patch_i915_adlp_hdmi(struct hda_codec *codec)
+       if (!res) {
+               spec = codec->spec;
+-              if (spec->silent_stream_type)
++              if (spec->silent_stream_type) {
+                       spec->silent_stream_type = SILENT_STREAM_KAE;
++
++#ifdef CONFIG_PM
++                      codec->patch_ops.resume = i915_adlp_hdmi_resume;
++                      codec->patch_ops.suspend = i915_adlp_hdmi_suspend;
++#endif
++              }
+       }
+       return res;
+-- 
+2.35.1
+
diff --git a/queue-6.0/alsa-hda-hdmi-set-default-audio-parameters-for-kae-s.patch b/queue-6.0/alsa-hda-hdmi-set-default-audio-parameters-for-kae-s.patch
new file mode 100644 (file)
index 0000000..b0c504e
--- /dev/null
@@ -0,0 +1,43 @@
+From d692584e82dfaccf58ff4cee568f38a9892db9fd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 9 Dec 2022 12:18:21 +0200
+Subject: ALSA: hda/hdmi: set default audio parameters for KAE silent-stream
+
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+
+[ Upstream commit b17e7ea041d8b565063632501ca4597afd105102 ]
+
+If the stream-id is zero, the keep-alive (KAE) will only ensure clock is
+generated, but no audio samples are sent over display link. This happens
+before first real audio stream is played out to a newly connected
+receiver.
+
+Reuse the code in silent_stream_enable() to set up stream parameters
+to sane defaults values, also when using the newer keep-alive flow.
+
+Fixes: 15175a4f2bbb ("ALSA: hda/hdmi: add keep-alive support for ADL-P and DG2")
+Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Tested-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
+Link: https://lore.kernel.org/r/20221209101822.3893675-3-kai.vehmanen@linux.intel.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/patch_hdmi.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
+index 3655584fc37b..da5276e7eab1 100644
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -1788,6 +1788,7 @@ static void silent_stream_enable(struct hda_codec *codec,
+       switch (spec->silent_stream_type) {
+       case SILENT_STREAM_KAE:
++              silent_stream_enable_i915(codec, per_pin);
+               silent_stream_set_kae(codec, per_pin, true);
+               break;
+       case SILENT_STREAM_I915:
+-- 
+2.35.1
+
diff --git a/queue-6.0/alsa-hda-hdmi-use-only-dynamic-pcm-device-allocation.patch b/queue-6.0/alsa-hda-hdmi-use-only-dynamic-pcm-device-allocation.patch
new file mode 100644 (file)
index 0000000..4397df8
--- /dev/null
@@ -0,0 +1,372 @@
+From ed233e8650b5011d1a123521864cba09c4f2c8c4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 22 Sep 2022 10:40:17 +0200
+Subject: ALSA: hda/hdmi: Use only dynamic PCM device allocation
+
+From: Jaroslav Kysela <perex@perex.cz>
+
+[ Upstream commit ef6f5494faf6a37c74990689a3bb3cee76d2544c ]
+
+Per discussion on the alsa-devel mailing list [1], the legacy PIN to PCM
+device mapping is obsolete nowadays. The maximum number of the simultaneously
+usable PCM devices is equal to the HDMI codec converters.
+
+Remove the extra PCM devices (beyond the detected converters) and force
+the use of the dynamic PCM device allocation. The legacy code is removed.
+
+I believe that all HDMI codecs have the jack sensing feature. Move the check
+to the codec probe function and print a warning, if a codec without this
+feature is detected.
+
+[1] https://lore.kernel.org/alsa-devel/2f37e0b2-1e82-8c0b-2bbd-1e5038d6ecc6@perex.cz/
+
+Cc: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Signed-off-by: Jaroslav Kysela <perex@perex.cz>
+Link: https://lore.kernel.org/r/20220922084017.25925-1-perex@perex.cz
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Stable-dep-of: ee0b089d6600 ("ALSA: hda/hdmi: fix stream-id config keep-alive for rt suspend")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/sound/hda_codec.h   |   1 -
+ sound/pci/hda/patch_hdmi.c  | 153 +++++++-----------------------------
+ sound/soc/codecs/hda.c      |   3 -
+ sound/soc/codecs/hdac_hda.c |   3 -
+ 4 files changed, 28 insertions(+), 132 deletions(-)
+
+diff --git a/include/sound/hda_codec.h b/include/sound/hda_codec.h
+index 6d3c82c4b6ac..684e6131737e 100644
+--- a/include/sound/hda_codec.h
++++ b/include/sound/hda_codec.h
+@@ -258,7 +258,6 @@ struct hda_codec {
+       unsigned int link_down_at_suspend:1; /* link down at runtime suspend */
+       unsigned int relaxed_resume:1;  /* don't resume forcibly for jack */
+       unsigned int forced_resume:1; /* forced resume for jack */
+-      unsigned int mst_no_extra_pcms:1; /* no backup PCMs for DP-MST */
+ #ifdef CONFIG_PM
+       unsigned long power_on_acct;
+diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
+index da5276e7eab1..36df152b63ba 100644
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -167,8 +167,6 @@ struct hdmi_spec {
+       struct hdmi_ops ops;
+       bool dyn_pin_out;
+-      bool dyn_pcm_assign;
+-      bool dyn_pcm_no_legacy;
+       /* hdmi interrupt trigger control flag for Nvidia codec */
+       bool hdmi_intr_trig_ctrl;
+       bool nv_dp_workaround; /* workaround DP audio infoframe for Nvidia */
+@@ -1187,9 +1185,7 @@ static void pin_cvt_fixup(struct hda_codec *codec,
+               spec->ops.pin_cvt_fixup(codec, per_pin, cvt_nid);
+ }
+-/* called in hdmi_pcm_open when no pin is assigned to the PCM
+- * in dyn_pcm_assign mode.
+- */
++/* called in hdmi_pcm_open when no pin is assigned to the PCM */
+ static int hdmi_pcm_open_no_pin(struct hda_pcm_stream *hinfo,
+                        struct hda_codec *codec,
+                        struct snd_pcm_substream *substream)
+@@ -1257,19 +1253,12 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
+       mutex_lock(&spec->pcm_lock);
+       pin_idx = hinfo_to_pin_index(codec, hinfo);
+-      if (!spec->dyn_pcm_assign) {
+-              if (snd_BUG_ON(pin_idx < 0)) {
+-                      err = -EINVAL;
+-                      goto unlock;
+-              }
+-      } else {
+-              /* no pin is assigned to the PCM
+-               * PA need pcm open successfully when probe
+-               */
+-              if (pin_idx < 0) {
+-                      err = hdmi_pcm_open_no_pin(hinfo, codec, substream);
+-                      goto unlock;
+-              }
++      /* no pin is assigned to the PCM
++       * PA need pcm open successfully when probe
++       */
++      if (pin_idx < 0) {
++              err = hdmi_pcm_open_no_pin(hinfo, codec, substream);
++              goto unlock;
+       }
+       err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx, false);
+@@ -1374,43 +1363,6 @@ static int hdmi_find_pcm_slot(struct hdmi_spec *spec,
+ {
+       int i;
+-      /* on the new machines, try to assign the pcm slot dynamically,
+-       * not use the preferred fixed map (legacy way) anymore.
+-       */
+-      if (spec->dyn_pcm_no_legacy)
+-              goto last_try;
+-
+-      /*
+-       * generic_hdmi_build_pcms() may allocate extra PCMs on some
+-       * platforms (with maximum of 'num_nids + dev_num - 1')
+-       *
+-       * The per_pin of pin_nid_idx=n and dev_id=m prefers to get pcm-n
+-       * if m==0. This guarantees that dynamic pcm assignments are compatible
+-       * with the legacy static per_pin-pcm assignment that existed in the
+-       * days before DP-MST.
+-       *
+-       * Intel DP-MST prefers this legacy behavior for compatibility, too.
+-       *
+-       * per_pin of m!=0 prefers to get pcm=(num_nids + (m - 1)).
+-       */
+-
+-      if (per_pin->dev_id == 0 || spec->intel_hsw_fixup) {
+-              if (!test_bit(per_pin->pin_nid_idx, &spec->pcm_bitmap))
+-                      return per_pin->pin_nid_idx;
+-      } else {
+-              i = spec->num_nids + (per_pin->dev_id - 1);
+-              if (i < spec->pcm_used && !(test_bit(i, &spec->pcm_bitmap)))
+-                      return i;
+-      }
+-
+-      /* have a second try; check the area over num_nids */
+-      for (i = spec->num_nids; i < spec->pcm_used; i++) {
+-              if (!test_bit(i, &spec->pcm_bitmap))
+-                      return i;
+-      }
+-
+- last_try:
+-      /* the last try; check the empty slots in pins */
+       for (i = 0; i < spec->pcm_used; i++) {
+               if (!test_bit(i, &spec->pcm_bitmap))
+                       return i;
+@@ -1573,14 +1525,12 @@ static void update_eld(struct hda_codec *codec,
+        */
+       pcm_jack = pin_idx_to_pcm_jack(codec, per_pin);
+-      if (spec->dyn_pcm_assign) {
+-              if (eld->eld_valid) {
+-                      hdmi_attach_hda_pcm(spec, per_pin);
+-                      hdmi_pcm_setup_pin(spec, per_pin);
+-              } else {
+-                      hdmi_pcm_reset_pin(spec, per_pin);
+-                      hdmi_detach_hda_pcm(spec, per_pin);
+-              }
++      if (eld->eld_valid) {
++              hdmi_attach_hda_pcm(spec, per_pin);
++              hdmi_pcm_setup_pin(spec, per_pin);
++      } else {
++              hdmi_pcm_reset_pin(spec, per_pin);
++              hdmi_detach_hda_pcm(spec, per_pin);
+       }
+       /* if pcm_idx == -1, it means this is in monitor connection event
+        * we can get the correct pcm_idx now.
+@@ -1943,7 +1893,7 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
+                * structures based on worst case.
+                */
+               dev_num = spec->dev_num;
+-      } else if (spec->dyn_pcm_assign && codec->dp_mst) {
++      } else if (codec->dp_mst) {
+               dev_num = snd_hda_get_num_devices(codec, pin_nid) + 1;
+               /*
+                * spec->dev_num is the maxinum number of device entries
+@@ -1968,13 +1918,8 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
+               if (!per_pin)
+                       return -ENOMEM;
+-              if (spec->dyn_pcm_assign) {
+-                      per_pin->pcm = NULL;
+-                      per_pin->pcm_idx = -1;
+-              } else {
+-                      per_pin->pcm = get_hdmi_pcm(spec, pin_idx);
+-                      per_pin->pcm_idx = pin_idx;
+-              }
++              per_pin->pcm = NULL;
++              per_pin->pcm_idx = -1;
+               per_pin->pin_nid = pin_nid;
+               per_pin->pin_nid_idx = spec->num_nids;
+               per_pin->dev_id = i;
+@@ -1983,6 +1928,8 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
+               err = hdmi_read_pin_conn(codec, pin_idx);
+               if (err < 0)
+                       return err;
++              if (!is_jack_detectable(codec, pin_nid))
++                      codec_warn(codec, "HDMI: pin NID 0x%x - jack not detectable\n", pin_nid);
+               spec->num_pins++;
+       }
+       spec->num_nids++;
+@@ -2130,10 +2077,9 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
+       mutex_lock(&spec->pcm_lock);
+       pin_idx = hinfo_to_pin_index(codec, hinfo);
+-      if (spec->dyn_pcm_assign && pin_idx < 0) {
+-              /* when dyn_pcm_assign and pcm is not bound to a pin
+-               * skip pin setup and return 0 to make audio playback
+-               * be ongoing
++      if (pin_idx < 0) {
++              /* when pcm is not bound to a pin skip pin setup and return 0
++               * to make audio playback be ongoing
+                */
+               pin_cvt_fixup(codec, NULL, cvt_nid);
+               snd_hda_codec_setup_stream(codec, cvt_nid,
+@@ -2236,7 +2182,7 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo,
+               snd_hda_spdif_ctls_unassign(codec, pcm_idx);
+               clear_bit(pcm_idx, &spec->pcm_in_use);
+               pin_idx = hinfo_to_pin_index(codec, hinfo);
+-              if (spec->dyn_pcm_assign && pin_idx < 0)
++              if (pin_idx < 0)
+                       goto unlock;
+               if (snd_BUG_ON(pin_idx < 0)) {
+@@ -2334,21 +2280,8 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec)
+       struct hdmi_spec *spec = codec->spec;
+       int idx, pcm_num;
+-      /*
+-       * for non-mst mode, pcm number is the same as before
+-       * for DP MST mode without extra PCM, pcm number is same
+-       * for DP MST mode with extra PCMs, pcm number is
+-       *  (nid number + dev_num - 1)
+-       * dev_num is the device entry number in a pin
+-       */
+-
+-      if (spec->dyn_pcm_no_legacy && codec->mst_no_extra_pcms)
+-              pcm_num = spec->num_cvts;
+-      else if (codec->mst_no_extra_pcms)
+-              pcm_num = spec->num_nids;
+-      else
+-              pcm_num = spec->num_nids + spec->dev_num - 1;
+-
++      /* limit the PCM devices to the codec converters */
++      pcm_num = spec->num_cvts;
+       codec_dbg(codec, "hdmi: pcm_num set to %d\n", pcm_num);
+       for (idx = 0; idx < pcm_num; idx++) {
+@@ -2387,17 +2320,12 @@ static int generic_hdmi_build_jack(struct hda_codec *codec, int pcm_idx)
+ {
+       char hdmi_str[32] = "HDMI/DP";
+       struct hdmi_spec *spec = codec->spec;
+-      struct hdmi_spec_per_pin *per_pin = get_pin(spec, pcm_idx);
+       struct snd_jack *jack;
+       int pcmdev = get_pcm_rec(spec, pcm_idx)->device;
+       int err;
+       if (pcmdev > 0)
+               sprintf(hdmi_str + strlen(hdmi_str), ",pcm=%d", pcmdev);
+-      if (!spec->dyn_pcm_assign &&
+-          !is_jack_detectable(codec, per_pin->pin_nid))
+-              strncat(hdmi_str, " Phantom",
+-                      sizeof(hdmi_str) - strlen(hdmi_str) - 1);
+       err = snd_jack_new(codec->card, hdmi_str, SND_JACK_AVOUT, &jack,
+                          true, false);
+@@ -2430,18 +2358,9 @@ static int generic_hdmi_build_controls(struct hda_codec *codec)
+               /* create the spdif for each pcm
+                * pin will be bound when monitor is connected
+                */
+-              if (spec->dyn_pcm_assign)
+-                      err = snd_hda_create_dig_out_ctls(codec,
++              err = snd_hda_create_dig_out_ctls(codec,
+                                         0, spec->cvt_nids[0],
+                                         HDA_PCM_TYPE_HDMI);
+-              else {
+-                      struct hdmi_spec_per_pin *per_pin =
+-                              get_pin(spec, pcm_idx);
+-                      err = snd_hda_create_dig_out_ctls(codec,
+-                                                per_pin->pin_nid,
+-                                                per_pin->mux_nids[0],
+-                                                HDA_PCM_TYPE_HDMI);
+-              }
+               if (err < 0)
+                       return err;
+               snd_hda_spdif_ctls_unassign(codec, pcm_idx);
+@@ -2561,11 +2480,7 @@ static void generic_hdmi_free(struct hda_codec *codec)
+       for (pcm_idx = 0; pcm_idx < spec->pcm_used; pcm_idx++) {
+               if (spec->pcm_rec[pcm_idx].jack == NULL)
+                       continue;
+-              if (spec->dyn_pcm_assign)
+-                      snd_device_free(codec->card,
+-                                      spec->pcm_rec[pcm_idx].jack);
+-              else
+-                      spec->pcm_rec[pcm_idx].jack = NULL;
++              snd_device_free(codec->card, spec->pcm_rec[pcm_idx].jack);
+       }
+       generic_spec_free(codec);
+@@ -3063,7 +2978,6 @@ static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid,
+               return err;
+       spec = codec->spec;
+       codec->dp_mst = true;
+-      spec->dyn_pcm_assign = true;
+       spec->vendor_nid = vendor_nid;
+       spec->port_map = port_map;
+       spec->port_num = port_num;
+@@ -3127,17 +3041,9 @@ static int patch_i915_tgl_hdmi(struct hda_codec *codec)
+        * the index indicate the port number.
+        */
+       static const int map[] = {0x4, 0x6, 0x8, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf};
+-      int ret;
+-
+-      ret = intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map), 4,
+-                                  enable_silent_stream);
+-      if (!ret) {
+-              struct hdmi_spec *spec = codec->spec;
+-              spec->dyn_pcm_no_legacy = true;
+-      }
+-
+-      return ret;
++      return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map), 4,
++                                   enable_silent_stream);
+ }
+ static int patch_i915_adlp_hdmi(struct hda_codec *codec)
+@@ -3777,7 +3683,6 @@ static int patch_nvhdmi(struct hda_codec *codec)
+       codec->dp_mst = true;
+       spec = codec->spec;
+-      spec->dyn_pcm_assign = true;
+       err = hdmi_parse_codec(codec);
+       if (err < 0) {
+@@ -4057,10 +3962,8 @@ static int patch_tegra234_hdmi(struct hda_codec *codec)
+               return err;
+       codec->dp_mst = true;
+-      codec->mst_no_extra_pcms = true;
+       spec = codec->spec;
+       spec->dyn_pin_out = true;
+-      spec->dyn_pcm_assign = true;
+       spec->hdmi_intr_trig_ctrl = true;
+       return tegra_hdmi_init(codec);
+diff --git a/sound/soc/codecs/hda.c b/sound/soc/codecs/hda.c
+index ad20a3dff9b7..61e8e9be6b8d 100644
+--- a/sound/soc/codecs/hda.c
++++ b/sound/soc/codecs/hda.c
+@@ -224,9 +224,6 @@ static int hda_codec_probe(struct snd_soc_component *component)
+               goto err;
+       }
+-      /* configure codec for 1:1 PCM:DAI mapping */
+-      codec->mst_no_extra_pcms = 1;
+-
+       ret = snd_hda_codec_parse_pcms(codec);
+       if (ret < 0) {
+               dev_err(&hdev->dev, "unable to map pcms to dai %d\n", ret);
+diff --git a/sound/soc/codecs/hdac_hda.c b/sound/soc/codecs/hdac_hda.c
+index 8debcee59224..7876bdd558a7 100644
+--- a/sound/soc/codecs/hdac_hda.c
++++ b/sound/soc/codecs/hdac_hda.c
+@@ -461,9 +461,6 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component)
+               dev_dbg(&hdev->dev, "no patch file found\n");
+       }
+-      /* configure codec for 1:1 PCM:DAI mapping */
+-      hcodec->mst_no_extra_pcms = 1;
+-
+       ret = snd_hda_codec_parse_pcms(hcodec);
+       if (ret < 0) {
+               dev_err(&hdev->dev, "unable to map pcms to dai %d\n", ret);
+-- 
+2.35.1
+
diff --git a/queue-6.0/asoc-audio-graph-card-fix-refcount-leak-of-cpu_ep-in.patch b/queue-6.0/asoc-audio-graph-card-fix-refcount-leak-of-cpu_ep-in.patch
new file mode 100644 (file)
index 0000000..007d19c
--- /dev/null
@@ -0,0 +1,43 @@
+From ed971b085424c654df2f30efd3f9aebb0040db0f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 5 Dec 2022 16:15:27 +0800
+Subject: ASoC: audio-graph-card: fix refcount leak of cpu_ep in
+ __graph_for_each_link()
+
+From: Wang Yufen <wangyufen@huawei.com>
+
+[ Upstream commit 8ab2d12c726f0fde0692fa5d81d8019b3dcd62d0 ]
+
+The of_get_next_child() returns a node with refcount incremented, and
+decrements the refcount of prev. So in the error path of the while loop,
+of_node_put() needs be called for cpu_ep.
+
+Fixes: fce9b90c1ab7 ("ASoC: audio-graph-card: cleanup DAI link loop method - step2")
+Signed-off-by: Wang Yufen <wangyufen@huawei.com>
+Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Link: https://lore.kernel.org/r/1670228127-13835-1-git-send-email-wangyufen@huawei.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/generic/audio-graph-card.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
+index b327372f2e4a..4e776c2a38a4 100644
+--- a/sound/soc/generic/audio-graph-card.c
++++ b/sound/soc/generic/audio-graph-card.c
+@@ -485,8 +485,10 @@ static int __graph_for_each_link(struct asoc_simple_priv *priv,
+                       of_node_put(codec_ep);
+                       of_node_put(codec_port);
+-                      if (ret < 0)
++                      if (ret < 0) {
++                              of_node_put(cpu_ep);
+                               return ret;
++                      }
+                       codec_port_old = codec_port;
+               }
+-- 
+2.35.1
+
diff --git a/queue-6.0/asoc-intel-skylake-fix-driver-hang-during-shutdown.patch b/queue-6.0/asoc-intel-skylake-fix-driver-hang-during-shutdown.patch
new file mode 100644 (file)
index 0000000..c336a82
--- /dev/null
@@ -0,0 +1,41 @@
+From bef5f04ed89a1296bcfeeccf1a814e082e4b4741 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 5 Dec 2022 09:53:29 +0100
+Subject: ASoC: Intel: Skylake: Fix driver hang during shutdown
+
+From: Cezary Rojewski <cezary.rojewski@intel.com>
+
+[ Upstream commit 171107237246d66bce04f3769d33648f896b4ce3 ]
+
+AudioDSP cores and HDAudio links need to be turned off on shutdown to
+ensure no communication or data transfer occurs during the procedure.
+
+Fixes: c5a76a246989 ("ASoC: Intel: Skylake: Add shutdown callback")
+Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
+Tested-by: Lukasz Majczak <lma@semihlaf.com>
+Link: https://lore.kernel.org/r/20221205085330.857665-6-cezary.rojewski@intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/intel/skylake/skl.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
+index aeca58246fc7..77cd7d3e9409 100644
+--- a/sound/soc/intel/skylake/skl.c
++++ b/sound/soc/intel/skylake/skl.c
+@@ -1097,7 +1097,10 @@ static void skl_shutdown(struct pci_dev *pci)
+       if (!skl->init_done)
+               return;
+-      snd_hdac_stop_streams_and_chip(bus);
++      snd_hdac_stop_streams(bus);
++      snd_hdac_ext_bus_link_power_down_all(bus);
++      skl_dsp_sleep(skl->dsp);
++
+       list_for_each_entry(s, &bus->stream_list, list) {
+               stream = stream_to_hdac_ext_stream(s);
+               snd_hdac_ext_stream_decouple(bus, stream, false);
+-- 
+2.35.1
+
diff --git a/queue-6.0/asoc-mediatek-mt8173-rt5650-rt5514-fix-refcount-leak.patch b/queue-6.0/asoc-mediatek-mt8173-rt5650-rt5514-fix-refcount-leak.patch
new file mode 100644 (file)
index 0000000..e407ae6
--- /dev/null
@@ -0,0 +1,57 @@
+From 9e85dffc2c6c25d674e24b47c29c68f4adec9b90 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 5 Dec 2022 18:04:24 +0800
+Subject: ASoC: mediatek: mt8173-rt5650-rt5514: fix refcount leak in
+ mt8173_rt5650_rt5514_dev_probe()
+
+From: Wang Yufen <wangyufen@huawei.com>
+
+[ Upstream commit 3327d721114c109ba0575f86f8fda3b525404054 ]
+
+The node returned by of_parse_phandle() with refcount incremented,
+of_node_put() needs be called when finish using it. So add it in the
+error path in mt8173_rt5650_rt5514_dev_probe().
+
+Fixes: 0d1d7a664288 ("ASoC: mediatek: Refine mt8173 driver and change config option")
+Signed-off-by: Wang Yufen <wangyufen@huawei.com>
+Link: https://lore.kernel.org/r/1670234664-24246-1-git-send-email-wangyufen@huawei.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c
+index 12f40c81b101..f803f121659d 100644
+--- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c
++++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c
+@@ -200,14 +200,16 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platform_device *pdev)
+       if (!mt8173_rt5650_rt5514_dais[DAI_LINK_CODEC_I2S].codecs[0].of_node) {
+               dev_err(&pdev->dev,
+                       "Property 'audio-codec' missing or invalid\n");
+-              return -EINVAL;
++              ret = -EINVAL;
++              goto out;
+       }
+       mt8173_rt5650_rt5514_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node =
+               of_parse_phandle(pdev->dev.of_node, "mediatek,audio-codec", 1);
+       if (!mt8173_rt5650_rt5514_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node) {
+               dev_err(&pdev->dev,
+                       "Property 'audio-codec' missing or invalid\n");
+-              return -EINVAL;
++              ret = -EINVAL;
++              goto out;
+       }
+       mt8173_rt5650_rt5514_codec_conf[0].dlc.of_node =
+               mt8173_rt5650_rt5514_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node;
+@@ -216,6 +218,7 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platform_device *pdev)
+       ret = devm_snd_soc_register_card(&pdev->dev, card);
++out:
+       of_node_put(platform_node);
+       return ret;
+ }
+-- 
+2.35.1
+
diff --git a/queue-6.0/asoc-mediatek-mt8183-fix-refcount-leak-in-mt8183_mt6.patch b/queue-6.0/asoc-mediatek-mt8183-fix-refcount-leak-in-mt8183_mt6.patch
new file mode 100644 (file)
index 0000000..d6baeda
--- /dev/null
@@ -0,0 +1,73 @@
+From 5103173220ee0c92e16734707eb6bf16d20914bc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 5 Dec 2022 17:56:28 +0800
+Subject: ASoC: mediatek: mt8183: fix refcount leak in
+ mt8183_mt6358_ts3a227_max98357_dev_probe()
+
+From: Wang Yufen <wangyufen@huawei.com>
+
+[ Upstream commit 38eef3be38ab895959c442702864212cc3beb96c ]
+
+The node returned by of_parse_phandle() with refcount incremented,
+of_node_put() needs be called when finish using it. So add it in the
+error path in mt8183_mt6358_ts3a227_max98357_dev_probe().
+
+Fixes: 11c0269017b2 ("ASoC: Mediatek: MT8183: Add machine driver with TS3A227")
+Signed-off-by: Wang Yufen <wangyufen@huawei.com>
+Link: https://lore.kernel.org/r/1670234188-23596-1-git-send-email-wangyufen@huawei.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../mt8183/mt8183-mt6358-ts3a227-max98357.c        | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
+index ab157db78335..cfb463f44af7 100644
+--- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
++++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
+@@ -644,8 +644,10 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev)
+       }
+       card = (struct snd_soc_card *)of_device_get_match_data(&pdev->dev);
+-      if (!card)
++      if (!card) {
++              of_node_put(platform_node);
+               return -EINVAL;
++      }
+       card->dev = &pdev->dev;
+       ec_codec = of_parse_phandle(pdev->dev.of_node, "mediatek,ec-codec", 0);
+@@ -734,8 +736,10 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev)
+       }
+       priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+-      if (!priv)
+-              return -ENOMEM;
++      if (!priv) {
++              ret = -ENOMEM;
++              goto out;
++      }
+       snd_soc_card_set_drvdata(card, priv);
+@@ -743,7 +747,8 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev)
+       if (IS_ERR(priv->pinctrl)) {
+               dev_err(&pdev->dev, "%s devm_pinctrl_get failed\n",
+                       __func__);
+-              return PTR_ERR(priv->pinctrl);
++              ret = PTR_ERR(priv->pinctrl);
++              goto out;
+       }
+       for (i = 0; i < PIN_STATE_MAX; i++) {
+@@ -776,6 +781,7 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev)
+       ret = devm_snd_soc_register_card(&pdev->dev, card);
++out:
+       of_node_put(platform_node);
+       of_node_put(ec_codec);
+       of_node_put(hdmi_codec);
+-- 
+2.35.1
+
diff --git a/queue-6.0/asoc-rockchip-pdm-add-missing-clk_disable_unprepare-.patch b/queue-6.0/asoc-rockchip-pdm-add-missing-clk_disable_unprepare-.patch
new file mode 100644 (file)
index 0000000..162ba58
--- /dev/null
@@ -0,0 +1,37 @@
+From bbe584c77fa8949649b20944996345ebf537e7d8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 5 Dec 2022 11:28:02 +0800
+Subject: ASoC: rockchip: pdm: Add missing clk_disable_unprepare() in
+ rockchip_pdm_runtime_resume()
+
+From: Wang Jingjin <wangjingjin1@huawei.com>
+
+[ Upstream commit ef0a098efb36660326c133af9b5a04a96a00e3ca ]
+
+The clk_disable_unprepare() should be called in the error handling of
+rockchip_pdm_runtime_resume().
+
+Fixes: fc05a5b22253 ("ASoC: rockchip: add support for pdm controller")
+Signed-off-by: Wang Jingjin <wangjingjin1@huawei.com>
+Link: https://lore.kernel.org/r/20221205032802.2422983-1-wangjingjin1@huawei.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/rockchip/rockchip_pdm.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/sound/soc/rockchip/rockchip_pdm.c b/sound/soc/rockchip/rockchip_pdm.c
+index a7549f827235..5b1e47bdc376 100644
+--- a/sound/soc/rockchip/rockchip_pdm.c
++++ b/sound/soc/rockchip/rockchip_pdm.c
+@@ -431,6 +431,7 @@ static int rockchip_pdm_runtime_resume(struct device *dev)
+       ret = clk_prepare_enable(pdm->hclk);
+       if (ret) {
++              clk_disable_unprepare(pdm->clk);
+               dev_err(pdm->dev, "hclock enable failed %d\n", ret);
+               return ret;
+       }
+-- 
+2.35.1
+
diff --git a/queue-6.0/asoc-rockchip-spdif-add-missing-clk_disable_unprepar.patch b/queue-6.0/asoc-rockchip-spdif-add-missing-clk_disable_unprepar.patch
new file mode 100644 (file)
index 0000000..9f5095b
--- /dev/null
@@ -0,0 +1,37 @@
+From 9ad7606367ecbdeafbea0ed6aa04bcb0d5279cca Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 8 Dec 2022 14:39:00 +0800
+Subject: ASoC: rockchip: spdif: Add missing clk_disable_unprepare() in
+ rk_spdif_runtime_resume()
+
+From: Wang Jingjin <wangjingjin1@huawei.com>
+
+[ Upstream commit 6d94d0090527b1763872275a7ccd44df7219b31e ]
+
+rk_spdif_runtime_resume() may have called clk_prepare_enable() before return
+from failed branches, add missing clk_disable_unprepare() in this case.
+
+Fixes: f874b80e1571 ("ASoC: rockchip: Add rockchip SPDIF transceiver driver")
+Signed-off-by: Wang Jingjin <wangjingjin1@huawei.com>
+Link: https://lore.kernel.org/r/20221208063900.4180790-1-wangjingjin1@huawei.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/rockchip/rockchip_spdif.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/sound/soc/rockchip/rockchip_spdif.c b/sound/soc/rockchip/rockchip_spdif.c
+index 8bef572d3cbc..5b4f00457587 100644
+--- a/sound/soc/rockchip/rockchip_spdif.c
++++ b/sound/soc/rockchip/rockchip_spdif.c
+@@ -88,6 +88,7 @@ static int __maybe_unused rk_spdif_runtime_resume(struct device *dev)
+       ret = clk_prepare_enable(spdif->hclk);
+       if (ret) {
++              clk_disable_unprepare(spdif->mclk);
+               dev_err(spdif->dev, "hclk clock enable failed %d\n", ret);
+               return ret;
+       }
+-- 
+2.35.1
+
diff --git a/queue-6.0/asoc-rt5670-remove-unbalanced-pm_runtime_put.patch b/queue-6.0/asoc-rt5670-remove-unbalanced-pm_runtime_put.patch
new file mode 100644 (file)
index 0000000..0fd61d8
--- /dev/null
@@ -0,0 +1,42 @@
+From 87c0b936a9d317a195256910a60dc1fb0d4a9d0b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 13 Dec 2022 13:33:19 +0100
+Subject: ASoC: rt5670: Remove unbalanced pm_runtime_put()
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+[ Upstream commit 6c900dcc3f7331a67ed29739d74524e428d137fb ]
+
+For some reason rt5670_i2c_probe() does a pm_runtime_put() at the end
+of a successful probe. But it has never done a pm_runtime_get() leading
+to the following error being logged into dmesg:
+
+ rt5670 i2c-10EC5640:00: Runtime PM usage count underflow!
+
+Fix this by removing the unnecessary pm_runtime_put().
+
+Fixes: 64e89e5f5548 ("ASoC: rt5670: Add runtime PM support")
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Link: https://lore.kernel.org/r/20221213123319.11285-1-hdegoede@redhat.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/rt5670.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c
+index 60dbfa2a54f1..c75045e371b2 100644
+--- a/sound/soc/codecs/rt5670.c
++++ b/sound/soc/codecs/rt5670.c
+@@ -3311,8 +3311,6 @@ static int rt5670_i2c_probe(struct i2c_client *i2c)
+       if (ret < 0)
+               goto err;
+-      pm_runtime_put(&i2c->dev);
+-
+       return 0;
+ err:
+       pm_runtime_disable(&i2c->dev);
+-- 
+2.35.1
+
diff --git a/queue-6.0/asoc-sof_es8336-fix-possible-use-after-free-in-sof_e.patch b/queue-6.0/asoc-sof_es8336-fix-possible-use-after-free-in-sof_e.patch
new file mode 100644 (file)
index 0000000..41ed926
--- /dev/null
@@ -0,0 +1,45 @@
+From dc117e99cf9871eb35beb8bef729091970de6055 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 5 Dec 2022 22:37:21 +0800
+Subject: ASoC: sof_es8336: fix possible use-after-free in sof_es8336_remove()
+
+From: Yang Yingliang <yangyingliang@huawei.com>
+
+[ Upstream commit 1b41beaa7a58467505ec3023af8aad74f878b888 ]
+
+sof_es8336_remove() calls cancel_delayed_work(). However, that
+function does not wait until the work function finishes. This
+means that the callback function may still be running after
+the driver's remove function has finished, which would result
+in a use-after-free.
+
+Fix by calling cancel_delayed_work_sync(), which ensures that
+the work is properly cancelled, no longer running, and unable
+to re-schedule itself.
+
+Fixes: 89cdb224f2ab ("ASoC: sof_es8336: reduce pop noise on speaker")
+Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
+Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20221205143721.3988988-1-yangyingliang@huawei.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/intel/boards/sof_es8336.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/sof_es8336.c
+index 5c218a39ca20..57adcefce043 100644
+--- a/sound/soc/intel/boards/sof_es8336.c
++++ b/sound/soc/intel/boards/sof_es8336.c
+@@ -782,7 +782,7 @@ static int sof_es8336_remove(struct platform_device *pdev)
+       struct snd_soc_card *card = platform_get_drvdata(pdev);
+       struct sof_es8336_private *priv = snd_soc_card_get_drvdata(card);
+-      cancel_delayed_work(&priv->pcm_pop_work);
++      cancel_delayed_work_sync(&priv->pcm_pop_work);
+       gpiod_put(priv->gpio_speakers);
+       device_remove_software_node(priv->codec_dev);
+       put_device(priv->codec_dev);
+-- 
+2.35.1
+
diff --git a/queue-6.0/asoc-wm8994-fix-potential-deadlock.patch b/queue-6.0/asoc-wm8994-fix-potential-deadlock.patch
new file mode 100644 (file)
index 0000000..dfdea60
--- /dev/null
@@ -0,0 +1,42 @@
+From c6d9453bb4e99c3e2d91fba2bd79a1a0ed5d982c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 9 Dec 2022 10:16:57 +0100
+Subject: ASoC: wm8994: Fix potential deadlock
+
+From: Marek Szyprowski <m.szyprowski@samsung.com>
+
+[ Upstream commit 9529dc167ffcdfd201b9f0eda71015f174095f7e ]
+
+Fix this by dropping wm8994->accdet_lock while calling
+cancel_delayed_work_sync(&wm8994->mic_work) in wm1811_jackdet_irq().
+
+Fixes: c0cc3f166525 ("ASoC: wm8994: Allow a delay between jack insertion and microphone detect")
+Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
+Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
+Link: https://lore.kernel.org/r/20221209091657.1183-1-m.szyprowski@samsung.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/wm8994.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
+index d3cfd3788f2a..8fe9a75d1235 100644
+--- a/sound/soc/codecs/wm8994.c
++++ b/sound/soc/codecs/wm8994.c
+@@ -3853,7 +3853,12 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data)
+       } else {
+               dev_dbg(component->dev, "Jack not detected\n");
++              /* Release wm8994->accdet_lock to avoid deadlock:
++               * cancel_delayed_work_sync() takes wm8994->mic_work internal
++               * lock and wm1811_mic_work takes wm8994->accdet_lock */
++              mutex_unlock(&wm8994->accdet_lock);
+               cancel_delayed_work_sync(&wm8994->mic_work);
++              mutex_lock(&wm8994->accdet_lock);
+               snd_soc_component_update_bits(component, WM8958_MICBIAS2,
+                                   WM8958_MICB2_DISCH, WM8958_MICB2_DISCH);
+-- 
+2.35.1
+
diff --git a/queue-6.0/drm-amd-pm-avoid-large-variable-on-kernel-stack.patch b/queue-6.0/drm-amd-pm-avoid-large-variable-on-kernel-stack.patch
new file mode 100644 (file)
index 0000000..45ee035
--- /dev/null
@@ -0,0 +1,90 @@
+From 99a2a4681af9cb8e5f7459341ceef24bca21cc46 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 15 Dec 2022 17:36:31 +0100
+Subject: drm/amd/pm: avoid large variable on kernel stack
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+[ Upstream commit d118b18fb1da02b41df2da78cb2794b3638d89cd ]
+
+The activity_monitor_external[] array is too big to fit on the
+kernel stack, resulting in this warning with clang:
+
+drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_7_ppt.c:1438:12: error: stack frame size (1040) exceeds limit (1024) in 'smu_v13_0_7_get_power_profile_mode' [-Werror,-Wframe-larger-than]
+
+Use dynamic allocation instead. It should also be possible to
+have single element here instead of the array, but this seems
+easier.
+
+v2: fix up argument to sizeof() (Alex)
+
+Fixes: 334682ae8151 ("drm/amd/pm: enable workload type change on smu_v13_0_7")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 21 ++++++++++++++-----
+ 1 file changed, 16 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
+index d74debc584f8..39deb06a86ba 100644
+--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
++++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
+@@ -1436,7 +1436,7 @@ static int smu_v13_0_7_get_power_limit(struct smu_context *smu,
+ static int smu_v13_0_7_get_power_profile_mode(struct smu_context *smu, char *buf)
+ {
+-      DpmActivityMonitorCoeffIntExternal_t activity_monitor_external[PP_SMC_POWER_PROFILE_COUNT];
++      DpmActivityMonitorCoeffIntExternal_t *activity_monitor_external;
+       uint32_t i, j, size = 0;
+       int16_t workload_type = 0;
+       int result = 0;
+@@ -1444,6 +1444,12 @@ static int smu_v13_0_7_get_power_profile_mode(struct smu_context *smu, char *buf
+       if (!buf)
+               return -EINVAL;
++      activity_monitor_external = kcalloc(PP_SMC_POWER_PROFILE_COUNT,
++                                          sizeof(*activity_monitor_external),
++                                          GFP_KERNEL);
++      if (!activity_monitor_external)
++              return -ENOMEM;
++
+       size += sysfs_emit_at(buf, size, "                              ");
+       for (i = 0; i <= PP_SMC_POWER_PROFILE_WINDOW3D; i++)
+               size += sysfs_emit_at(buf, size, "%-14s%s", amdgpu_pp_profile_name[i],
+@@ -1456,15 +1462,17 @@ static int smu_v13_0_7_get_power_profile_mode(struct smu_context *smu, char *buf
+               workload_type = smu_cmn_to_asic_specific_index(smu,
+                                                              CMN2ASIC_MAPPING_WORKLOAD,
+                                                              i);
+-              if (workload_type < 0)
+-                      return -EINVAL;
++              if (workload_type < 0) {
++                      result = -EINVAL;
++                      goto out;
++              }
+               result = smu_cmn_update_table(smu,
+                                         SMU_TABLE_ACTIVITY_MONITOR_COEFF, workload_type,
+                                         (void *)(&activity_monitor_external[i]), false);
+               if (result) {
+                       dev_err(smu->adev->dev, "[%s] Failed to get activity monitor!", __func__);
+-                      return result;
++                      goto out;
+               }
+       }
+@@ -1492,7 +1500,10 @@ do {                                                                                                    \
+       PRINT_DPM_MONITOR(Fclk_BoosterFreq);
+ #undef PRINT_DPM_MONITOR
+-      return size;
++      result = size;
++out:
++      kfree(activity_monitor_external);
++      return result;
+ }
+ static int smu_v13_0_7_set_power_profile_mode(struct smu_context *smu, long *input, uint32_t size)
+-- 
+2.35.1
+
diff --git a/queue-6.0/drm-i915-display-don-t-disable-ddi-transcoder-when-s.patch b/queue-6.0/drm-i915-display-don-t-disable-ddi-transcoder-when-s.patch
new file mode 100644 (file)
index 0000000..cabddd1
--- /dev/null
@@ -0,0 +1,122 @@
+From b4c02562e43e647c931bab0061c623ddc976cc98 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 23 Nov 2022 14:09:26 -0800
+Subject: drm/i915/display: Don't disable DDI/Transcoder when setting phy test
+ pattern
+
+From: Khaled Almahallawy <khaled.almahallawy@intel.com>
+
+[ Upstream commit 3153eebb7a76e663ac76d6670dc113296de96622 ]
+
+Bspecs has updated recently to remove the restriction to disable
+DDI/Transcoder before setting PHY test pattern. This update is to
+address PHY compliance test failures observed on a port with LTTPR.
+The issue is that when Transc. is disabled, the main link signals fed
+to LTTPR will be dropped invalidating link training, which will affect
+the quality of the phy test pattern when the transcoder is enabled again.
+
+v2: Update commit message (Clint)
+v3: Add missing Signed-off in v2
+v4: Update Bspec and commit message for pre-gen12 (Jani)
+
+Bspec: 50482, 7555
+Fixes: 8cdf72711928 ("drm/i915/dp: Program vswing, pre-emphasis, test-pattern")
+Cc: Imre Deak <imre.deak@intel.com>
+Cc: Clint Taylor <clinton.a.taylor@intel.com>
+CC: Jani Nikula <jani.nikula@intel.com>
+Tested-by: Khaled Almahallawy <khaled.almahallawy@intel.com>
+Reviewed-by: Clint Taylor <clinton.a.taylor@intel.com>
+Signed-off-by: Khaled Almahallawy <khaled.almahallawy@intel.com>
+Signed-off-by: Jani Nikula <jani.nikula@intel.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20221123220926.170034-1-khaled.almahallawy@intel.com
+(cherry picked from commit be4a847652056b067d6dc6fe0fc024a9e2e987ca)
+Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/i915/display/intel_dp.c | 59 -------------------------
+ 1 file changed, 59 deletions(-)
+
+diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
+index 21ba510716b6..d852cfd1d6eb 100644
+--- a/drivers/gpu/drm/i915/display/intel_dp.c
++++ b/drivers/gpu/drm/i915/display/intel_dp.c
+@@ -3641,61 +3641,6 @@ static void intel_dp_phy_pattern_update(struct intel_dp *intel_dp,
+       }
+ }
+-static void
+-intel_dp_autotest_phy_ddi_disable(struct intel_dp *intel_dp,
+-                                const struct intel_crtc_state *crtc_state)
+-{
+-      struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+-      struct drm_device *dev = dig_port->base.base.dev;
+-      struct drm_i915_private *dev_priv = to_i915(dev);
+-      struct intel_crtc *crtc = to_intel_crtc(dig_port->base.base.crtc);
+-      enum pipe pipe = crtc->pipe;
+-      u32 trans_ddi_func_ctl_value, trans_conf_value, dp_tp_ctl_value;
+-
+-      trans_ddi_func_ctl_value = intel_de_read(dev_priv,
+-                                               TRANS_DDI_FUNC_CTL(pipe));
+-      trans_conf_value = intel_de_read(dev_priv, PIPECONF(pipe));
+-      dp_tp_ctl_value = intel_de_read(dev_priv, TGL_DP_TP_CTL(pipe));
+-
+-      trans_ddi_func_ctl_value &= ~(TRANS_DDI_FUNC_ENABLE |
+-                                    TGL_TRANS_DDI_PORT_MASK);
+-      trans_conf_value &= ~PIPECONF_ENABLE;
+-      dp_tp_ctl_value &= ~DP_TP_CTL_ENABLE;
+-
+-      intel_de_write(dev_priv, PIPECONF(pipe), trans_conf_value);
+-      intel_de_write(dev_priv, TRANS_DDI_FUNC_CTL(pipe),
+-                     trans_ddi_func_ctl_value);
+-      intel_de_write(dev_priv, TGL_DP_TP_CTL(pipe), dp_tp_ctl_value);
+-}
+-
+-static void
+-intel_dp_autotest_phy_ddi_enable(struct intel_dp *intel_dp,
+-                               const struct intel_crtc_state *crtc_state)
+-{
+-      struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+-      struct drm_device *dev = dig_port->base.base.dev;
+-      struct drm_i915_private *dev_priv = to_i915(dev);
+-      enum port port = dig_port->base.port;
+-      struct intel_crtc *crtc = to_intel_crtc(dig_port->base.base.crtc);
+-      enum pipe pipe = crtc->pipe;
+-      u32 trans_ddi_func_ctl_value, trans_conf_value, dp_tp_ctl_value;
+-
+-      trans_ddi_func_ctl_value = intel_de_read(dev_priv,
+-                                               TRANS_DDI_FUNC_CTL(pipe));
+-      trans_conf_value = intel_de_read(dev_priv, PIPECONF(pipe));
+-      dp_tp_ctl_value = intel_de_read(dev_priv, TGL_DP_TP_CTL(pipe));
+-
+-      trans_ddi_func_ctl_value |= TRANS_DDI_FUNC_ENABLE |
+-                                  TGL_TRANS_DDI_SELECT_PORT(port);
+-      trans_conf_value |= PIPECONF_ENABLE;
+-      dp_tp_ctl_value |= DP_TP_CTL_ENABLE;
+-
+-      intel_de_write(dev_priv, PIPECONF(pipe), trans_conf_value);
+-      intel_de_write(dev_priv, TGL_DP_TP_CTL(pipe), dp_tp_ctl_value);
+-      intel_de_write(dev_priv, TRANS_DDI_FUNC_CTL(pipe),
+-                     trans_ddi_func_ctl_value);
+-}
+-
+ static void intel_dp_process_phy_request(struct intel_dp *intel_dp,
+                                        const struct intel_crtc_state *crtc_state)
+ {
+@@ -3714,14 +3659,10 @@ static void intel_dp_process_phy_request(struct intel_dp *intel_dp,
+       intel_dp_get_adjust_train(intel_dp, crtc_state, DP_PHY_DPRX,
+                                 link_status);
+-      intel_dp_autotest_phy_ddi_disable(intel_dp, crtc_state);
+-
+       intel_dp_set_signal_levels(intel_dp, crtc_state, DP_PHY_DPRX);
+       intel_dp_phy_pattern_update(intel_dp, crtc_state);
+-      intel_dp_autotest_phy_ddi_enable(intel_dp, crtc_state);
+-
+       drm_dp_dpcd_write(&intel_dp->aux, DP_TRAINING_LANE0_SET,
+                         intel_dp->train_set, crtc_state->lane_count);
+-- 
+2.35.1
+
diff --git a/queue-6.0/ima-simplify-ima_lsm_copy_rule.patch b/queue-6.0/ima-simplify-ima_lsm_copy_rule.patch
new file mode 100644 (file)
index 0000000..da70d2f
--- /dev/null
@@ -0,0 +1,66 @@
+From 2a8793b01cf621b3d370fdbdf448dc63b858cbc8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 21 Sep 2022 20:58:03 +0800
+Subject: ima: Simplify ima_lsm_copy_rule
+
+From: GUO Zihua <guozihua@huawei.com>
+
+[ Upstream commit d57378d3aa4d864d9e590482602068af1b20c0c5 ]
+
+Currently ima_lsm_copy_rule() set the arg_p field of the source rule to
+NULL, so that the source rule could be freed afterward. It does not make
+sense for this behavior to be inside a "copy" function. So move it
+outside and let the caller handle this field.
+
+ima_lsm_copy_rule() now produce a shallow copy of the original entry
+including args_p field. Meaning only the lsm.rule and the rule itself
+should be freed for the original rule. Thus, instead of calling
+ima_lsm_free_rule() which frees lsm.rule as well as args_p field, free
+the lsm.rule directly.
+
+Signed-off-by: GUO Zihua <guozihua@huawei.com>
+Reviewed-by: Roberto Sassu <roberto.sassu@huawei.com>
+Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ security/integrity/ima/ima_policy.c | 10 +++-------
+ 1 file changed, 3 insertions(+), 7 deletions(-)
+
+diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
+index bb3707160b01..2edff7f58c25 100644
+--- a/security/integrity/ima/ima_policy.c
++++ b/security/integrity/ima/ima_policy.c
+@@ -398,12 +398,6 @@ static struct ima_rule_entry *ima_lsm_copy_rule(struct ima_rule_entry *entry)
+               nentry->lsm[i].type = entry->lsm[i].type;
+               nentry->lsm[i].args_p = entry->lsm[i].args_p;
+-              /*
+-               * Remove the reference from entry so that the associated
+-               * memory will not be freed during a later call to
+-               * ima_lsm_free_rule(entry).
+-               */
+-              entry->lsm[i].args_p = NULL;
+               ima_filter_rule_init(nentry->lsm[i].type, Audit_equal,
+                                    nentry->lsm[i].args_p,
+@@ -417,6 +411,7 @@ static struct ima_rule_entry *ima_lsm_copy_rule(struct ima_rule_entry *entry)
+ static int ima_lsm_update_rule(struct ima_rule_entry *entry)
+ {
++      int i;
+       struct ima_rule_entry *nentry;
+       nentry = ima_lsm_copy_rule(entry);
+@@ -431,7 +426,8 @@ static int ima_lsm_update_rule(struct ima_rule_entry *entry)
+        * references and the entry itself. All other memory references will now
+        * be owned by nentry.
+        */
+-      ima_lsm_free_rule(entry);
++      for (i = 0; i < MAX_LSM_RULES; i++)
++              ima_filter_rule_free(entry->lsm[i].rule);
+       kfree(entry);
+       return 0;
+-- 
+2.35.1
+
diff --git a/queue-6.0/lkdtm-cfi-make-pac-test-work-with-gcc-7-and-8.patch b/queue-6.0/lkdtm-cfi-make-pac-test-work-with-gcc-7-and-8.patch
new file mode 100644 (file)
index 0000000..da68b21
--- /dev/null
@@ -0,0 +1,49 @@
+From 5e205f49738b67ed17217df25c35808f0eba1fd5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 9 Dec 2022 17:34:41 +0000
+Subject: lkdtm: cfi: Make PAC test work with GCC 7 and 8
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Kristina Martsenko <kristina.martsenko@arm.com>
+
+[ Upstream commit f68022ae0aeb0803450e05abc0e984027c33ef1b ]
+
+The CFI test uses the branch-protection=none compiler attribute to
+disable PAC return address protection on a function. While newer GCC
+versions support this attribute, older versions (GCC 7 and 8) instead
+supported the sign-return-address=none attribute, leading to a build
+failure when the test is built with older compilers. Fix it by checking
+which attribute is supported and using the correct one.
+
+Fixes: 2e53b877dc12 ("lkdtm: Add CFI_BACKWARD to test ROP mitigations")
+Reported-by: Daniel Díaz <daniel.diaz@linaro.org>
+Signed-off-by: Kristina Martsenko <kristina.martsenko@arm.com>
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Link: https://lore.kernel.org/all/CAEUSe78kDPxQmQqCWW-_9LCgJDFhAeMoVBFnX9QLx18Z4uT4VQ@mail.gmail.com/
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/misc/lkdtm/cfi.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/misc/lkdtm/cfi.c b/drivers/misc/lkdtm/cfi.c
+index 71483cb1e422..f4fd30f7a9a0 100644
+--- a/drivers/misc/lkdtm/cfi.c
++++ b/drivers/misc/lkdtm/cfi.c
+@@ -51,7 +51,11 @@ static void lkdtm_CFI_FORWARD_PROTO(void)
+ # ifdef CONFIG_ARM64_BTI_KERNEL
+ #  define __no_pac             "branch-protection=bti"
+ # else
+-#  define __no_pac             "branch-protection=none"
++#  ifdef CONFIG_CC_HAS_BRANCH_PROT_PAC_RET
++#   define __no_pac            "branch-protection=none"
++#  else
++#   define __no_pac            "sign-return-address=none"
++#  endif
+ # endif
+ # define __no_ret_protection   __noscs __attribute__((__target__(__no_pac)))
+ #else
+-- 
+2.35.1
+
diff --git a/queue-6.0/loadpin-ignore-the-contents-argument-of-the-lsm-hook.patch b/queue-6.0/loadpin-ignore-the-contents-argument-of-the-lsm-hook.patch
new file mode 100644 (file)
index 0000000..ee80d55
--- /dev/null
@@ -0,0 +1,85 @@
+From effeddbca9ed6a824168d522c67e49ce56fc223a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 9 Dec 2022 11:54:57 -0800
+Subject: LoadPin: Ignore the "contents" argument of the LSM hooks
+
+From: Kees Cook <keescook@chromium.org>
+
+[ Upstream commit 1a17e5b513ceebf21100027745b8731b4728edf7 ]
+
+LoadPin only enforces the read-only origin of kernel file reads. Whether
+or not it was a partial read isn't important. Remove the overly
+conservative checks so that things like partial firmware reads will
+succeed (i.e. reading a firmware header).
+
+Fixes: 2039bda1fa8d ("LSM: Add "contents" flag to kernel_read_file hook")
+Cc: Paul Moore <paul@paul-moore.com>
+Cc: James Morris <jmorris@namei.org>
+Cc: "Serge E. Hallyn" <serge@hallyn.com>
+Cc: linux-security-module@vger.kernel.org
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Acked-by: Serge Hallyn <serge@hallyn.com>
+Tested-by: Ping-Ke Shih <pkshih@realtek.com>
+Link: https://lore.kernel.org/r/20221209195453.never.494-kees@kernel.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ security/loadpin/loadpin.c | 30 ++++++++++++++++++------------
+ 1 file changed, 18 insertions(+), 12 deletions(-)
+
+diff --git a/security/loadpin/loadpin.c b/security/loadpin/loadpin.c
+index 44521582dcba..d6767fddbd5a 100644
+--- a/security/loadpin/loadpin.c
++++ b/security/loadpin/loadpin.c
+@@ -120,21 +120,11 @@ static void loadpin_sb_free_security(struct super_block *mnt_sb)
+       }
+ }
+-static int loadpin_read_file(struct file *file, enum kernel_read_file_id id,
+-                           bool contents)
++static int loadpin_check(struct file *file, enum kernel_read_file_id id)
+ {
+       struct super_block *load_root;
+       const char *origin = kernel_read_file_id_str(id);
+-      /*
+-       * If we will not know that we'll be seeing the full contents
+-       * then we cannot trust a load will be complete and unchanged
+-       * off disk. Treat all contents=false hooks as if there were
+-       * no associated file struct.
+-       */
+-      if (!contents)
+-              file = NULL;
+-
+       /* If the file id is excluded, ignore the pinning. */
+       if ((unsigned int)id < ARRAY_SIZE(ignore_read_file_id) &&
+           ignore_read_file_id[id]) {
+@@ -190,9 +180,25 @@ static int loadpin_read_file(struct file *file, enum kernel_read_file_id id,
+       return 0;
+ }
++static int loadpin_read_file(struct file *file, enum kernel_read_file_id id,
++                           bool contents)
++{
++      /*
++       * LoadPin only cares about the _origin_ of a file, not its
++       * contents, so we can ignore the "are full contents available"
++       * argument here.
++       */
++      return loadpin_check(file, id);
++}
++
+ static int loadpin_load_data(enum kernel_load_data_id id, bool contents)
+ {
+-      return loadpin_read_file(NULL, (enum kernel_read_file_id) id, contents);
++      /*
++       * LoadPin only cares about the _origin_ of a file, not its
++       * contents, so a NULL file is passed, and we can ignore the
++       * state of "contents".
++       */
++      return loadpin_check(NULL, (enum kernel_read_file_id) id);
+ }
+ static struct security_hook_list loadpin_hooks[] __lsm_ro_after_init = {
+-- 
+2.35.1
+
diff --git a/queue-6.0/mips-ralink-mt7621-avoid-to-init-common-ralink-reset.patch b/queue-6.0/mips-ralink-mt7621-avoid-to-init-common-ralink-reset.patch
new file mode 100644 (file)
index 0000000..85708de
--- /dev/null
@@ -0,0 +1,50 @@
+From 498cb5ced6799424f0948bdfc30d8be3408382f9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 17 Dec 2022 08:48:06 +0100
+Subject: MIPS: ralink: mt7621: avoid to init common ralink reset controller
+
+From: Sergio Paracuellos <sergio.paracuellos@gmail.com>
+
+[ Upstream commit 76ce51798cb16738a4a28a6662e7344aaf7ef769 ]
+
+Commit 38a8553b0a22 ("clk: ralink: make system controller node a reset provider")
+make system controller a reset provider for mt7621 ralink SoCs. Ralink init code
+also tries to start previous common reset controller which at the end tries to
+find device tree node 'ralink,rt2880-reset'. mt7621 device tree file is not
+using at all this node anymore. Hence avoid to init this common reset controller
+for mt7621 ralink SoCs to avoid 'Failed to find reset controller node' boot
+error trace error.
+
+Fixes: 64b2d6ffff86 ("staging: mt7621-dts: align resets with binding documentation")
+Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
+Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/mips/ralink/of.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
+index ea8072acf8d9..01c132bc33d5 100644
+--- a/arch/mips/ralink/of.c
++++ b/arch/mips/ralink/of.c
+@@ -21,6 +21,7 @@
+ #include <asm/bootinfo.h>
+ #include <asm/addrspace.h>
+ #include <asm/prom.h>
++#include <asm/mach-ralink/ralink_regs.h>
+ #include "common.h"
+@@ -81,7 +82,8 @@ static int __init plat_of_setup(void)
+       __dt_register_buses(soc_info.compatible, "palmbus");
+       /* make sure that the reset controller is setup early */
+-      ralink_rst_init();
++      if (ralink_soc != MT762X_SOC_MT7621AT)
++              ralink_rst_init();
+       return 0;
+ }
+-- 
+2.35.1
+
diff --git a/queue-6.0/perf-debug-set-debug_peo_args-and-redirect_to_stderr.patch b/queue-6.0/perf-debug-set-debug_peo_args-and-redirect_to_stderr.patch
new file mode 100644 (file)
index 0000000..5f03fa9
--- /dev/null
@@ -0,0 +1,90 @@
+From b8e6ed480dd8349e0d37076e77c4552309a08e99 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 20 Dec 2022 11:57:00 +0800
+Subject: perf debug: Set debug_peo_args and redirect_to_stderr variable to
+ correct values in perf_quiet_option()
+
+From: Yang Jihong <yangjihong1@huawei.com>
+
+[ Upstream commit 188ac720d364035008a54d249cf47b4cc100f819 ]
+
+When perf uses quiet mode, perf_quiet_option() sets the 'debug_peo_args'
+variable to -1, and display_attr() incorrectly determines the value of
+'debug_peo_args'.  As a result, unexpected information is displayed.
+
+Before:
+
+  # perf record --quiet -- ls > /dev/null
+  ------------------------------------------------------------
+  perf_event_attr:
+    size                             128
+    { sample_period, sample_freq }   4000
+    sample_type                      IP|TID|TIME|PERIOD
+    read_format                      ID|LOST
+    disabled                         1
+    inherit                          1
+    mmap                             1
+    comm                             1
+    freq                             1
+    enable_on_exec                   1
+    task                             1
+    precise_ip                       3
+    sample_id_all                    1
+    exclude_guest                    1
+    mmap2                            1
+    comm_exec                        1
+    ksymbol                          1
+    bpf_event                        1
+  ------------------------------------------------------------
+  ...
+
+After:
+  # perf record --quiet -- ls > /dev/null
+  #
+
+redirect_to_stderr is a similar problem.
+
+Fixes: f78eaef0e0493f60 ("perf tools: Allow to force redirect pr_debug to stderr.")
+Fixes: ccd26741f5e6bdf2 ("perf tool: Provide an option to print perf_event_open args and return value")
+Suggested-by: Adrian Hunter <adrian.hunter@intel.com>
+Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
+Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
+Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Cc: Andi Kleen <ak@linux.intel.com>
+Cc: Carsten Haitzler <carsten.haitzler@arm.com>
+Cc: Ian Rogers <irogers@google.com>
+Cc: Ingo Molnar <mingo@redhat.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Leo Yan <leo.yan@linaro.org>
+Cc: Mark Rutland <mark.rutland@arm.com>
+Cc: martin.lau@kernel.org
+Cc: Masami Hiramatsu <mhiramat@kernel.org>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Ravi Bangoria <ravi.bangoria@amd.com>
+Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
+Link: https://lore.kernel.org/r/20221220035702.188413-2-yangjihong1@huawei.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/perf/util/debug.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
+index 65e6c22f38e4..190e818a0717 100644
+--- a/tools/perf/util/debug.c
++++ b/tools/perf/util/debug.c
+@@ -241,6 +241,10 @@ int perf_quiet_option(void)
+               opt++;
+       }
++      /* For debug variables that are used as bool types, set to 0. */
++      redirect_to_stderr = 0;
++      debug_peo_args = 0;
++
+       return 0;
+ }
+-- 
+2.35.1
+
diff --git a/queue-6.0/perf-test-fix-all-pmu-test-to-skip-parametrized-even.patch b/queue-6.0/perf-test-fix-all-pmu-test-to-skip-parametrized-even.patch
new file mode 100644 (file)
index 0000000..297865c
--- /dev/null
@@ -0,0 +1,57 @@
+From 98521eda5baf2db46865666c22fef508c7f17e61 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 19 Dec 2022 17:30:08 +0100
+Subject: perf test: Fix "all PMU test" to skip parametrized events
+
+From: Michael Petlan <mpetlan@redhat.com>
+
+[ Upstream commit b50d691e50e600fab82b423be871860537d75dc9 ]
+
+Parametrized events are not only a powerpc domain. They occur on other
+platforms too (e.g. aarch64). They should be ignored in this testcase,
+since proper setup of the parameters is out of scope of this script.
+
+Let's not filter them out by PMU name, but rather based on the fact that
+they expect a parameter.
+
+Fixes: 451ed8058c69a3fe ("perf test: Fix "all PMU test" to skip hv_24x7/hv_gpci tests on powerpc")
+Signed-off-by: Michael Petlan <mpetlan@redhat.com>
+Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
+Cc: Disha Goel <disgoel@linux.vnet.ibm.com>
+Cc: Ian Rogers <irogers@google.com>
+Cc: Michael Ellerman <mpe@ellerman.id.au>
+Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
+Link: https://lore.kernel.org/r/20221219163008.9691-1-mpetlan@redhat.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/perf/tests/shell/stat_all_pmu.sh | 13 ++-----------
+ 1 file changed, 2 insertions(+), 11 deletions(-)
+
+diff --git a/tools/perf/tests/shell/stat_all_pmu.sh b/tools/perf/tests/shell/stat_all_pmu.sh
+index 9c9ef33e0b3c..c77955419173 100755
+--- a/tools/perf/tests/shell/stat_all_pmu.sh
++++ b/tools/perf/tests/shell/stat_all_pmu.sh
+@@ -4,17 +4,8 @@
+ set -e
+-for p in $(perf list --raw-dump pmu); do
+-  # In powerpc, skip the events for hv_24x7 and hv_gpci.
+-  # These events needs input values to be filled in for
+-  # core, chip, partition id based on system.
+-  # Example: hv_24x7/CPM_ADJUNCT_INST,domain=?,core=?/
+-  # hv_gpci/event,partition_id=?/
+-  # Hence skip these events for ppc.
+-  if echo "$p" |grep -Eq 'hv_24x7|hv_gpci' ; then
+-    echo "Skipping: Event '$p' in powerpc"
+-    continue
+-  fi
++# Test all PMU events; however exclude parametrized ones (name contains '?')
++for p in $(perf list --raw-dump pmu | sed 's/[[:graph:]]\+?[[:graph:]]\+[[:space:]]//g'); do
+   echo "Testing $p"
+   result=$(perf stat -e "$p" true 2>&1)
+   if ! echo "$result" | grep -q "$p" && ! echo "$result" | grep -q "<not supported>" ; then
+-- 
+2.35.1
+
diff --git a/queue-6.0/pstore-make-sure-config_pstore_pmsg-selects-config_r.patch b/queue-6.0/pstore-make-sure-config_pstore_pmsg-selects-config_r.patch
new file mode 100644 (file)
index 0000000..235564a
--- /dev/null
@@ -0,0 +1,53 @@
+From 06fc79f71d636504fbe46ecfb47eef4ca5dce8ae Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 21 Dec 2022 05:18:55 +0000
+Subject: pstore: Make sure CONFIG_PSTORE_PMSG selects CONFIG_RT_MUTEXES
+
+From: John Stultz <jstultz@google.com>
+
+[ Upstream commit 2f4fec5943407318b9523f01ce1f5d668c028332 ]
+
+In commit 76d62f24db07 ("pstore: Switch pmsg_lock to an rt_mutex
+to avoid priority inversion") I changed a lock to an rt_mutex.
+
+However, its possible that CONFIG_RT_MUTEXES is not enabled,
+which then results in a build failure, as the 0day bot detected:
+  https://lore.kernel.org/linux-mm/202212211244.TwzWZD3H-lkp@intel.com/
+
+Thus this patch changes CONFIG_PSTORE_PMSG to select
+CONFIG_RT_MUTEXES, which ensures the build will not fail.
+
+Cc: Wei Wang <wvw@google.com>
+Cc: Midas Chien<midaschieh@google.com>
+Cc: Connor O'Brien <connoro@google.com>
+Cc: Kees Cook <keescook@chromium.org>
+Cc: Anton Vorontsov <anton@enomsg.org>
+Cc: Colin Cross <ccross@android.com>
+Cc: Tony Luck <tony.luck@intel.com>
+Cc: kernel test robot <lkp@intel.com>
+Cc: kernel-team@android.com
+Fixes: 76d62f24db07 ("pstore: Switch pmsg_lock to an rt_mutex to avoid priority inversion")
+Reported-by: kernel test robot <lkp@intel.com>
+Signed-off-by: John Stultz <jstultz@google.com>
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Link: https://lore.kernel.org/r/20221221051855.15761-1-jstultz@google.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/pstore/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/fs/pstore/Kconfig b/fs/pstore/Kconfig
+index 8adabde685f1..c49d554cc9ae 100644
+--- a/fs/pstore/Kconfig
++++ b/fs/pstore/Kconfig
+@@ -126,6 +126,7 @@ config PSTORE_CONSOLE
+ config PSTORE_PMSG
+       bool "Log user space messages"
+       depends on PSTORE
++      select RT_MUTEXES
+       help
+         When the option is enabled, pstore will export a character
+         interface /dev/pmsg0 to log user space messages. On reboot
+-- 
+2.35.1
+
diff --git a/queue-6.0/pstore-switch-pmsg_lock-to-an-rt_mutex-to-avoid-prio.patch b/queue-6.0/pstore-switch-pmsg_lock-to-an-rt_mutex-to-avoid-prio.patch
new file mode 100644 (file)
index 0000000..48784eb
--- /dev/null
@@ -0,0 +1,70 @@
+From 0ab0be6d27ac208e24b0284e667ec56e6aaa2784 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 14 Dec 2022 23:18:34 +0000
+Subject: pstore: Switch pmsg_lock to an rt_mutex to avoid priority inversion
+
+From: John Stultz <jstultz@google.com>
+
+[ Upstream commit 76d62f24db07f22ccf9bc18ca793c27d4ebef721 ]
+
+Wei Wang reported seeing priority inversion caused latencies
+caused by contention on pmsg_lock, and suggested it be switched
+to a rt_mutex.
+
+I was initially hesitant this would help, as the tasks in that
+trace all seemed to be SCHED_NORMAL, so the benefit would be
+limited to only nice boosting.
+
+However, another similar issue was raised where the priority
+inversion was seen did involve a blocked RT task so it is clear
+this would be helpful in that case.
+
+Cc: Wei Wang <wvw@google.com>
+Cc: Midas Chien<midaschieh@google.com>
+Cc: Connor O'Brien <connoro@google.com>
+Cc: Kees Cook <keescook@chromium.org>
+Cc: Anton Vorontsov <anton@enomsg.org>
+Cc: Colin Cross <ccross@android.com>
+Cc: Tony Luck <tony.luck@intel.com>
+Cc: kernel-team@android.com
+Fixes: 9d5438f462ab ("pstore: Add pmsg - user-space accessible pstore object")
+Reported-by: Wei Wang <wvw@google.com>
+Signed-off-by: John Stultz <jstultz@google.com>
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Link: https://lore.kernel.org/r/20221214231834.3711880-1-jstultz@google.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/pstore/pmsg.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/fs/pstore/pmsg.c b/fs/pstore/pmsg.c
+index d8542ec2f38c..18cf94b597e0 100644
+--- a/fs/pstore/pmsg.c
++++ b/fs/pstore/pmsg.c
+@@ -7,9 +7,10 @@
+ #include <linux/device.h>
+ #include <linux/fs.h>
+ #include <linux/uaccess.h>
++#include <linux/rtmutex.h>
+ #include "internal.h"
+-static DEFINE_MUTEX(pmsg_lock);
++static DEFINE_RT_MUTEX(pmsg_lock);
+ static ssize_t write_pmsg(struct file *file, const char __user *buf,
+                         size_t count, loff_t *ppos)
+@@ -28,9 +29,9 @@ static ssize_t write_pmsg(struct file *file, const char __user *buf,
+       if (!access_ok(buf, count))
+               return -EFAULT;
+-      mutex_lock(&pmsg_lock);
++      rt_mutex_lock(&pmsg_lock);
+       ret = psinfo->write_user(&record, buf);
+-      mutex_unlock(&pmsg_lock);
++      rt_mutex_unlock(&pmsg_lock);
+       return ret ? ret : count;
+ }
+-- 
+2.35.1
+
index d7e565e8e88605a5a2fc1b65e13db63bd008c968..bf3291736d1c59d7e0ec1057ff98d731d06590b9 100644 (file)
@@ -995,3 +995,28 @@ orangefs-fix-kmemleak-in-orangefs_-kernel-client-_de.patch
 clk-renesas-r8a779f0-add-sdh0-clock.patch
 clk-renesas-r8a779f0-add-tmu-and-parent-sasync-clock.patch
 hwmon-jc42-fix-missing-unlock-on-error-in-jc42_write.patch
+asoc-sof_es8336-fix-possible-use-after-free-in-sof_e.patch
+alsa-hda-add-snd_hdac_stop_streams-helper.patch
+asoc-intel-skylake-fix-driver-hang-during-shutdown.patch
+asoc-mediatek-mt8173-rt5650-rt5514-fix-refcount-leak.patch
+asoc-audio-graph-card-fix-refcount-leak-of-cpu_ep-in.patch
+asoc-rockchip-pdm-add-missing-clk_disable_unprepare-.patch
+asoc-mediatek-mt8183-fix-refcount-leak-in-mt8183_mt6.patch
+alsa-hda-hdmi-fix-i915-silent-stream-programming-flo.patch
+alsa-hda-hdmi-set-default-audio-parameters-for-kae-s.patch
+alsa-hda-hdmi-use-only-dynamic-pcm-device-allocation.patch
+alsa-hda-hdmi-fix-stream-id-config-keep-alive-for-rt.patch
+asoc-wm8994-fix-potential-deadlock.patch
+asoc-rockchip-spdif-add-missing-clk_disable_unprepar.patch
+asoc-rt5670-remove-unbalanced-pm_runtime_put.patch
+drm-i915-display-don-t-disable-ddi-transcoder-when-s.patch
+loadpin-ignore-the-contents-argument-of-the-lsm-hook.patch
+lkdtm-cfi-make-pac-test-work-with-gcc-7-and-8.patch
+pstore-switch-pmsg_lock-to-an-rt_mutex-to-avoid-prio.patch
+drm-amd-pm-avoid-large-variable-on-kernel-stack.patch
+perf-debug-set-debug_peo_args-and-redirect_to_stderr.patch
+mips-ralink-mt7621-avoid-to-init-common-ralink-reset.patch
+perf-test-fix-all-pmu-test-to-skip-parametrized-even.patch
+afs-fix-lost-servers_outstanding-count.patch
+pstore-make-sure-config_pstore_pmsg-selects-config_r.patch
+ima-simplify-ima_lsm_copy_rule.patch