--- /dev/null
+From 4d18db80e9342c68869961bda4bdfc03c82031d8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 26 Jul 2024 16:26:20 +0200
+Subject: ALSA: hda/conexant: Mute speakers at suspend / shutdown
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit 4f61c8fe35202702426cfc0003e15116a01ba885 ]
+
+Use the new helper to mute speakers at suspend / shutdown for avoiding
+click noises.
+
+Link: https://bugzilla.suse.com/show_bug.cgi?id=1228269
+Link: https://patch.msgid.link/20240726142625.2460-2-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/patch_conexant.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
+index 4472923ba694b..f030669243f9a 100644
+--- a/sound/pci/hda/patch_conexant.c
++++ b/sound/pci/hda/patch_conexant.c
+@@ -205,6 +205,8 @@ static void cx_auto_shutdown(struct hda_codec *codec)
+ {
+ struct conexant_spec *spec = codec->spec;
+
++ snd_hda_gen_shutup_speakers(codec);
++
+ /* Turn the problematic codec into D3 to avoid spurious noises
+ from the internal speaker during (and after) reboot */
+ cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false);
+--
+2.43.0
+
--- /dev/null
+From 79f20b71519a373d83814e4b87351ca408328da1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 26 Jul 2024 16:26:19 +0200
+Subject: ALSA: hda/generic: Add a helper to mute speakers at suspend/shutdown
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit 6cd23b26b348fa52c88e1adf9c0e48d68e13f95e ]
+
+Some devices indicate click noises at suspend or shutdown when the
+speakers are unmuted. This patch adds a helper,
+snd_hda_gen_shutup_speakers(), to work around it. The new function is
+supposed to be called at suspend or shutdown by the codec driver, and
+it mutes the speakers.
+
+The mute status isn't cached, hence the original mute state will be
+restored at resume again.
+
+Link: https://patch.msgid.link/20240726142625.2460-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/hda_generic.c | 63 +++++++++++++++++++++++++++++++++++++
+ sound/pci/hda/hda_generic.h | 1 +
+ 2 files changed, 64 insertions(+)
+
+diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
+index f64d9dc197a31..9cff87dfbecbb 100644
+--- a/sound/pci/hda/hda_generic.c
++++ b/sound/pci/hda/hda_generic.c
+@@ -4955,6 +4955,69 @@ void snd_hda_gen_stream_pm(struct hda_codec *codec, hda_nid_t nid, bool on)
+ }
+ EXPORT_SYMBOL_GPL(snd_hda_gen_stream_pm);
+
++/* forcibly mute the speaker output without caching; return true if updated */
++static bool force_mute_output_path(struct hda_codec *codec, hda_nid_t nid)
++{
++ if (!nid)
++ return false;
++ if (!nid_has_mute(codec, nid, HDA_OUTPUT))
++ return false; /* no mute, skip */
++ if (snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) &
++ snd_hda_codec_amp_read(codec, nid, 1, HDA_OUTPUT, 0) &
++ HDA_AMP_MUTE)
++ return false; /* both channels already muted, skip */
++
++ /* direct amp update without caching */
++ snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
++ AC_AMP_SET_OUTPUT | AC_AMP_SET_LEFT |
++ AC_AMP_SET_RIGHT | HDA_AMP_MUTE);
++ return true;
++}
++
++/**
++ * snd_hda_gen_shutup_speakers - Forcibly mute the speaker outputs
++ * @codec: the HDA codec
++ *
++ * Forcibly mute the speaker outputs, to be called at suspend or shutdown.
++ *
++ * The mute state done by this function isn't cached, hence the original state
++ * will be restored at resume.
++ *
++ * Return true if the mute state has been changed.
++ */
++bool snd_hda_gen_shutup_speakers(struct hda_codec *codec)
++{
++ struct hda_gen_spec *spec = codec->spec;
++ const int *paths;
++ const struct nid_path *path;
++ int i, p, num_paths;
++ bool updated = false;
++
++ /* if already powered off, do nothing */
++ if (!snd_hdac_is_power_on(&codec->core))
++ return false;
++
++ if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) {
++ paths = spec->out_paths;
++ num_paths = spec->autocfg.line_outs;
++ } else {
++ paths = spec->speaker_paths;
++ num_paths = spec->autocfg.speaker_outs;
++ }
++
++ for (i = 0; i < num_paths; i++) {
++ path = snd_hda_get_path_from_idx(codec, paths[i]);
++ if (!path)
++ continue;
++ for (p = 0; p < path->depth; p++)
++ if (force_mute_output_path(codec, path->path[p]))
++ updated = true;
++ }
++
++ return updated;
++}
++EXPORT_SYMBOL_GPL(snd_hda_gen_shutup_speakers);
++
+ /**
+ * snd_hda_gen_parse_auto_config - Parse the given BIOS configuration and
+ * set up the hda_gen_spec
+diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h
+index 8f5ecf740c491..08544601b4ce2 100644
+--- a/sound/pci/hda/hda_generic.h
++++ b/sound/pci/hda/hda_generic.h
+@@ -353,5 +353,6 @@ int snd_hda_gen_add_mute_led_cdev(struct hda_codec *codec,
+ int snd_hda_gen_add_micmute_led_cdev(struct hda_codec *codec,
+ int (*callback)(struct led_classdev *,
+ enum led_brightness));
++bool snd_hda_gen_shutup_speakers(struct hda_codec *codec);
+
+ #endif /* __SOUND_HDA_GENERIC_H */
+--
+2.43.0
+
--- /dev/null
+From 8ec978e0e5d326eda42377c5a055f77875b94876 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 31 Jul 2024 15:05:26 +0200
+Subject: ALSA: seq: ump: Explicitly reset RPN with Null RPN
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit 98ea612dd1150adb61cd2a0e93875e1cc77e6b87 ]
+
+RPN with 127:127 is treated as a Null RPN, just to reset the
+parameters, and it's not translated to MIDI2. Although the current
+code can work as is in most cases, better to implement the RPN reset
+explicitly for Null message.
+
+Link: https://patch.msgid.link/20240731130528.12600-6-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/core/seq/seq_ump_convert.c | 21 ++++++++++++++++-----
+ 1 file changed, 16 insertions(+), 5 deletions(-)
+
+diff --git a/sound/core/seq/seq_ump_convert.c b/sound/core/seq/seq_ump_convert.c
+index 7ca62667f28d3..4dd540cbb1cbb 100644
+--- a/sound/core/seq/seq_ump_convert.c
++++ b/sound/core/seq/seq_ump_convert.c
+@@ -789,6 +789,15 @@ static int paf_ev_to_ump_midi2(const struct snd_seq_event *event,
+ return 1;
+ }
+
++static void reset_rpn(struct ump_cvt_to_ump_bank *cc)
++{
++ cc->rpn_set = 0;
++ cc->nrpn_set = 0;
++ cc->cc_rpn_msb = cc->cc_rpn_lsb = 0;
++ cc->cc_data_msb = cc->cc_data_lsb = 0;
++ cc->cc_data_msb_set = cc->cc_data_lsb_set = 0;
++}
++
+ /* set up the MIDI2 RPN/NRPN packet data from the parsed info */
+ static int fill_rpn(struct ump_cvt_to_ump_bank *cc,
+ union snd_ump_midi2_msg *data,
+@@ -817,11 +826,7 @@ static int fill_rpn(struct ump_cvt_to_ump_bank *cc,
+ cc->cc_data_lsb);
+ data->rpn.channel = channel;
+
+- cc->rpn_set = 0;
+- cc->nrpn_set = 0;
+- cc->cc_rpn_msb = cc->cc_rpn_lsb = 0;
+- cc->cc_data_msb = cc->cc_data_lsb = 0;
+- cc->cc_data_msb_set = cc->cc_data_lsb_set = 0;
++ reset_rpn(cc);
+ return 1;
+ }
+
+@@ -843,11 +848,15 @@ static int cc_ev_to_ump_midi2(const struct snd_seq_event *event,
+ ret = fill_rpn(cc, data, channel, true);
+ cc->rpn_set = 1;
+ cc->cc_rpn_msb = val;
++ if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)
++ reset_rpn(cc);
+ return ret;
+ case UMP_CC_RPN_LSB:
+ ret = fill_rpn(cc, data, channel, true);
+ cc->rpn_set = 1;
+ cc->cc_rpn_lsb = val;
++ if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)
++ reset_rpn(cc);
+ return ret;
+ case UMP_CC_NRPN_MSB:
+ ret = fill_rpn(cc, data, channel, true);
+@@ -961,6 +970,8 @@ static int ctrl14_ev_to_ump_midi2(const struct snd_seq_event *event,
+ cc->cc_rpn_msb = msb;
+ cc->cc_rpn_lsb = lsb;
+ cc->rpn_set = 1;
++ if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)
++ reset_rpn(cc);
+ return ret;
+ case UMP_CC_NRPN_MSB:
+ case UMP_CC_NRPN_LSB:
+--
+2.43.0
+
--- /dev/null
+From 21314fec68d01ac1d93176dbbd121df533f703d4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 31 Jul 2024 15:05:25 +0200
+Subject: ALSA: seq: ump: Transmit RPN/NRPN message at each MSB/LSB data
+ reception
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit a4ff92ff0bdd731eca9f0b50b1cbb5aba89be4b2 ]
+
+Just like the core UMP conversion helper, we need to deal with the
+partially-filled RPN/NRPN data in the sequencer UMP converter as
+well.
+
+Link: https://patch.msgid.link/20240731130528.12600-5-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/core/seq/seq_ump_convert.c | 74 +++++++++++++++++++-------------
+ 1 file changed, 44 insertions(+), 30 deletions(-)
+
+diff --git a/sound/core/seq/seq_ump_convert.c b/sound/core/seq/seq_ump_convert.c
+index b1bc6d122d92d..7ca62667f28d3 100644
+--- a/sound/core/seq/seq_ump_convert.c
++++ b/sound/core/seq/seq_ump_convert.c
+@@ -790,27 +790,39 @@ static int paf_ev_to_ump_midi2(const struct snd_seq_event *event,
+ }
+
+ /* set up the MIDI2 RPN/NRPN packet data from the parsed info */
+-static void fill_rpn(struct ump_cvt_to_ump_bank *cc,
+- union snd_ump_midi2_msg *data,
+- unsigned char channel)
++static int fill_rpn(struct ump_cvt_to_ump_bank *cc,
++ union snd_ump_midi2_msg *data,
++ unsigned char channel,
++ bool flush)
+ {
++ if (!(cc->cc_data_lsb_set || cc->cc_data_msb_set))
++ return 0; // skip
++ /* when not flushing, wait for complete data set */
++ if (!flush && (!cc->cc_data_lsb_set || !cc->cc_data_msb_set))
++ return 0; // skip
++
+ if (cc->rpn_set) {
+ data->rpn.status = UMP_MSG_STATUS_RPN;
+ data->rpn.bank = cc->cc_rpn_msb;
+ data->rpn.index = cc->cc_rpn_lsb;
+- cc->rpn_set = 0;
+- cc->cc_rpn_msb = cc->cc_rpn_lsb = 0;
+- } else {
++ } else if (cc->nrpn_set) {
+ data->rpn.status = UMP_MSG_STATUS_NRPN;
+ data->rpn.bank = cc->cc_nrpn_msb;
+ data->rpn.index = cc->cc_nrpn_lsb;
+- cc->nrpn_set = 0;
+- cc->cc_nrpn_msb = cc->cc_nrpn_lsb = 0;
++ } else {
++ return 0; // skip
+ }
++
+ data->rpn.data = upscale_14_to_32bit((cc->cc_data_msb << 7) |
+ cc->cc_data_lsb);
+ data->rpn.channel = channel;
++
++ cc->rpn_set = 0;
++ cc->nrpn_set = 0;
++ cc->cc_rpn_msb = cc->cc_rpn_lsb = 0;
+ cc->cc_data_msb = cc->cc_data_lsb = 0;
++ cc->cc_data_msb_set = cc->cc_data_lsb_set = 0;
++ return 1;
+ }
+
+ /* convert CC event to MIDI 2.0 UMP */
+@@ -823,28 +835,34 @@ static int cc_ev_to_ump_midi2(const struct snd_seq_event *event,
+ unsigned char index = event->data.control.param & 0x7f;
+ unsigned char val = event->data.control.value & 0x7f;
+ struct ump_cvt_to_ump_bank *cc = &dest_port->midi2_bank[channel];
++ int ret;
+
+ /* process special CC's (bank/rpn/nrpn) */
+ switch (index) {
+ case UMP_CC_RPN_MSB:
++ ret = fill_rpn(cc, data, channel, true);
+ cc->rpn_set = 1;
+ cc->cc_rpn_msb = val;
+- return 0; // skip
++ return ret;
+ case UMP_CC_RPN_LSB:
++ ret = fill_rpn(cc, data, channel, true);
+ cc->rpn_set = 1;
+ cc->cc_rpn_lsb = val;
+- return 0; // skip
++ return ret;
+ case UMP_CC_NRPN_MSB:
++ ret = fill_rpn(cc, data, channel, true);
+ cc->nrpn_set = 1;
+ cc->cc_nrpn_msb = val;
+- return 0; // skip
++ return ret;
+ case UMP_CC_NRPN_LSB:
++ ret = fill_rpn(cc, data, channel, true);
+ cc->nrpn_set = 1;
+ cc->cc_nrpn_lsb = val;
+- return 0; // skip
++ return ret;
+ case UMP_CC_DATA:
++ cc->cc_data_msb_set = 1;
+ cc->cc_data_msb = val;
+- return 0; // skip
++ return fill_rpn(cc, data, channel, false);
+ case UMP_CC_BANK_SELECT:
+ cc->bank_set = 1;
+ cc->cc_bank_msb = val;
+@@ -854,11 +872,9 @@ static int cc_ev_to_ump_midi2(const struct snd_seq_event *event,
+ cc->cc_bank_lsb = val;
+ return 0; // skip
+ case UMP_CC_DATA_LSB:
++ cc->cc_data_lsb_set = 1;
+ cc->cc_data_lsb = val;
+- if (!(cc->rpn_set || cc->nrpn_set))
+- return 0; // skip
+- fill_rpn(cc, data, channel);
+- return 1;
++ return fill_rpn(cc, data, channel, false);
+ }
+
+ data->cc.status = status;
+@@ -926,6 +942,7 @@ static int ctrl14_ev_to_ump_midi2(const struct snd_seq_event *event,
+ unsigned char index = event->data.control.param & 0x7f;
+ struct ump_cvt_to_ump_bank *cc = &dest_port->midi2_bank[channel];
+ unsigned char msb, lsb;
++ int ret;
+
+ msb = (event->data.control.value >> 7) & 0x7f;
+ lsb = event->data.control.value & 0x7f;
+@@ -939,28 +956,25 @@ static int ctrl14_ev_to_ump_midi2(const struct snd_seq_event *event,
+ cc->cc_bank_lsb = lsb;
+ return 0; // skip
+ case UMP_CC_RPN_MSB:
+- cc->cc_rpn_msb = msb;
+- fallthrough;
+ case UMP_CC_RPN_LSB:
+- cc->rpn_set = 1;
++ ret = fill_rpn(cc, data, channel, true);
++ cc->cc_rpn_msb = msb;
+ cc->cc_rpn_lsb = lsb;
+- return 0; // skip
++ cc->rpn_set = 1;
++ return ret;
+ case UMP_CC_NRPN_MSB:
+- cc->cc_nrpn_msb = msb;
+- fallthrough;
+ case UMP_CC_NRPN_LSB:
++ ret = fill_rpn(cc, data, channel, true);
++ cc->cc_nrpn_msb = msb;
+ cc->nrpn_set = 1;
+ cc->cc_nrpn_lsb = lsb;
+- return 0; // skip
++ return ret;
+ case UMP_CC_DATA:
+- cc->cc_data_msb = msb;
+- fallthrough;
+ case UMP_CC_DATA_LSB:
++ cc->cc_data_msb_set = cc->cc_data_lsb_set = 1;
++ cc->cc_data_msb = msb;
+ cc->cc_data_lsb = lsb;
+- if (!(cc->rpn_set || cc->nrpn_set))
+- return 0; // skip
+- fill_rpn(cc, data, channel);
+- return 1;
++ return fill_rpn(cc, data, channel, false);
+ }
+
+ data->cc.status = UMP_MSG_STATUS_CC;
+--
+2.43.0
+
--- /dev/null
+From b9cc63a426739a44912da519836cc61abfd21ba2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 31 Jul 2024 15:05:24 +0200
+Subject: ALSA: seq: ump: Use the common RPN/bank conversion context
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit a683030606fa5ff8b722a5e28839d19288011ede ]
+
+The UMP core conversion helper API already defines the context needed
+to record the bank and RPN/NRPN values, and we can simply re-use the
+same struct instead of re-defining the same content as a different
+name.
+
+Link: https://patch.msgid.link/20240731130528.12600-4-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/core/seq/seq_ports.h | 14 ++------------
+ sound/core/seq/seq_ump_convert.c | 10 +++++-----
+ 2 files changed, 7 insertions(+), 17 deletions(-)
+
+diff --git a/sound/core/seq/seq_ports.h b/sound/core/seq/seq_ports.h
+index b111382f697aa..9e36738c0dd04 100644
+--- a/sound/core/seq/seq_ports.h
++++ b/sound/core/seq/seq_ports.h
+@@ -7,6 +7,7 @@
+ #define __SND_SEQ_PORTS_H
+
+ #include <sound/seq_kernel.h>
++#include <sound/ump_convert.h>
+ #include "seq_lock.h"
+
+ /* list of 'exported' ports */
+@@ -42,17 +43,6 @@ struct snd_seq_port_subs_info {
+ int (*close)(void *private_data, struct snd_seq_port_subscribe *info);
+ };
+
+-/* context for converting from legacy control event to UMP packet */
+-struct snd_seq_ump_midi2_bank {
+- bool rpn_set;
+- bool nrpn_set;
+- bool bank_set;
+- unsigned char cc_rpn_msb, cc_rpn_lsb;
+- unsigned char cc_nrpn_msb, cc_nrpn_lsb;
+- unsigned char cc_data_msb, cc_data_lsb;
+- unsigned char cc_bank_msb, cc_bank_lsb;
+-};
+-
+ struct snd_seq_client_port {
+
+ struct snd_seq_addr addr; /* client/port number */
+@@ -88,7 +78,7 @@ struct snd_seq_client_port {
+ unsigned char ump_group;
+
+ #if IS_ENABLED(CONFIG_SND_SEQ_UMP)
+- struct snd_seq_ump_midi2_bank midi2_bank[16]; /* per channel */
++ struct ump_cvt_to_ump_bank midi2_bank[16]; /* per channel */
+ #endif
+ };
+
+diff --git a/sound/core/seq/seq_ump_convert.c b/sound/core/seq/seq_ump_convert.c
+index d9dacfbe4a9ae..b1bc6d122d92d 100644
+--- a/sound/core/seq/seq_ump_convert.c
++++ b/sound/core/seq/seq_ump_convert.c
+@@ -368,7 +368,7 @@ static int cvt_ump_midi1_to_midi2(struct snd_seq_client *dest,
+ struct snd_seq_ump_event ev_cvt;
+ const union snd_ump_midi1_msg *midi1 = (const union snd_ump_midi1_msg *)event->ump;
+ union snd_ump_midi2_msg *midi2 = (union snd_ump_midi2_msg *)ev_cvt.ump;
+- struct snd_seq_ump_midi2_bank *cc;
++ struct ump_cvt_to_ump_bank *cc;
+
+ ev_cvt = *event;
+ memset(&ev_cvt.ump, 0, sizeof(ev_cvt.ump));
+@@ -790,7 +790,7 @@ static int paf_ev_to_ump_midi2(const struct snd_seq_event *event,
+ }
+
+ /* set up the MIDI2 RPN/NRPN packet data from the parsed info */
+-static void fill_rpn(struct snd_seq_ump_midi2_bank *cc,
++static void fill_rpn(struct ump_cvt_to_ump_bank *cc,
+ union snd_ump_midi2_msg *data,
+ unsigned char channel)
+ {
+@@ -822,7 +822,7 @@ static int cc_ev_to_ump_midi2(const struct snd_seq_event *event,
+ unsigned char channel = event->data.control.channel & 0x0f;
+ unsigned char index = event->data.control.param & 0x7f;
+ unsigned char val = event->data.control.value & 0x7f;
+- struct snd_seq_ump_midi2_bank *cc = &dest_port->midi2_bank[channel];
++ struct ump_cvt_to_ump_bank *cc = &dest_port->midi2_bank[channel];
+
+ /* process special CC's (bank/rpn/nrpn) */
+ switch (index) {
+@@ -887,7 +887,7 @@ static int pgm_ev_to_ump_midi2(const struct snd_seq_event *event,
+ unsigned char status)
+ {
+ unsigned char channel = event->data.control.channel & 0x0f;
+- struct snd_seq_ump_midi2_bank *cc = &dest_port->midi2_bank[channel];
++ struct ump_cvt_to_ump_bank *cc = &dest_port->midi2_bank[channel];
+
+ data->pg.status = status;
+ data->pg.channel = channel;
+@@ -924,7 +924,7 @@ static int ctrl14_ev_to_ump_midi2(const struct snd_seq_event *event,
+ {
+ unsigned char channel = event->data.control.channel & 0x0f;
+ unsigned char index = event->data.control.param & 0x7f;
+- struct snd_seq_ump_midi2_bank *cc = &dest_port->midi2_bank[channel];
++ struct ump_cvt_to_ump_bank *cc = &dest_port->midi2_bank[channel];
+ unsigned char msb, lsb;
+
+ msb = (event->data.control.value >> 7) & 0x7f;
+--
+2.43.0
+
--- /dev/null
+From b0f42df5231c6466e43baf38e4917a259edfe2e7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 31 Jul 2024 15:05:23 +0200
+Subject: ALSA: ump: Explicitly reset RPN with Null RPN
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit 50a6dd19dca9446475f023eaa652016bfe5b1cbe ]
+
+RPN with 127:127 is treated as a Null RPN, just to reset the
+parameters, and it's not translated to MIDI2. Although the current
+code can work as is in most cases, better to implement the RPN reset
+explicitly for Null message.
+
+Link: https://patch.msgid.link/20240731130528.12600-3-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/core/ump_convert.c | 19 ++++++++++++++-----
+ 1 file changed, 14 insertions(+), 5 deletions(-)
+
+diff --git a/sound/core/ump_convert.c b/sound/core/ump_convert.c
+index 5d1b85e7ac165..0fe13d0316568 100644
+--- a/sound/core/ump_convert.c
++++ b/sound/core/ump_convert.c
+@@ -287,6 +287,15 @@ static int cvt_legacy_system_to_ump(struct ump_cvt_to_ump *cvt,
+ return 4;
+ }
+
++static void reset_rpn(struct ump_cvt_to_ump_bank *cc)
++{
++ cc->rpn_set = 0;
++ cc->nrpn_set = 0;
++ cc->cc_rpn_msb = cc->cc_rpn_lsb = 0;
++ cc->cc_data_msb = cc->cc_data_lsb = 0;
++ cc->cc_data_msb_set = cc->cc_data_lsb_set = 0;
++}
++
+ static int fill_rpn(struct ump_cvt_to_ump_bank *cc,
+ union snd_ump_midi2_msg *midi2,
+ bool flush)
+@@ -312,11 +321,7 @@ static int fill_rpn(struct ump_cvt_to_ump_bank *cc,
+ midi2->rpn.data = upscale_14_to_32bit((cc->cc_data_msb << 7) |
+ cc->cc_data_lsb);
+
+- cc->rpn_set = 0;
+- cc->nrpn_set = 0;
+- cc->cc_rpn_msb = cc->cc_rpn_lsb = 0;
+- cc->cc_data_msb = cc->cc_data_lsb = 0;
+- cc->cc_data_msb_set = cc->cc_data_lsb_set = 0;
++ reset_rpn(cc);
+ return 1;
+ }
+
+@@ -374,11 +379,15 @@ static int cvt_legacy_cmd_to_ump(struct ump_cvt_to_ump *cvt,
+ ret = fill_rpn(cc, midi2, true);
+ cc->rpn_set = 1;
+ cc->cc_rpn_msb = buf[2];
++ if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)
++ reset_rpn(cc);
+ return ret;
+ case UMP_CC_RPN_LSB:
+ ret = fill_rpn(cc, midi2, true);
+ cc->rpn_set = 1;
+ cc->cc_rpn_lsb = buf[2];
++ if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)
++ reset_rpn(cc);
+ return ret;
+ case UMP_CC_NRPN_MSB:
+ ret = fill_rpn(cc, midi2, true);
+--
+2.43.0
+
--- /dev/null
+From f9fcadfedfa723e7142b060079ed5fb3738a6601 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 31 Jul 2024 15:05:22 +0200
+Subject: ALSA: ump: Transmit RPN/NRPN message at each MSB/LSB data reception
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit e6ce8a28c768dbbad3f818db286cd0f4c7a921a8 ]
+
+The UMP 1.1 spec says that an RPN/NRPN should be sent when one of the
+following occurs:
+* a CC 38 is received
+* a subsequent CC 6 is received
+* a CC 98, 99, 100, and 101 is received, indicating the last RPN/NRPN
+ message has ended and a new one has started
+
+That said, we should send a partial data even if it's not fully
+filled. Let's change the UMP conversion helper code to follow that
+rule.
+
+Link: https://patch.msgid.link/20240731130528.12600-2-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/sound/ump_convert.h | 1 +
+ sound/core/ump_convert.c | 49 ++++++++++++++++++++++++-------------
+ 2 files changed, 33 insertions(+), 17 deletions(-)
+
+diff --git a/include/sound/ump_convert.h b/include/sound/ump_convert.h
+index 28c364c63245d..d099ae27f8491 100644
+--- a/include/sound/ump_convert.h
++++ b/include/sound/ump_convert.h
+@@ -13,6 +13,7 @@ struct ump_cvt_to_ump_bank {
+ unsigned char cc_nrpn_msb, cc_nrpn_lsb;
+ unsigned char cc_data_msb, cc_data_lsb;
+ unsigned char cc_bank_msb, cc_bank_lsb;
++ bool cc_data_msb_set, cc_data_lsb_set;
+ };
+
+ /* context for converting from MIDI1 byte stream to UMP packet */
+diff --git a/sound/core/ump_convert.c b/sound/core/ump_convert.c
+index f67c44c83fde4..5d1b85e7ac165 100644
+--- a/sound/core/ump_convert.c
++++ b/sound/core/ump_convert.c
+@@ -287,25 +287,37 @@ static int cvt_legacy_system_to_ump(struct ump_cvt_to_ump *cvt,
+ return 4;
+ }
+
+-static void fill_rpn(struct ump_cvt_to_ump_bank *cc,
+- union snd_ump_midi2_msg *midi2)
++static int fill_rpn(struct ump_cvt_to_ump_bank *cc,
++ union snd_ump_midi2_msg *midi2,
++ bool flush)
+ {
++ if (!(cc->cc_data_lsb_set || cc->cc_data_msb_set))
++ return 0; // skip
++ /* when not flushing, wait for complete data set */
++ if (!flush && (!cc->cc_data_lsb_set || !cc->cc_data_msb_set))
++ return 0; // skip
++
+ if (cc->rpn_set) {
+ midi2->rpn.status = UMP_MSG_STATUS_RPN;
+ midi2->rpn.bank = cc->cc_rpn_msb;
+ midi2->rpn.index = cc->cc_rpn_lsb;
+- cc->rpn_set = 0;
+- cc->cc_rpn_msb = cc->cc_rpn_lsb = 0;
+- } else {
++ } else if (cc->nrpn_set) {
+ midi2->rpn.status = UMP_MSG_STATUS_NRPN;
+ midi2->rpn.bank = cc->cc_nrpn_msb;
+ midi2->rpn.index = cc->cc_nrpn_lsb;
+- cc->nrpn_set = 0;
+- cc->cc_nrpn_msb = cc->cc_nrpn_lsb = 0;
++ } else {
++ return 0; // skip
+ }
++
+ midi2->rpn.data = upscale_14_to_32bit((cc->cc_data_msb << 7) |
+ cc->cc_data_lsb);
++
++ cc->rpn_set = 0;
++ cc->nrpn_set = 0;
++ cc->cc_rpn_msb = cc->cc_rpn_lsb = 0;
+ cc->cc_data_msb = cc->cc_data_lsb = 0;
++ cc->cc_data_msb_set = cc->cc_data_lsb_set = 0;
++ return 1;
+ }
+
+ /* convert to a MIDI 1.0 Channel Voice message */
+@@ -318,6 +330,7 @@ static int cvt_legacy_cmd_to_ump(struct ump_cvt_to_ump *cvt,
+ struct ump_cvt_to_ump_bank *cc;
+ union snd_ump_midi2_msg *midi2 = (union snd_ump_midi2_msg *)data;
+ unsigned char status, channel;
++ int ret;
+
+ BUILD_BUG_ON(sizeof(union snd_ump_midi1_msg) != 4);
+ BUILD_BUG_ON(sizeof(union snd_ump_midi2_msg) != 8);
+@@ -358,24 +371,29 @@ static int cvt_legacy_cmd_to_ump(struct ump_cvt_to_ump *cvt,
+ case UMP_MSG_STATUS_CC:
+ switch (buf[1]) {
+ case UMP_CC_RPN_MSB:
++ ret = fill_rpn(cc, midi2, true);
+ cc->rpn_set = 1;
+ cc->cc_rpn_msb = buf[2];
+- return 0; // skip
++ return ret;
+ case UMP_CC_RPN_LSB:
++ ret = fill_rpn(cc, midi2, true);
+ cc->rpn_set = 1;
+ cc->cc_rpn_lsb = buf[2];
+- return 0; // skip
++ return ret;
+ case UMP_CC_NRPN_MSB:
++ ret = fill_rpn(cc, midi2, true);
+ cc->nrpn_set = 1;
+ cc->cc_nrpn_msb = buf[2];
+- return 0; // skip
++ return ret;
+ case UMP_CC_NRPN_LSB:
++ ret = fill_rpn(cc, midi2, true);
+ cc->nrpn_set = 1;
+ cc->cc_nrpn_lsb = buf[2];
+- return 0; // skip
++ return ret;
+ case UMP_CC_DATA:
++ cc->cc_data_msb_set = 1;
+ cc->cc_data_msb = buf[2];
+- return 0; // skip
++ return fill_rpn(cc, midi2, false);
+ case UMP_CC_BANK_SELECT:
+ cc->bank_set = 1;
+ cc->cc_bank_msb = buf[2];
+@@ -385,12 +403,9 @@ static int cvt_legacy_cmd_to_ump(struct ump_cvt_to_ump *cvt,
+ cc->cc_bank_lsb = buf[2];
+ return 0; // skip
+ case UMP_CC_DATA_LSB:
++ cc->cc_data_lsb_set = 1;
+ cc->cc_data_lsb = buf[2];
+- if (cc->rpn_set || cc->nrpn_set)
+- fill_rpn(cc, midi2);
+- else
+- return 0; // skip
+- break;
++ return fill_rpn(cc, midi2, false);
+ default:
+ midi2->cc.index = buf[1];
+ midi2->cc.data = upscale_7_to_32bit(buf[2]);
+--
+2.43.0
+
--- /dev/null
+From bfa8156edcf6ed1edf19cc1d74c2418e4c9ee63a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 22 Jul 2024 11:42:47 +0200
+Subject: arm64: dts: qcom: x1e80100-crd: fix missing PCIe4 gpios
+
+From: Johan Hovold <johan+linaro@kernel.org>
+
+[ Upstream commit 42b33ad188466292eaac9825544b8be8deddb3cb ]
+
+Add the missing PCIe4 perst, wake and clkreq GPIOs and pin config.
+
+Fixes: d7e03cce0400 ("arm64: dts: qcom: x1e80100-crd: Enable more support")
+Cc: stable@vger.kernel.org # 6.9
+Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+Link: https://lore.kernel.org/r/20240722094249.26471-7-johan+linaro@kernel.org
+Signed-off-by: Bjorn Andersson <andersson@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/qcom/x1e80100-crd.dts | 29 +++++++++++++++++++++++
+ 1 file changed, 29 insertions(+)
+
+diff --git a/arch/arm64/boot/dts/qcom/x1e80100-crd.dts b/arch/arm64/boot/dts/qcom/x1e80100-crd.dts
+index 4096bb1ee4d3a..9f72e748c8041 100644
+--- a/arch/arm64/boot/dts/qcom/x1e80100-crd.dts
++++ b/arch/arm64/boot/dts/qcom/x1e80100-crd.dts
+@@ -658,6 +658,12 @@
+ };
+
+ &pcie4 {
++ perst-gpios = <&tlmm 146 GPIO_ACTIVE_LOW>;
++ wake-gpios = <&tlmm 148 GPIO_ACTIVE_LOW>;
++
++ pinctrl-0 = <&pcie4_default>;
++ pinctrl-names = "default";
++
+ status = "okay";
+ };
+
+@@ -833,6 +839,29 @@
+ bias-disable;
+ };
+
++ pcie4_default: pcie4-default-state {
++ clkreq-n-pins {
++ pins = "gpio147";
++ function = "pcie4_clk";
++ drive-strength = <2>;
++ bias-pull-up;
++ };
++
++ perst-n-pins {
++ pins = "gpio146";
++ function = "gpio";
++ drive-strength = <2>;
++ bias-disable;
++ };
++
++ wake-n-pins {
++ pins = "gpio148";
++ function = "gpio";
++ drive-strength = <2>;
++ bias-pull-up;
++ };
++ };
++
+ pcie6a_default: pcie6a-default-state {
+ clkreq-n-pins {
+ pins = "gpio153";
+--
+2.43.0
+
--- /dev/null
+From f91cd8871e02869f220768b3c4567c17e5d8b58b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 22 Jul 2024 11:42:45 +0200
+Subject: arm64: dts: qcom: x1e80100-crd: fix up PCIe6a pinctrl node
+
+From: Johan Hovold <johan+linaro@kernel.org>
+
+[ Upstream commit 6e3902c499544291ac4fd1a1bb69f2e9037a0e86 ]
+
+The PCIe6a pinctrl node appears to have been copied from the sc8280xp
+CRD dts, which has the NVMe on pcie2a and uses some funny indentation.
+
+Fix up the node name to match the x1e80100 use and label and use only
+tabs for indentation.
+
+Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+Link: https://lore.kernel.org/r/20240722094249.26471-5-johan+linaro@kernel.org
+Signed-off-by: Bjorn Andersson <andersson@kernel.org>
+Stable-dep-of: 42b33ad18846 ("arm64: dts: qcom: x1e80100-crd: fix missing PCIe4 gpios")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/qcom/x1e80100-crd.dts | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/arch/arm64/boot/dts/qcom/x1e80100-crd.dts b/arch/arm64/boot/dts/qcom/x1e80100-crd.dts
+index 0d47c75e2ad8c..4096bb1ee4d3a 100644
+--- a/arch/arm64/boot/dts/qcom/x1e80100-crd.dts
++++ b/arch/arm64/boot/dts/qcom/x1e80100-crd.dts
+@@ -833,7 +833,7 @@
+ bias-disable;
+ };
+
+- pcie6a_default: pcie2a-default-state {
++ pcie6a_default: pcie6a-default-state {
+ clkreq-n-pins {
+ pins = "gpio153";
+ function = "pcie6a_clk";
+@@ -849,11 +849,11 @@
+ };
+
+ wake-n-pins {
+- pins = "gpio154";
+- function = "gpio";
+- drive-strength = <2>;
+- bias-pull-up;
+- };
++ pins = "gpio154";
++ function = "gpio";
++ drive-strength = <2>;
++ bias-pull-up;
++ };
+ };
+
+ tpad_default: tpad-default-state {
+--
+2.43.0
+
--- /dev/null
+From 7d64c8ee128bd6960360c87a7700a4a0b77e41dc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 30 May 2024 18:43:41 +0300
+Subject: arm64: dts: qcom: x1e80100: Describe the PCIe 6a resources
+
+From: Abel Vesa <abel.vesa@linaro.org>
+
+[ Upstream commit eb57cbe730d10ec8c6505492a9f3252b160e0f1e ]
+
+On both the CRD and QCP, on PCIe 6a sits the NVMe. Add the 3.3V
+gpio-controlled regulator and the clkreq, perst and wake gpios as
+resources for the PCIe 6a.
+
+Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
+Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Link: https://lore.kernel.org/r/20240530-x1e80100-dts-pcie6a-v1-3-ee17a9939ba5@linaro.org
+Signed-off-by: Bjorn Andersson <andersson@kernel.org>
+Stable-dep-of: 42b33ad18846 ("arm64: dts: qcom: x1e80100-crd: fix missing PCIe4 gpios")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/qcom/x1e80100-crd.dts | 52 +++++++++++++++++++++++
+ arch/arm64/boot/dts/qcom/x1e80100-qcp.dts | 52 +++++++++++++++++++++++
+ 2 files changed, 104 insertions(+)
+
+diff --git a/arch/arm64/boot/dts/qcom/x1e80100-crd.dts b/arch/arm64/boot/dts/qcom/x1e80100-crd.dts
+index 7d03316c279df..0d47c75e2ad8c 100644
+--- a/arch/arm64/boot/dts/qcom/x1e80100-crd.dts
++++ b/arch/arm64/boot/dts/qcom/x1e80100-crd.dts
+@@ -173,6 +173,20 @@
+ regulator-always-on;
+ regulator-boot-on;
+ };
++
++ vreg_nvme: regulator-nvme {
++ compatible = "regulator-fixed";
++
++ regulator-name = "VREG_NVME_3P3";
++ regulator-min-microvolt = <3300000>;
++ regulator-max-microvolt = <3300000>;
++
++ gpio = <&tlmm 18 GPIO_ACTIVE_HIGH>;
++ enable-active-high;
++
++ pinctrl-names = "default";
++ pinctrl-0 = <&nvme_reg_en>;
++ };
+ };
+
+ &apps_rsc {
+@@ -655,6 +669,14 @@
+ };
+
+ &pcie6a {
++ perst-gpios = <&tlmm 152 GPIO_ACTIVE_LOW>;
++ wake-gpios = <&tlmm 154 GPIO_ACTIVE_LOW>;
++
++ vddpe-3v3-supply = <&vreg_nvme>;
++
++ pinctrl-names = "default";
++ pinctrl-0 = <&pcie6a_default>;
++
+ status = "okay";
+ };
+
+@@ -804,6 +826,36 @@
+ bias-disable;
+ };
+
++ nvme_reg_en: nvme-reg-en-state {
++ pins = "gpio18";
++ function = "gpio";
++ drive-strength = <2>;
++ bias-disable;
++ };
++
++ pcie6a_default: pcie2a-default-state {
++ clkreq-n-pins {
++ pins = "gpio153";
++ function = "pcie6a_clk";
++ drive-strength = <2>;
++ bias-pull-up;
++ };
++
++ perst-n-pins {
++ pins = "gpio152";
++ function = "gpio";
++ drive-strength = <2>;
++ bias-pull-down;
++ };
++
++ wake-n-pins {
++ pins = "gpio154";
++ function = "gpio";
++ drive-strength = <2>;
++ bias-pull-up;
++ };
++ };
++
+ tpad_default: tpad-default-state {
+ pins = "gpio3";
+ function = "gpio";
+diff --git a/arch/arm64/boot/dts/qcom/x1e80100-qcp.dts b/arch/arm64/boot/dts/qcom/x1e80100-qcp.dts
+index 2d7dedb7e30f2..d2c8c860895e6 100644
+--- a/arch/arm64/boot/dts/qcom/x1e80100-qcp.dts
++++ b/arch/arm64/boot/dts/qcom/x1e80100-qcp.dts
+@@ -59,6 +59,20 @@
+ regulator-always-on;
+ regulator-boot-on;
+ };
++
++ vreg_nvme: regulator-nvme {
++ compatible = "regulator-fixed";
++
++ regulator-name = "VREG_NVME_3P3";
++ regulator-min-microvolt = <3300000>;
++ regulator-max-microvolt = <3300000>;
++
++ gpio = <&tlmm 18 GPIO_ACTIVE_HIGH>;
++ enable-active-high;
++
++ pinctrl-names = "default";
++ pinctrl-0 = <&nvme_reg_en>;
++ };
+ };
+
+ &apps_rsc {
+@@ -466,6 +480,14 @@
+ };
+
+ &pcie6a {
++ perst-gpios = <&tlmm 152 GPIO_ACTIVE_LOW>;
++ wake-gpios = <&tlmm 154 GPIO_ACTIVE_LOW>;
++
++ vddpe-3v3-supply = <&vreg_nvme>;
++
++ pinctrl-names = "default";
++ pinctrl-0 = <&pcie6a_default>;
++
+ status = "okay";
+ };
+
+@@ -528,6 +550,36 @@
+ drive-strength = <16>;
+ bias-disable;
+ };
++
++ nvme_reg_en: nvme-reg-en-state {
++ pins = "gpio18";
++ function = "gpio";
++ drive-strength = <2>;
++ bias-disable;
++ };
++
++ pcie6a_default: pcie2a-default-state {
++ clkreq-n-pins {
++ pins = "gpio153";
++ function = "pcie6a_clk";
++ drive-strength = <2>;
++ bias-pull-up;
++ };
++
++ perst-n-pins {
++ pins = "gpio152";
++ function = "gpio";
++ drive-strength = <2>;
++ bias-pull-down;
++ };
++
++ wake-n-pins {
++ pins = "gpio154";
++ function = "gpio";
++ drive-strength = <2>;
++ bias-pull-up;
++ };
++ };
+ };
+
+ &uart21 {
+--
+2.43.0
+
--- /dev/null
+From 85c290af28b220b92c67e96260397b36e63eb219 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 22 Jul 2024 11:54:51 +0200
+Subject: arm64: dts: qcom: x1e80100-qcp: fix missing PCIe4 gpios
+
+From: Johan Hovold <johan+linaro@kernel.org>
+
+[ Upstream commit 2ac90e4d2b6d6823ca10642ef39595ff1181c3fa ]
+
+Add the missing PCIe4 perst, wake and clkreq GPIOs and pin config.
+
+Fixes: f9a9c11471da ("arm64: dts: qcom: x1e80100-qcp: Enable more support")
+Cc: stable@vger.kernel.org # 6.9
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
+Link: https://lore.kernel.org/r/20240722095459.27437-5-johan+linaro@kernel.org
+Signed-off-by: Bjorn Andersson <andersson@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/qcom/x1e80100-qcp.dts | 29 +++++++++++++++++++++++
+ 1 file changed, 29 insertions(+)
+
+diff --git a/arch/arm64/boot/dts/qcom/x1e80100-qcp.dts b/arch/arm64/boot/dts/qcom/x1e80100-qcp.dts
+index 2cf3ea4f6e2e6..f90177a662b7d 100644
+--- a/arch/arm64/boot/dts/qcom/x1e80100-qcp.dts
++++ b/arch/arm64/boot/dts/qcom/x1e80100-qcp.dts
+@@ -469,6 +469,12 @@
+ };
+
+ &pcie4 {
++ perst-gpios = <&tlmm 146 GPIO_ACTIVE_LOW>;
++ wake-gpios = <&tlmm 148 GPIO_ACTIVE_LOW>;
++
++ pinctrl-0 = <&pcie4_default>;
++ pinctrl-names = "default";
++
+ status = "okay";
+ };
+
+@@ -558,6 +564,29 @@
+ bias-disable;
+ };
+
++ pcie4_default: pcie4-default-state {
++ clkreq-n-pins {
++ pins = "gpio147";
++ function = "pcie4_clk";
++ drive-strength = <2>;
++ bias-pull-up;
++ };
++
++ perst-n-pins {
++ pins = "gpio146";
++ function = "gpio";
++ drive-strength = <2>;
++ bias-disable;
++ };
++
++ wake-n-pins {
++ pins = "gpio148";
++ function = "gpio";
++ drive-strength = <2>;
++ bias-pull-up;
++ };
++ };
++
+ pcie6a_default: pcie6a-default-state {
+ clkreq-n-pins {
+ pins = "gpio153";
+--
+2.43.0
+
--- /dev/null
+From fb19f876535c5e1fc86bfc2113dead8ea988f85c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 22 Jul 2024 11:54:49 +0200
+Subject: arm64: dts: qcom: x1e80100-qcp: fix up PCIe6a pinctrl node
+
+From: Johan Hovold <johan+linaro@kernel.org>
+
+[ Upstream commit 0aab6eaac72ac140dfc5e0a38bf3178497762e43 ]
+
+The PCIe6a pinctrl node appears to have been copied from the sc8280xp
+CRD dts, which has the NVMe on pcie2a and uses some funny indentation.
+
+Fix up the node name to match the x1e80100 use and label and use only
+tabs for indentation.
+
+Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
+Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
+Reviewed-by: Abel Vesa <abel.vesa@linaro.org>
+Link: https://lore.kernel.org/r/20240722095459.27437-3-johan+linaro@kernel.org
+Signed-off-by: Bjorn Andersson <andersson@kernel.org>
+Stable-dep-of: 2ac90e4d2b6d ("arm64: dts: qcom: x1e80100-qcp: fix missing PCIe4 gpios")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/qcom/x1e80100-qcp.dts | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/arch/arm64/boot/dts/qcom/x1e80100-qcp.dts b/arch/arm64/boot/dts/qcom/x1e80100-qcp.dts
+index d2c8c860895e6..2cf3ea4f6e2e6 100644
+--- a/arch/arm64/boot/dts/qcom/x1e80100-qcp.dts
++++ b/arch/arm64/boot/dts/qcom/x1e80100-qcp.dts
+@@ -558,7 +558,7 @@
+ bias-disable;
+ };
+
+- pcie6a_default: pcie2a-default-state {
++ pcie6a_default: pcie6a-default-state {
+ clkreq-n-pins {
+ pins = "gpio153";
+ function = "pcie6a_clk";
+@@ -574,11 +574,11 @@
+ };
+
+ wake-n-pins {
+- pins = "gpio154";
+- function = "gpio";
+- drive-strength = <2>;
+- bias-pull-up;
+- };
++ pins = "gpio154";
++ function = "gpio";
++ drive-strength = <2>;
++ bias-pull-up;
++ };
+ };
+ };
+
+--
+2.43.0
+
--- /dev/null
+From a1f43e172718a0752856a02b7173c83a1bc6963e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 28 Jul 2024 22:50:32 -0600
+Subject: ASoC: amd: yc: Support mic on HP 14-em0002la
+
+From: Bruno Ancona <brunoanconasala@gmail.com>
+
+[ Upstream commit c118478665f467e57d06b2354de65974b246b82b ]
+
+Add support for the internal microphone for HP 14-em0002la laptop using
+a quirk entry.
+
+Signed-off-by: Bruno Ancona <brunoanconasala@gmail.com>
+Link: https://patch.msgid.link/20240729045032.223230-1-brunoanconasala@gmail.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/amd/yc/acp6x-mach.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c
+index d597e59863ee3..e933d07614527 100644
+--- a/sound/soc/amd/yc/acp6x-mach.c
++++ b/sound/soc/amd/yc/acp6x-mach.c
+@@ -430,6 +430,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
+ DMI_MATCH(DMI_BOARD_NAME, "8A3E"),
+ }
+ },
++ {
++ .driver_data = &acp6x_card,
++ .matches = {
++ DMI_MATCH(DMI_BOARD_VENDOR, "HP"),
++ DMI_MATCH(DMI_BOARD_NAME, "8B27"),
++ }
++ },
+ {
+ .driver_data = &acp6x_card,
+ .matches = {
+--
+2.43.0
+
--- /dev/null
+From 2579ca9f7514fe7e0e8d50bd44252ae2773849ad Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 7 Aug 2024 02:12:19 +0200
+Subject: ASoC: amd: yc: Support mic on Lenovo Thinkpad E14 Gen 6
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Krzysztof Stępniak <kfs.szk@gmail.com>
+
+[ Upstream commit 23a58b782f864951485d7a0018549729e007cb43 ]
+
+Lenovo Thinkpad E14 Gen 6 (model type 21M3)
+needs a quirk entry for internal mic to work.
+
+Signed-off-by: Krzysztof Stępniak <kfs.szk@gmail.com>
+Link: https://patch.msgid.link/20240807001219.1147-1-kfs.szk@gmail.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/amd/yc/acp6x-mach.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c
+index e933d07614527..f6c1dbd0ebcf5 100644
+--- a/sound/soc/amd/yc/acp6x-mach.c
++++ b/sound/soc/amd/yc/acp6x-mach.c
+@@ -220,6 +220,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
+ DMI_MATCH(DMI_PRODUCT_NAME, "21J6"),
+ }
+ },
++ {
++ .driver_data = &acp6x_card,
++ .matches = {
++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
++ DMI_MATCH(DMI_PRODUCT_NAME, "21M3"),
++ }
++ },
+ {
+ .driver_data = &acp6x_card,
+ .matches = {
+--
+2.43.0
+
--- /dev/null
+From df8199fa78efd36a1194a9f4315d80f9c1acd8f2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 7 Aug 2024 10:53:55 +0800
+Subject: ASoC: codecs: ES8326: button detect issue
+
+From: Zhang Yi <zhangyi@everest-semi.com>
+
+[ Upstream commit 4684a2df9c5b3fc914377127faf2515aa9049093 ]
+
+We find that we need to set snd_jack_types to 0. If not,
+there will be a probability of button detection errors
+
+Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
+Link: https://patch.msgid.link/20240807025356.24904-2-zhangyi@everest-semi.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/es8326.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
+index 6a4e42e5e35b9..e620af9b864cb 100644
+--- a/sound/soc/codecs/es8326.c
++++ b/sound/soc/codecs/es8326.c
+@@ -825,6 +825,8 @@ static void es8326_jack_detect_handler(struct work_struct *work)
+ es8326_disable_micbias(es8326->component);
+ if (es8326->jack->status & SND_JACK_HEADPHONE) {
+ dev_dbg(comp->dev, "Report hp remove event\n");
++ snd_soc_jack_report(es8326->jack, 0,
++ SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2);
+ snd_soc_jack_report(es8326->jack, 0, SND_JACK_HEADSET);
+ /* mute adc when mic path switch */
+ regmap_write(es8326->regmap, ES8326_ADC1_SRC, 0x44);
+--
+2.43.0
+
--- /dev/null
+From d2d9405944529708da21473429391035884b7978 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 8 Mar 2024 13:40:30 +1030
+Subject: btrfs: factor out stripe length calculation into a helper
+
+From: Qu Wenruo <wqu@suse.com>
+
+[ Upstream commit 33eb1e5db351e2c0e652d878b66b8a6d4d013135 ]
+
+Currently there are two locations which need to calculate the real
+length of a stripe (which can be at the end of a chunk, and the chunk
+size may not always be 64K aligned).
+
+Factor them into a helper as we're going to have a third user soon.
+
+Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
+Signed-off-by: Qu Wenruo <wqu@suse.com>
+Reviewed-by: David Sterba <dsterba@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/btrfs/scrub.c | 16 ++++++++++------
+ 1 file changed, 10 insertions(+), 6 deletions(-)
+
+diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
+index d7caa3732f074..9712169593980 100644
+--- a/fs/btrfs/scrub.c
++++ b/fs/btrfs/scrub.c
+@@ -1648,14 +1648,20 @@ static void scrub_reset_stripe(struct scrub_stripe *stripe)
+ }
+ }
+
++static u32 stripe_length(const struct scrub_stripe *stripe)
++{
++ ASSERT(stripe->bg);
++
++ return min(BTRFS_STRIPE_LEN,
++ stripe->bg->start + stripe->bg->length - stripe->logical);
++}
++
+ static void scrub_submit_extent_sector_read(struct scrub_ctx *sctx,
+ struct scrub_stripe *stripe)
+ {
+ struct btrfs_fs_info *fs_info = stripe->bg->fs_info;
+ struct btrfs_bio *bbio = NULL;
+- unsigned int nr_sectors = min(BTRFS_STRIPE_LEN, stripe->bg->start +
+- stripe->bg->length - stripe->logical) >>
+- fs_info->sectorsize_bits;
++ unsigned int nr_sectors = stripe_length(stripe) >> fs_info->sectorsize_bits;
+ u64 stripe_len = BTRFS_STRIPE_LEN;
+ int mirror = stripe->mirror_num;
+ int i;
+@@ -1729,9 +1735,7 @@ static void scrub_submit_initial_read(struct scrub_ctx *sctx,
+ {
+ struct btrfs_fs_info *fs_info = sctx->fs_info;
+ struct btrfs_bio *bbio;
+- unsigned int nr_sectors = min(BTRFS_STRIPE_LEN, stripe->bg->start +
+- stripe->bg->length - stripe->logical) >>
+- fs_info->sectorsize_bits;
++ unsigned int nr_sectors = stripe_length(stripe) >> fs_info->sectorsize_bits;
+ int mirror = stripe->mirror_num;
+
+ ASSERT(stripe->bg);
+--
+2.43.0
+
--- /dev/null
+From 16aae517c9f662e27a70b6e562e9e48ee071a693 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 19 Jul 2024 16:49:08 -0700
+Subject: btrfs: fix qgroup reserve leaks in cow_file_range
+
+From: Boris Burkov <boris@bur.io>
+
+[ Upstream commit 30479f31d44d47ed00ae0c7453d9b253537005b2 ]
+
+In the buffered write path, the dirty page owns the qgroup reserve until
+it creates an ordered_extent.
+
+Therefore, any errors that occur before the ordered_extent is created
+must free that reservation, or else the space is leaked. The fstest
+generic/475 exercises various IO error paths, and is able to trigger
+errors in cow_file_range where we fail to get to allocating the ordered
+extent. Note that because we *do* clear delalloc, we are likely to
+remove the inode from the delalloc list, so the inodes/pages to not have
+invalidate/launder called on them in the commit abort path.
+
+This results in failures at the unmount stage of the test that look like:
+
+ BTRFS: error (device dm-8 state EA) in cleanup_transaction:2018: errno=-5 IO failure
+ BTRFS: error (device dm-8 state EA) in btrfs_replace_file_extents:2416: errno=-5 IO failure
+ BTRFS warning (device dm-8 state EA): qgroup 0/5 has unreleased space, type 0 rsv 28672
+ ------------[ cut here ]------------
+ WARNING: CPU: 3 PID: 22588 at fs/btrfs/disk-io.c:4333 close_ctree+0x222/0x4d0 [btrfs]
+ Modules linked in: btrfs blake2b_generic libcrc32c xor zstd_compress raid6_pq
+ CPU: 3 PID: 22588 Comm: umount Kdump: loaded Tainted: G W 6.10.0-rc7-gab56fde445b8 #21
+ Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Arch Linux 1.16.3-1-1 04/01/2014
+ RIP: 0010:close_ctree+0x222/0x4d0 [btrfs]
+ RSP: 0018:ffffb4465283be00 EFLAGS: 00010202
+ RAX: 0000000000000001 RBX: ffffa1a1818e1000 RCX: 0000000000000001
+ RDX: 0000000000000000 RSI: ffffb4465283bbe0 RDI: ffffa1a19374fcb8
+ RBP: ffffa1a1818e13c0 R08: 0000000100028b16 R09: 0000000000000000
+ R10: 0000000000000003 R11: 0000000000000003 R12: ffffa1a18ad7972c
+ R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
+ FS: 00007f9168312b80(0000) GS:ffffa1a4afcc0000(0000) knlGS:0000000000000000
+ CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+ CR2: 00007f91683c9140 CR3: 000000010acaa000 CR4: 00000000000006f0
+ Call Trace:
+ <TASK>
+ ? close_ctree+0x222/0x4d0 [btrfs]
+ ? __warn.cold+0x8e/0xea
+ ? close_ctree+0x222/0x4d0 [btrfs]
+ ? report_bug+0xff/0x140
+ ? handle_bug+0x3b/0x70
+ ? exc_invalid_op+0x17/0x70
+ ? asm_exc_invalid_op+0x1a/0x20
+ ? close_ctree+0x222/0x4d0 [btrfs]
+ generic_shutdown_super+0x70/0x160
+ kill_anon_super+0x11/0x40
+ btrfs_kill_super+0x11/0x20 [btrfs]
+ deactivate_locked_super+0x2e/0xa0
+ cleanup_mnt+0xb5/0x150
+ task_work_run+0x57/0x80
+ syscall_exit_to_user_mode+0x121/0x130
+ do_syscall_64+0xab/0x1a0
+ entry_SYSCALL_64_after_hwframe+0x77/0x7f
+ RIP: 0033:0x7f916847a887
+ ---[ end trace 0000000000000000 ]---
+ BTRFS error (device dm-8 state EA): qgroup reserved space leaked
+
+Cases 2 and 3 in the out_reserve path both pertain to this type of leak
+and must free the reserved qgroup data. Because it is already an error
+path, I opted not to handle the possible errors in
+btrfs_free_qgroup_data.
+
+Reviewed-by: Qu Wenruo <wqu@suse.com>
+Signed-off-by: Boris Burkov <boris@bur.io>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/btrfs/inode.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
+index 39d22693e47b6..c2f48fc159e5a 100644
+--- a/fs/btrfs/inode.c
++++ b/fs/btrfs/inode.c
+@@ -1586,6 +1586,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode,
+ locked_page, &cached,
+ clear_bits,
+ page_ops);
++ btrfs_qgroup_free_data(inode, NULL, start, cur_alloc_size, NULL);
+ start += cur_alloc_size;
+ }
+
+@@ -1599,6 +1600,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode,
+ clear_bits |= EXTENT_CLEAR_DATA_RESV;
+ extent_clear_unlock_delalloc(inode, start, end, locked_page,
+ &cached, clear_bits, page_ops);
++ btrfs_qgroup_free_data(inode, NULL, start, cur_alloc_size, NULL);
+ }
+ return ret;
+ }
+@@ -2269,6 +2271,7 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode,
+ EXTENT_DO_ACCOUNTING, PAGE_UNLOCK |
+ PAGE_START_WRITEBACK |
+ PAGE_END_WRITEBACK);
++ btrfs_qgroup_free_data(inode, NULL, cur_offset, end - cur_offset + 1, NULL);
+ }
+ btrfs_free_path(path);
+ return ret;
+--
+2.43.0
+
--- /dev/null
+From 219c05f189b7f160a05fb0699486ae36ed79e0a6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 8 Mar 2024 13:40:31 +1030
+Subject: btrfs: scrub: update last_physical after scrubbing one stripe
+
+From: Qu Wenruo <wqu@suse.com>
+
+[ Upstream commit 63447b7dd40c6a9ae8d3bb70c11f4c46731823e3 ]
+
+Currently sctx->stat.last_physical only got updated in the following
+cases:
+
+- When the last stripe of a non-RAID56 chunk is scrubbed
+ This implies a pitfall, if the last stripe is at the chunk boundary,
+ and we finished the scrub of the whole chunk, we won't update
+ last_physical at all until the next chunk.
+
+- When a P/Q stripe of a RAID56 chunk is scrubbed
+
+This leads the following two problems:
+
+- sctx->stat.last_physical is not updated for a almost full chunk
+ This is especially bad, affecting scrub resume, as the resume would
+ start from last_physical, causing unnecessary re-scrub.
+
+- "btrfs scrub status" will not report any progress for a long time
+
+Fix the problem by properly updating @last_physical after each stripe is
+scrubbed.
+
+And since we're here, for the sake of consistency, use spin lock to
+protect the update of @last_physical, just like all the remaining
+call sites touching sctx->stat.
+
+Reported-by: Michel Palleau <michel.palleau@gmail.com>
+Link: https://lore.kernel.org/linux-btrfs/CAMFk-+igFTv2E8svg=cQ6o3e6CrR5QwgQ3Ok9EyRaEvvthpqCQ@mail.gmail.com/
+Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
+Signed-off-by: Qu Wenruo <wqu@suse.com>
+Reviewed-by: David Sterba <dsterba@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/btrfs/scrub.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
+index 9712169593980..731d7d562db1a 100644
+--- a/fs/btrfs/scrub.c
++++ b/fs/btrfs/scrub.c
+@@ -1875,6 +1875,9 @@ static int flush_scrub_stripes(struct scrub_ctx *sctx)
+ stripe = &sctx->stripes[i];
+
+ wait_scrub_stripe_io(stripe);
++ spin_lock(&sctx->stat_lock);
++ sctx->stat.last_physical = stripe->physical + stripe_length(stripe);
++ spin_unlock(&sctx->stat_lock);
+ scrub_reset_stripe(stripe);
+ }
+ out:
+@@ -2143,7 +2146,9 @@ static int scrub_simple_mirror(struct scrub_ctx *sctx,
+ cur_physical, &found_logical);
+ if (ret > 0) {
+ /* No more extent, just update the accounting */
++ spin_lock(&sctx->stat_lock);
+ sctx->stat.last_physical = physical + logical_length;
++ spin_unlock(&sctx->stat_lock);
+ ret = 0;
+ break;
+ }
+@@ -2340,6 +2345,10 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
+ stripe_logical += chunk_logical;
+ ret = scrub_raid56_parity_stripe(sctx, scrub_dev, bg,
+ map, stripe_logical);
++ spin_lock(&sctx->stat_lock);
++ sctx->stat.last_physical = min(physical + BTRFS_STRIPE_LEN,
++ physical_end);
++ spin_unlock(&sctx->stat_lock);
+ if (ret)
+ goto out;
+ goto next;
+--
+2.43.0
+
--- /dev/null
+From 7271b736b36e3c1edcf3473bf404082972133556 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 15 Jul 2024 16:07:07 +0930
+Subject: btrfs: tree-checker: validate dref root and objectid
+
+From: Qu Wenruo <wqu@suse.com>
+
+[ Upstream commit f333a3c7e8323499aa65038e77fe8f3199d4e283 ]
+
+[CORRUPTION]
+There is a bug report that btrfs flips RO due to a corruption in the
+extent tree, the involved dumps looks like this:
+
+ item 188 key (402811572224 168 4096) itemoff 14598 itemsize 79
+ extent refs 3 gen 3678544 flags 1
+ ref#0: extent data backref root 13835058055282163977 objectid 281473384125923 offset 81432576 count 1
+ ref#1: shared data backref parent 1947073626112 count 1
+ ref#2: shared data backref parent 1156030103552 count 1
+ BTRFS critical (device vdc1: state EA): unable to find ref byte nr 402811572224 parent 0 root 265 owner 28703026 offset 81432576 slot 189
+ BTRFS error (device vdc1: state EA): failed to run delayed ref for logical 402811572224 num_bytes 4096 type 178 action 2 ref_mod 1: -2
+
+[CAUSE]
+The corrupted entry is ref#0 of item 188.
+The root number 13835058055282163977 is beyond the upper limit for root
+items (the current limit is 1 << 48), and the objectid also looks
+suspicious.
+
+Only the offset and count is correct.
+
+[ENHANCEMENT]
+Although it's still unknown why we have such many bytes corrupted
+randomly, we can still enhance the tree-checker for data backrefs by:
+
+- Validate the root value
+ For now there should only be 3 types of roots can have data backref:
+ * subvolume trees
+ * data reloc trees
+ * root tree
+ Only for v1 space cache
+
+- validate the objectid value
+ The objectid should be a valid inode number.
+
+Hopefully we can catch such problem in the future with the new checkers.
+
+Reported-by: Kai Krakow <hurikhan77@gmail.com>
+Link: https://lore.kernel.org/linux-btrfs/CAMthOuPjg5RDT-G_LXeBBUUtzt3cq=JywF+D1_h+JYxe=WKp-Q@mail.gmail.com/#t
+Reviewed-by: Filipe Manana <fdmanana@suse.com>
+Signed-off-by: Qu Wenruo <wqu@suse.com>
+Reviewed-by: David Sterba <dsterba@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/btrfs/tree-checker.c | 47 +++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 47 insertions(+)
+
+diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
+index 897e19790522d..de1c063bc39db 100644
+--- a/fs/btrfs/tree-checker.c
++++ b/fs/btrfs/tree-checker.c
+@@ -1272,6 +1272,19 @@ static void extent_err(const struct extent_buffer *eb, int slot,
+ va_end(args);
+ }
+
++static bool is_valid_dref_root(u64 rootid)
++{
++ /*
++ * The following tree root objectids are allowed to have a data backref:
++ * - subvolume trees
++ * - data reloc tree
++ * - tree root
++ * For v1 space cache
++ */
++ return is_fstree(rootid) || rootid == BTRFS_DATA_RELOC_TREE_OBJECTID ||
++ rootid == BTRFS_ROOT_TREE_OBJECTID;
++}
++
+ static int check_extent_item(struct extent_buffer *leaf,
+ struct btrfs_key *key, int slot,
+ struct btrfs_key *prev_key)
+@@ -1424,6 +1437,8 @@ static int check_extent_item(struct extent_buffer *leaf,
+ struct btrfs_extent_data_ref *dref;
+ struct btrfs_shared_data_ref *sref;
+ u64 seq;
++ u64 dref_root;
++ u64 dref_objectid;
+ u64 dref_offset;
+ u64 inline_offset;
+ u8 inline_type;
+@@ -1467,11 +1482,26 @@ static int check_extent_item(struct extent_buffer *leaf,
+ */
+ case BTRFS_EXTENT_DATA_REF_KEY:
+ dref = (struct btrfs_extent_data_ref *)(&iref->offset);
++ dref_root = btrfs_extent_data_ref_root(leaf, dref);
++ dref_objectid = btrfs_extent_data_ref_objectid(leaf, dref);
+ dref_offset = btrfs_extent_data_ref_offset(leaf, dref);
+ seq = hash_extent_data_ref(
+ btrfs_extent_data_ref_root(leaf, dref),
+ btrfs_extent_data_ref_objectid(leaf, dref),
+ btrfs_extent_data_ref_offset(leaf, dref));
++ if (unlikely(!is_valid_dref_root(dref_root))) {
++ extent_err(leaf, slot,
++ "invalid data ref root value %llu",
++ dref_root);
++ return -EUCLEAN;
++ }
++ if (unlikely(dref_objectid < BTRFS_FIRST_FREE_OBJECTID ||
++ dref_objectid > BTRFS_LAST_FREE_OBJECTID)) {
++ extent_err(leaf, slot,
++ "invalid data ref objectid value %llu",
++ dref_root);
++ return -EUCLEAN;
++ }
+ if (unlikely(!IS_ALIGNED(dref_offset,
+ fs_info->sectorsize))) {
+ extent_err(leaf, slot,
+@@ -1610,6 +1640,8 @@ static int check_extent_data_ref(struct extent_buffer *leaf,
+ return -EUCLEAN;
+ }
+ for (; ptr < end; ptr += sizeof(*dref)) {
++ u64 root;
++ u64 objectid;
+ u64 offset;
+
+ /*
+@@ -1617,7 +1649,22 @@ static int check_extent_data_ref(struct extent_buffer *leaf,
+ * overflow from the leaf due to hash collisions.
+ */
+ dref = (struct btrfs_extent_data_ref *)ptr;
++ root = btrfs_extent_data_ref_root(leaf, dref);
++ objectid = btrfs_extent_data_ref_objectid(leaf, dref);
+ offset = btrfs_extent_data_ref_offset(leaf, dref);
++ if (unlikely(!is_valid_dref_root(root))) {
++ extent_err(leaf, slot,
++ "invalid extent data backref root value %llu",
++ root);
++ return -EUCLEAN;
++ }
++ if (unlikely(objectid < BTRFS_FIRST_FREE_OBJECTID ||
++ objectid > BTRFS_LAST_FREE_OBJECTID)) {
++ extent_err(leaf, slot,
++ "invalid extent data backref objectid value %llu",
++ root);
++ return -EUCLEAN;
++ }
+ if (unlikely(!IS_ALIGNED(offset, leaf->fs_info->sectorsize))) {
+ extent_err(leaf, slot,
+ "invalid extent data backref offset, have %llu expect aligned to %u",
+--
+2.43.0
+
--- /dev/null
+From 4f827751300e930553f3c54caf69d474ef649519 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 6 Aug 2024 11:56:45 -0400
+Subject: dma-debug: avoid deadlock between dma debug vs printk and netconsole
+
+From: Rik van Riel <riel@surriel.com>
+
+[ Upstream commit bd44ca3de49cc1badcff7a96010fa2c64f04868c ]
+
+Currently the dma debugging code can end up indirectly calling printk
+under the radix_lock. This happens when a radix tree node allocation
+fails.
+
+This is a problem because the printk code, when used together with
+netconsole, can end up inside the dma debugging code while trying to
+transmit a message over netcons.
+
+This creates the possibility of either a circular deadlock on the same
+CPU, with that CPU trying to grab the radix_lock twice, or an ABBA
+deadlock between different CPUs, where one CPU grabs the console lock
+first and then waits for the radix_lock, while the other CPU is holding
+the radix_lock and is waiting for the console lock.
+
+The trace captured by lockdep is of the ABBA variant.
+
+-> #2 (&dma_entry_hash[i].lock){-.-.}-{2:2}:
+ _raw_spin_lock_irqsave+0x5a/0x90
+ debug_dma_map_page+0x79/0x180
+ dma_map_page_attrs+0x1d2/0x2f0
+ bnxt_start_xmit+0x8c6/0x1540
+ netpoll_start_xmit+0x13f/0x180
+ netpoll_send_skb+0x20d/0x320
+ netpoll_send_udp+0x453/0x4a0
+ write_ext_msg+0x1b9/0x460
+ console_flush_all+0x2ff/0x5a0
+ console_unlock+0x55/0x180
+ vprintk_emit+0x2e3/0x3c0
+ devkmsg_emit+0x5a/0x80
+ devkmsg_write+0xfd/0x180
+ do_iter_readv_writev+0x164/0x1b0
+ vfs_writev+0xf9/0x2b0
+ do_writev+0x6d/0x110
+ do_syscall_64+0x80/0x150
+ entry_SYSCALL_64_after_hwframe+0x4b/0x53
+
+-> #0 (console_owner){-.-.}-{0:0}:
+ __lock_acquire+0x15d1/0x31a0
+ lock_acquire+0xe8/0x290
+ console_flush_all+0x2ea/0x5a0
+ console_unlock+0x55/0x180
+ vprintk_emit+0x2e3/0x3c0
+ _printk+0x59/0x80
+ warn_alloc+0x122/0x1b0
+ __alloc_pages_slowpath+0x1101/0x1120
+ __alloc_pages+0x1eb/0x2c0
+ alloc_slab_page+0x5f/0x150
+ new_slab+0x2dc/0x4e0
+ ___slab_alloc+0xdcb/0x1390
+ kmem_cache_alloc+0x23d/0x360
+ radix_tree_node_alloc+0x3c/0xf0
+ radix_tree_insert+0xf5/0x230
+ add_dma_entry+0xe9/0x360
+ dma_map_page_attrs+0x1d2/0x2f0
+ __bnxt_alloc_rx_frag+0x147/0x180
+ bnxt_alloc_rx_data+0x79/0x160
+ bnxt_rx_skb+0x29/0xc0
+ bnxt_rx_pkt+0xe22/0x1570
+ __bnxt_poll_work+0x101/0x390
+ bnxt_poll+0x7e/0x320
+ __napi_poll+0x29/0x160
+ net_rx_action+0x1e0/0x3e0
+ handle_softirqs+0x190/0x510
+ run_ksoftirqd+0x4e/0x90
+ smpboot_thread_fn+0x1a8/0x270
+ kthread+0x102/0x120
+ ret_from_fork+0x2f/0x40
+ ret_from_fork_asm+0x11/0x20
+
+This bug is more likely than it seems, because when one CPU has run out
+of memory, chances are the other has too.
+
+The good news is, this bug is hidden behind the CONFIG_DMA_API_DEBUG, so
+not many users are likely to trigger it.
+
+Signed-off-by: Rik van Riel <riel@surriel.com>
+Reported-by: Konstantin Ovsepian <ovs@meta.com>
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/dma/debug.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c
+index a6e3792b15f8a..d570535342cb7 100644
+--- a/kernel/dma/debug.c
++++ b/kernel/dma/debug.c
+@@ -416,8 +416,11 @@ static unsigned long long phys_addr(struct dma_debug_entry *entry)
+ * dma_active_cacheline entry to track per event. dma_map_sg(), on the
+ * other hand, consumes a single dma_debug_entry, but inserts 'nents'
+ * entries into the tree.
++ *
++ * Use __GFP_NOWARN because the printk from an OOM, to netconsole, could end
++ * up right back in the DMA debugging code, leading to a deadlock.
+ */
+-static RADIX_TREE(dma_active_cacheline, GFP_ATOMIC);
++static RADIX_TREE(dma_active_cacheline, GFP_ATOMIC | __GFP_NOWARN);
+ static DEFINE_SPINLOCK(radix_lock);
+ #define ACTIVE_CACHELINE_MAX_OVERLAP ((1 << RADIX_TREE_MAX_TAGS) - 1)
+ #define CACHELINE_PER_PAGE_SHIFT (PAGE_SHIFT - L1_CACHE_SHIFT)
+--
+2.43.0
+
--- /dev/null
+From 87c5ca9f89fef4fa10520e3b930e0af31c399b64 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 3 Jul 2024 22:17:37 +0800
+Subject: drm/fb-helper: Don't schedule_work() to flush frame buffer during
+ panic()
+
+From: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
+
+[ Upstream commit 833cd3e9ad8360785b6c23c82dd3856df00732d9 ]
+
+Sometimes the system [1] hangs on x86 I/O machine checks. However, the
+expected behavior is to reboot the system, as the machine check handler
+ultimately triggers a panic(), initiating a reboot in the last step.
+
+The root cause is that sometimes the panic() is blocked when
+drm_fb_helper_damage() invoking schedule_work() to flush the frame buffer.
+This occurs during the process of flushing all messages to the frame
+buffer driver as shown in the following call trace:
+
+ Machine check occurs [2]:
+ panic()
+ console_flush_on_panic()
+ console_flush_all()
+ console_emit_next_record()
+ con->write()
+ vt_console_print()
+ hide_cursor()
+ vc->vc_sw->con_cursor()
+ fbcon_cursor()
+ ops->cursor()
+ bit_cursor()
+ soft_cursor()
+ info->fbops->fb_imageblit()
+ drm_fbdev_generic_defio_imageblit()
+ drm_fb_helper_damage_area()
+ drm_fb_helper_damage()
+ schedule_work() // <--- blocked here
+ ...
+ emergency_restart() // wasn't invoked, so no reboot.
+
+During panic(), except the panic CPU, all the other CPUs are stopped.
+In schedule_work(), the panic CPU requires the lock of worker_pool to
+queue the work on that pool, while the lock may have been token by some
+other stopped CPU. So schedule_work() is blocked.
+
+Additionally, during a panic(), since there is no opportunity to execute
+any scheduled work, it's safe to fix this issue by skipping schedule_work()
+on 'oops_in_progress' in drm_fb_helper_damage().
+
+[1] Enable the kernel option CONFIG_FRAMEBUFFER_CONSOLE,
+ CONFIG_DRM_FBDEV_EMULATION, and boot with the 'console=tty0'
+ kernel command line parameter.
+
+[2] Set 'panic_timeout' to a non-zero value before calling panic().
+
+Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
+Reported-by: Yudong Wang <yudong.wang@intel.com>
+Tested-by: Yudong Wang <yudong.wang@intel.com>
+Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240703141737.75378-1-qiuxu.zhuo@intel.com
+Signed-off-by: Maarten Lankhorst,,, <maarten.lankhorst@linux.intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/drm_fb_helper.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
+index 117237d3528bd..618b045230336 100644
+--- a/drivers/gpu/drm/drm_fb_helper.c
++++ b/drivers/gpu/drm/drm_fb_helper.c
+@@ -631,6 +631,17 @@ static void drm_fb_helper_add_damage_clip(struct drm_fb_helper *helper, u32 x, u
+ static void drm_fb_helper_damage(struct drm_fb_helper *helper, u32 x, u32 y,
+ u32 width, u32 height)
+ {
++ /*
++ * This function may be invoked by panic() to flush the frame
++ * buffer, where all CPUs except the panic CPU are stopped.
++ * During the following schedule_work(), the panic CPU needs
++ * the worker_pool lock, which might be held by a stopped CPU,
++ * causing schedule_work() and panic() to block. Return early on
++ * oops_in_progress to prevent this blocking.
++ */
++ if (oops_in_progress)
++ return;
++
+ drm_fb_helper_add_damage_clip(helper, x, y, width, height);
+
+ schedule_work(&helper->damage_work);
+--
+2.43.0
+
--- /dev/null
+From e6c4e7d7fa110b165c8db40d75a11957baa3c78b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 15 Jul 2024 11:57:49 +0700
+Subject: drm: panel-orientation-quirks: Add quirk for OrangePi Neo
+
+From: Philip Mueller <philm@manjaro.org>
+
+[ Upstream commit d60c429610a14560085d98fa6f4cdb43040ca8f0 ]
+
+This adds a DMI orientation quirk for the OrangePi Neo Linux Gaming
+Handheld.
+
+Signed-off-by: Philip Mueller <philm@manjaro.org>
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240715045818.1019979-1-philm@manjaro.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c
+index 3860a8ce1e2d4..903f4bfea7e83 100644
+--- a/drivers/gpu/drm/drm_panel_orientation_quirks.c
++++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c
+@@ -414,6 +414,12 @@ static const struct dmi_system_id orientation_data[] = {
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ONE XPLAYER"),
+ },
+ .driver_data = (void *)&lcd1600x2560_leftside_up,
++ }, { /* OrangePi Neo */
++ .matches = {
++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "OrangePi"),
++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "NEO-01"),
++ },
++ .driver_data = (void *)&lcd1200x1920_rightside_up,
+ }, { /* Samsung GalaxyBook 10.6 */
+ .matches = {
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+--
+2.43.0
+
--- /dev/null
+From 6fdf3b021480b904ad1d7b8b83864d6c187a196b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 2 Aug 2024 16:22:14 +0100
+Subject: i2c: Fix conditional for substituting empty ACPI functions
+
+From: Richard Fitzgerald <rf@opensource.cirrus.com>
+
+[ Upstream commit f17c06c6608ad4ecd2ccf321753fb511812d821b ]
+
+Add IS_ENABLED(CONFIG_I2C) to the conditional around a bunch of ACPI
+functions.
+
+The conditional around these functions depended only on CONFIG_ACPI.
+But the functions are implemented in I2C core, so are only present if
+CONFIG_I2C is enabled.
+
+Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
+Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/i2c.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/linux/i2c.h b/include/linux/i2c.h
+index 424acb98c7c26..97b18dff3a4fc 100644
+--- a/include/linux/i2c.h
++++ b/include/linux/i2c.h
+@@ -1053,7 +1053,7 @@ static inline int of_i2c_get_board_info(struct device *dev,
+ struct acpi_resource;
+ struct acpi_resource_i2c_serialbus;
+
+-#if IS_ENABLED(CONFIG_ACPI)
++#if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_I2C)
+ bool i2c_acpi_get_i2c_resource(struct acpi_resource *ares,
+ struct acpi_resource_i2c_serialbus **i2c);
+ int i2c_acpi_client_count(struct acpi_device *adev);
+--
+2.43.0
+
--- /dev/null
+From 5e683d2f584c21694b412c8ebeb19deb1a62fa40 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 30 Jul 2024 09:16:32 +0300
+Subject: net/mlx5: DR, Fix 'stack guard page was hit' error in dr_rule
+
+From: Yevgeny Kliteynik <kliteyn@nvidia.com>
+
+[ Upstream commit 94a3ad6c081381fa9ee523781789802b4ed00faf ]
+
+This patch reduces the size of hw_ste_arr_optimized array that is
+allocated on stack from 640 bytes (5 match STEs + 5 action STES)
+to 448 bytes (2 match STEs + 5 action STES).
+This fixes the 'stack guard page was hit' issue, while still fitting
+majority of the usecases (up to 2 match STEs).
+
+Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
+Reviewed-by: Alex Vesker <valex@nvidia.com>
+Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
+Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
+Link: https://patch.msgid.link/20240730061638.1831002-4-tariqt@nvidia.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
+index 042ca03491243..d1db04baa1fa6 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
+@@ -7,7 +7,7 @@
+ /* don't try to optimize STE allocation if the stack is too constaraining */
+ #define DR_RULE_MAX_STES_OPTIMIZED 0
+ #else
+-#define DR_RULE_MAX_STES_OPTIMIZED 5
++#define DR_RULE_MAX_STES_OPTIMIZED 2
+ #endif
+ #define DR_RULE_MAX_STE_CHAIN_OPTIMIZED (DR_RULE_MAX_STES_OPTIMIZED + DR_ACTION_MAX_STES)
+
+--
+2.43.0
+
--- /dev/null
+From f3ecb1715d034843b8243264b3409066e27f6453 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 3 Aug 2024 15:46:51 +0800
+Subject: net: usb: qmi_wwan: add MeiG Smart SRM825L
+
+From: ZHANG Yuntian <yt@radxa.com>
+
+[ Upstream commit 1ca645a2f74a4290527ae27130c8611391b07dbf ]
+
+Add support for MeiG Smart SRM825L which is based on Qualcomm 315 chip.
+
+T: Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=5000 MxCh= 0
+D: Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs= 1
+P: Vendor=2dee ProdID=4d22 Rev= 4.14
+S: Manufacturer=MEIG
+S: Product=LTE-A Module
+S: SerialNumber=6f345e48
+C:* #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=896mA
+I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
+E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
+E: Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
+I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
+E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
+E: Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
+E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
+I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
+E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
+E: Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
+E: Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
+I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option
+E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
+E: Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
+E: Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
+I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
+E: Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
+E: Ad=88(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
+I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
+E: Ad=89(I) Atr=03(Int.) MxPS= 8 Ivl=32ms
+E: Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
+E: Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
+
+Signed-off-by: ZHANG Yuntian <yt@radxa.com>
+Link: https://patch.msgid.link/D1EB81385E405DFE+20240803074656.567061-1-yt@radxa.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/usb/qmi_wwan.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
+index cfda32047cffb..4823dbdf54656 100644
+--- a/drivers/net/usb/qmi_wwan.c
++++ b/drivers/net/usb/qmi_wwan.c
+@@ -1432,6 +1432,7 @@ static const struct usb_device_id products[] = {
+ {QMI_QUIRK_SET_DTR(0x1546, 0x1312, 4)}, /* u-blox LARA-R6 01B */
+ {QMI_QUIRK_SET_DTR(0x1546, 0x1342, 4)}, /* u-blox LARA-L6 */
+ {QMI_QUIRK_SET_DTR(0x33f8, 0x0104, 4)}, /* Rolling RW101 RMNET */
++ {QMI_FIXED_INTF(0x2dee, 0x4d22, 5)}, /* MeiG Smart SRM825L */
+
+ /* 4. Gobi 1000 devices */
+ {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
+--
+2.43.0
+
--- /dev/null
+From 6c8c2e9d4005906296752ddfbb031022cf61c068 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 23 Jul 2024 18:54:50 +0530
+Subject: platform/x86/amd/pmf: Add new ACPI ID AMDI0107
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
+
+[ Upstream commit 942810c0e89277d738b7f1b6f379d0a5877999f6 ]
+
+Add new ACPI ID AMDI0107 used by upcoming AMD platform to the PMF
+supported list of devices.
+
+Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
+Link: https://lore.kernel.org/r/20240723132451.3488326-1-Shyam-sundar.S-k@amd.com
+Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/platform/x86/amd/pmf/core.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/platform/x86/amd/pmf/core.c b/drivers/platform/x86/amd/pmf/core.c
+index 2d6e2558863c5..8f1f719befa3e 100644
+--- a/drivers/platform/x86/amd/pmf/core.c
++++ b/drivers/platform/x86/amd/pmf/core.c
+@@ -41,6 +41,7 @@
+ #define AMD_CPU_ID_RMB 0x14b5
+ #define AMD_CPU_ID_PS 0x14e8
+ #define PCI_DEVICE_ID_AMD_1AH_M20H_ROOT 0x1507
++#define PCI_DEVICE_ID_AMD_1AH_M60H_ROOT 0x1122
+
+ #define PMF_MSG_DELAY_MIN_US 50
+ #define RESPONSE_REGISTER_LOOP_MAX 20000
+@@ -249,6 +250,7 @@ static const struct pci_device_id pmf_pci_ids[] = {
+ { PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_RMB) },
+ { PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_PS) },
+ { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_1AH_M20H_ROOT) },
++ { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_1AH_M60H_ROOT) },
+ { }
+ };
+
+@@ -382,6 +384,7 @@ static const struct acpi_device_id amd_pmf_acpi_ids[] = {
+ {"AMDI0102", 0},
+ {"AMDI0103", 0},
+ {"AMDI0105", 0},
++ {"AMDI0107", 0},
+ { }
+ };
+ MODULE_DEVICE_TABLE(acpi, amd_pmf_acpi_ids);
+--
+2.43.0
+
--- /dev/null
+From af7143fbf5531e28c19e098765653cad06e5af36 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 29 Jul 2024 14:08:31 +1200
+Subject: platform/x86/amd: pmf: Add quirk for ROG Ally X
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Luke D. Jones <luke@ljones.dev>
+
+[ Upstream commit 4c83ee4bf32ea8e57ae2321906c067d69ad7c41b ]
+
+The ASUS ROG Ally X has the same issue as the G14 where it advertises
+SPS support but doesn't use it.
+
+Signed-off-by: Luke D. Jones <luke@ljones.dev>
+Link: https://lore.kernel.org/r/20240729020831.28117-1-luke@ljones.dev
+Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/platform/x86/amd/pmf/pmf-quirks.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/platform/x86/amd/pmf/pmf-quirks.c b/drivers/platform/x86/amd/pmf/pmf-quirks.c
+index 0b2eb0ae85feb..460444cda1b29 100644
+--- a/drivers/platform/x86/amd/pmf/pmf-quirks.c
++++ b/drivers/platform/x86/amd/pmf/pmf-quirks.c
+@@ -29,6 +29,14 @@ static const struct dmi_system_id fwbug_list[] = {
+ },
+ .driver_data = &quirk_no_sps_bug,
+ },
++ {
++ .ident = "ROG Ally X",
++ .matches = {
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
++ DMI_MATCH(DMI_PRODUCT_NAME, "RC72LA"),
++ },
++ .driver_data = &quirk_no_sps_bug,
++ },
+ {}
+ };
+
+@@ -48,4 +56,3 @@ void amd_pmf_quirks_init(struct amd_pmf_dev *dev)
+ dmi_id->ident);
+ }
+ }
+-
+--
+2.43.0
+
--- /dev/null
+From 86d52991acca1b306f99e8e0e85ada142a4a6ce6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 12 Jul 2024 17:45:06 +0800
+Subject: scsi: ufs: core: Bypass quick recovery if force reset is needed
+
+From: Peter Wang <peter.wang@mediatek.com>
+
+[ Upstream commit 022587d8aec3da1d1698ddae9fb8cfe35f3ad49c ]
+
+If force_reset is true, bypass quick recovery. This will shorten error
+recovery time.
+
+Signed-off-by: Peter Wang <peter.wang@mediatek.com>
+Link: https://lore.kernel.org/r/20240712094506.11284-1-peter.wang@mediatek.com
+Reviewed-by: Bean Huo <beanhuo@micron.com>
+Reviewed-by: Bart Van Assche <bvanassche@acm.org>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/ufs/core/ufshcd.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
+index aab8db54a3141..91bfdc17eedb3 100644
+--- a/drivers/ufs/core/ufshcd.c
++++ b/drivers/ufs/core/ufshcd.c
+@@ -6560,7 +6560,8 @@ static void ufshcd_err_handler(struct work_struct *work)
+ if (ufshcd_err_handling_should_stop(hba))
+ goto skip_err_handling;
+
+- if (hba->dev_quirks & UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS) {
++ if ((hba->dev_quirks & UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS) &&
++ !hba->force_reset) {
+ bool ret;
+
+ spin_unlock_irqrestore(hba->host->host_lock, flags);
+--
+2.43.0
+
--- /dev/null
+From 5c225333c19d16d4e41afb72dbd4398e6e7b8412 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 10 Jul 2024 08:25:20 +0900
+Subject: scsi: ufs: core: Check LSDBS cap when !mcq
+
+From: Kyoungrul Kim <k831.kim@samsung.com>
+
+[ Upstream commit 0c60eb0cc320fffbb8b10329d276af14f6f5e6bf ]
+
+If the user sets use_mcq_mode to 0, the host will try to activate the LSDB
+mode unconditionally even when the LSDBS of device HCI cap is 1. This makes
+commands time out and causes device probing to fail.
+
+To prevent that problem, check the LSDBS cap when MCQ is not supported.
+
+Signed-off-by: Kyoungrul Kim <k831.kim@samsung.com>
+Link: https://lore.kernel.org/r/20240709232520epcms2p8ebdb5c4fccc30a6221390566589bf122@epcms2p8
+Reviewed-by: Bart Van Assche <bvanassche@acm.org>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/ufs/core/ufshcd.c | 16 ++++++++++++++++
+ include/ufs/ufshcd.h | 1 +
+ include/ufs/ufshci.h | 1 +
+ 3 files changed, 18 insertions(+)
+
+diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
+index 5864d65448ce5..aab8db54a3141 100644
+--- a/drivers/ufs/core/ufshcd.c
++++ b/drivers/ufs/core/ufshcd.c
+@@ -2412,7 +2412,17 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba)
+ return err;
+ }
+
++ /*
++ * The UFSHCI 3.0 specification does not define MCQ_SUPPORT and
++ * LSDB_SUPPORT, but [31:29] as reserved bits with reset value 0s, which
++ * means we can simply read values regardless of version.
++ */
+ hba->mcq_sup = FIELD_GET(MASK_MCQ_SUPPORT, hba->capabilities);
++ /*
++ * 0h: legacy single doorbell support is available
++ * 1h: indicate that legacy single doorbell support has been removed
++ */
++ hba->lsdb_sup = !FIELD_GET(MASK_LSDB_SUPPORT, hba->capabilities);
+ if (!hba->mcq_sup)
+ return 0;
+
+@@ -10456,6 +10466,12 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
+ }
+
+ if (!is_mcq_supported(hba)) {
++ if (!hba->lsdb_sup) {
++ dev_err(hba->dev, "%s: failed to initialize (legacy doorbell mode not supported)\n",
++ __func__);
++ err = -EINVAL;
++ goto out_disable;
++ }
+ err = scsi_add_host(host, hba->dev);
+ if (err) {
+ dev_err(hba->dev, "scsi_add_host failed\n");
+diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
+index d965e4d1277e6..52f0094a8c083 100644
+--- a/include/ufs/ufshcd.h
++++ b/include/ufs/ufshcd.h
+@@ -1074,6 +1074,7 @@ struct ufs_hba {
+ bool ext_iid_sup;
+ bool scsi_host_added;
+ bool mcq_sup;
++ bool lsdb_sup;
+ bool mcq_enabled;
+ struct ufshcd_res_info res[RES_MAX];
+ void __iomem *mcq_base;
+diff --git a/include/ufs/ufshci.h b/include/ufs/ufshci.h
+index 385e1c6b8d604..22ba85e81d8c9 100644
+--- a/include/ufs/ufshci.h
++++ b/include/ufs/ufshci.h
+@@ -75,6 +75,7 @@ enum {
+ MASK_OUT_OF_ORDER_DATA_DELIVERY_SUPPORT = 0x02000000,
+ MASK_UIC_DME_TEST_MODE_SUPPORT = 0x04000000,
+ MASK_CRYPTO_SUPPORT = 0x10000000,
++ MASK_LSDB_SUPPORT = 0x20000000,
+ MASK_MCQ_SUPPORT = 0x40000000,
+ };
+
+--
+2.43.0
+
--- /dev/null
+From 3ba0ee8abaaec4424ceb705bbefa1792c03af64d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 27 Jul 2024 11:04:01 +0200
+Subject: selftests: mptcp: add explicit test case for remove/readd
+
+From: Paolo Abeni <pabeni@redhat.com>
+
+[ Upstream commit b5e2fb832f48bc01d937a053e0550a1465a2f05d ]
+
+Delete and re-create a signal endpoint and ensure that the PM
+actually deletes and re-create the subflow.
+
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Stable-dep-of: 1c2326fcae4f ("selftests: mptcp: join: check re-adding init endp with != id")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../testing/selftests/net/mptcp/mptcp_join.sh | 29 +++++++++++++++++++
+ 1 file changed, 29 insertions(+)
+
+diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
+index c0ba79a8ad6da..fb2d8326109ef 100755
+--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
+@@ -3626,6 +3626,35 @@ endpoint_tests()
+ chk_join_nr 6 6 6
+ chk_rm_nr 4 4
+ fi
++
++ # remove and re-add
++ if reset "delete re-add signal" &&
++ mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then
++ pm_nl_set_limits $ns1 1 1
++ pm_nl_set_limits $ns2 1 1
++ pm_nl_add_endpoint $ns1 10.0.2.1 id 1 flags signal
++ test_linkfail=4 speed=20 \
++ run_tests $ns1 $ns2 10.0.1.1 &
++ local tests_pid=$!
++
++ wait_mpj $ns2
++ pm_nl_check_endpoint "creation" \
++ $ns1 10.0.2.1 id 1 flags signal
++ chk_subflow_nr "before delete" 2
++ chk_mptcp_info subflows 1 subflows 1
++
++ pm_nl_del_endpoint $ns1 1 10.0.2.1
++ sleep 0.5
++ chk_subflow_nr "after delete" 1
++ chk_mptcp_info subflows 0 subflows 0
++
++ pm_nl_add_endpoint $ns1 10.0.2.1 flags signal
++ wait_mpj $ns2
++ chk_subflow_nr "after re-add" 2
++ chk_mptcp_info subflows 1 subflows 1
++ mptcp_lib_kill_wait $tests_pid
++ fi
++
+ }
+
+ # [$1: error message]
+--
+2.43.0
+
--- /dev/null
+From 980b1d003a78fc467f795e4de6f8f1aef0187b36 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 28 Aug 2024 08:14:30 +0200
+Subject: selftests: mptcp: join: check re-adding init endp with != id
+
+From: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+
+[ Upstream commit 1c2326fcae4f0c5de8ad0d734ced43a8e5f17dac ]
+
+The initial subflow has a special local ID: 0. It is specific per
+connection.
+
+When a global endpoint is deleted and re-added later, it can have a
+different ID, but the kernel should still use the ID 0 if it corresponds
+to the initial address.
+
+This test validates this behaviour: the endpoint linked to the initial
+subflow is removed, and re-added with a different ID.
+
+Note that removing the initial subflow will not decrement the 'subflows'
+counters, which corresponds to the *additional* subflows. On the other
+hand, when the same endpoint is re-added, it will increment this
+counter, as it will be seen as an additional subflow this time.
+
+The 'Fixes' tag here below is the same as the one from the previous
+commit: this patch here is not fixing anything wrong in the selftests,
+but it validates the previous fix for an issue introduced by this commit
+ID.
+
+Fixes: 3ad14f54bd74 ("mptcp: more accurate MPC endpoint tracking")
+Cc: stable@vger.kernel.org
+Reviewed-by: Mat Martineau <martineau@kernel.org>
+Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../testing/selftests/net/mptcp/mptcp_join.sh | 21 ++++++++++++++-----
+ 1 file changed, 16 insertions(+), 5 deletions(-)
+
+diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
+index a4d8475ff45fe..5059eae91b5c6 100755
+--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
+@@ -3630,11 +3630,12 @@ endpoint_tests()
+ # remove and re-add
+ if reset "delete re-add signal" &&
+ mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then
+- pm_nl_set_limits $ns1 0 2
+- pm_nl_set_limits $ns2 2 2
++ pm_nl_set_limits $ns1 0 3
++ pm_nl_set_limits $ns2 3 3
+ pm_nl_add_endpoint $ns1 10.0.2.1 id 1 flags signal
+ # broadcast IP: no packet for this address will be received on ns1
+ pm_nl_add_endpoint $ns1 224.0.0.1 id 2 flags signal
++ pm_nl_add_endpoint $ns1 10.0.1.1 id 42 flags signal
+ test_linkfail=4 speed=20 \
+ run_tests $ns1 $ns2 10.0.1.1 &
+ local tests_pid=$!
+@@ -3656,11 +3657,21 @@ endpoint_tests()
+ wait_mpj $ns2
+ chk_subflow_nr "after re-add" 3
+ chk_mptcp_info subflows 2 subflows 2
++
++ pm_nl_del_endpoint $ns1 42 10.0.1.1
++ sleep 0.5
++ chk_subflow_nr "after delete ID 0" 2
++ chk_mptcp_info subflows 2 subflows 2
++
++ pm_nl_add_endpoint $ns1 10.0.1.1 id 99 flags signal
++ wait_mpj $ns2
++ chk_subflow_nr "after re-add" 3
++ chk_mptcp_info subflows 3 subflows 3
+ mptcp_lib_kill_wait $tests_pid
+
+- chk_join_nr 3 3 3
+- chk_add_nr 4 4
+- chk_rm_nr 2 1 invert
++ chk_join_nr 4 4 4
++ chk_add_nr 5 5
++ chk_rm_nr 3 2 invert
+ fi
+
+ }
+--
+2.43.0
+
--- /dev/null
+From 5b2bc7b0df833f051650cf325a92a00cce68f677 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 28 Aug 2024 08:14:38 +0200
+Subject: selftests: mptcp: join: check re-re-adding ID 0 signal
+
+From: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+
+[ Upstream commit f18fa2abf81099d822d842a107f8c9889c86043c ]
+
+This test extends "delete re-add signal" to validate the previous
+commit: when the 'signal' endpoint linked to the initial subflow (ID 0)
+is re-added multiple times, it will re-send the ADD_ADDR with id 0. The
+client should still be able to re-create this subflow, even if the
+add_addr_accepted limit has been reached as this special address is not
+considered as a new address.
+
+The 'Fixes' tag here below is the same as the one from the previous
+commit: this patch here is not fixing anything wrong in the selftests,
+but it validates the previous fix for an issue introduced by this commit
+ID.
+
+Fixes: d0876b2284cf ("mptcp: add the incoming RM_ADDR support")
+Cc: stable@vger.kernel.org
+Reviewed-by: Mat Martineau <martineau@kernel.org>
+Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../testing/selftests/net/mptcp/mptcp_join.sh | 32 ++++++++++++-------
+ 1 file changed, 21 insertions(+), 11 deletions(-)
+
+diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
+index 73f9db065788e..3b65c462d6ddc 100755
+--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
+@@ -3688,7 +3688,7 @@ endpoint_tests()
+ # broadcast IP: no packet for this address will be received on ns1
+ pm_nl_add_endpoint $ns1 224.0.0.1 id 2 flags signal
+ pm_nl_add_endpoint $ns1 10.0.1.1 id 42 flags signal
+- test_linkfail=4 speed=20 \
++ test_linkfail=4 speed=5 \
+ run_tests $ns1 $ns2 10.0.1.1 &
+ local tests_pid=$!
+
+@@ -3717,7 +3717,17 @@ endpoint_tests()
+
+ pm_nl_add_endpoint $ns1 10.0.1.1 id 99 flags signal
+ wait_mpj $ns2
+- chk_subflow_nr "after re-add" 3
++ chk_subflow_nr "after re-add ID 0" 3
++ chk_mptcp_info subflows 3 subflows 3
++
++ pm_nl_del_endpoint $ns1 99 10.0.1.1
++ sleep 0.5
++ chk_subflow_nr "after re-delete ID 0" 2
++ chk_mptcp_info subflows 2 subflows 2
++
++ pm_nl_add_endpoint $ns1 10.0.1.1 id 88 flags signal
++ wait_mpj $ns2
++ chk_subflow_nr "after re-re-add ID 0" 3
+ chk_mptcp_info subflows 3 subflows 3
+ mptcp_lib_kill_wait $tests_pid
+
+@@ -3727,19 +3737,19 @@ endpoint_tests()
+ chk_evt_nr ns1 MPTCP_LIB_EVENT_ESTABLISHED 1
+ chk_evt_nr ns1 MPTCP_LIB_EVENT_ANNOUNCED 0
+ chk_evt_nr ns1 MPTCP_LIB_EVENT_REMOVED 0
+- chk_evt_nr ns1 MPTCP_LIB_EVENT_SUB_ESTABLISHED 4
+- chk_evt_nr ns1 MPTCP_LIB_EVENT_SUB_CLOSED 2
++ chk_evt_nr ns1 MPTCP_LIB_EVENT_SUB_ESTABLISHED 5
++ chk_evt_nr ns1 MPTCP_LIB_EVENT_SUB_CLOSED 3
+
+ chk_evt_nr ns2 MPTCP_LIB_EVENT_CREATED 1
+ chk_evt_nr ns2 MPTCP_LIB_EVENT_ESTABLISHED 1
+- chk_evt_nr ns2 MPTCP_LIB_EVENT_ANNOUNCED 5
+- chk_evt_nr ns2 MPTCP_LIB_EVENT_REMOVED 3
+- chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 4
+- chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_CLOSED 2
++ chk_evt_nr ns2 MPTCP_LIB_EVENT_ANNOUNCED 6
++ chk_evt_nr ns2 MPTCP_LIB_EVENT_REMOVED 4
++ chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 5
++ chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_CLOSED 3
+
+- chk_join_nr 4 4 4
+- chk_add_nr 5 5
+- chk_rm_nr 3 2 invert
++ chk_join_nr 5 5 5
++ chk_add_nr 6 6
++ chk_rm_nr 4 3 invert
+ fi
+
+ }
+--
+2.43.0
+
--- /dev/null
+From 937a9ae672bad1d05757e1ff2e6d11f317321976 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 19 Aug 2024 21:45:20 +0200
+Subject: selftests: mptcp: join: check re-using ID of unused ADD_ADDR
+
+From: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+
+[ Upstream commit a13d5aad4dd9a309eecdc33cfd75045bd5f376a3 ]
+
+This test extends "delete re-add signal" to validate the previous
+commit. An extra address is announced by the server, but this address
+cannot be used by the client. The result is that no subflow will be
+established to this address.
+
+Later, the server will delete this extra endpoint, and set a new one,
+with a valid address, but re-using the same ID. Before the previous
+commit, the server would not have been able to announce this new
+address.
+
+While at it, extra checks have been added to validate the expected
+numbers of MPJ, ADD_ADDR and RM_ADDR.
+
+The 'Fixes' tag here below is the same as the one from the previous
+commit: this patch here is not fixing anything wrong in the selftests,
+but it validates the previous fix for an issue introduced by this commit
+ID.
+
+Fixes: b6c08380860b ("mptcp: remove addr and subflow in PM netlink")
+Cc: stable@vger.kernel.org
+Reviewed-by: Mat Martineau <martineau@kernel.org>
+Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+Link: https://patch.msgid.link/20240819-net-mptcp-pm-reusing-id-v1-2-38035d40de5b@kernel.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Stable-dep-of: 1c2326fcae4f ("selftests: mptcp: join: check re-adding init endp with != id")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../testing/selftests/net/mptcp/mptcp_join.sh | 18 +++++++++++++-----
+ 1 file changed, 13 insertions(+), 5 deletions(-)
+
+diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
+index fb2d8326109ef..a4d8475ff45fe 100755
+--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
+@@ -3630,9 +3630,11 @@ endpoint_tests()
+ # remove and re-add
+ if reset "delete re-add signal" &&
+ mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then
+- pm_nl_set_limits $ns1 1 1
+- pm_nl_set_limits $ns2 1 1
++ pm_nl_set_limits $ns1 0 2
++ pm_nl_set_limits $ns2 2 2
+ pm_nl_add_endpoint $ns1 10.0.2.1 id 1 flags signal
++ # broadcast IP: no packet for this address will be received on ns1
++ pm_nl_add_endpoint $ns1 224.0.0.1 id 2 flags signal
+ test_linkfail=4 speed=20 \
+ run_tests $ns1 $ns2 10.0.1.1 &
+ local tests_pid=$!
+@@ -3644,15 +3646,21 @@ endpoint_tests()
+ chk_mptcp_info subflows 1 subflows 1
+
+ pm_nl_del_endpoint $ns1 1 10.0.2.1
++ pm_nl_del_endpoint $ns1 2 224.0.0.1
+ sleep 0.5
+ chk_subflow_nr "after delete" 1
+ chk_mptcp_info subflows 0 subflows 0
+
+- pm_nl_add_endpoint $ns1 10.0.2.1 flags signal
++ pm_nl_add_endpoint $ns1 10.0.2.1 id 1 flags signal
++ pm_nl_add_endpoint $ns1 10.0.3.1 id 2 flags signal
+ wait_mpj $ns2
+- chk_subflow_nr "after re-add" 2
+- chk_mptcp_info subflows 1 subflows 1
++ chk_subflow_nr "after re-add" 3
++ chk_mptcp_info subflows 2 subflows 2
+ mptcp_lib_kill_wait $tests_pid
++
++ chk_join_nr 3 3 3
++ chk_add_nr 4 4
++ chk_rm_nr 2 1 invert
+ fi
+
+ }
+--
+2.43.0
+
--- /dev/null
+From f322867e72acadeb1044fcb7c980ee345261fd7b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 28 Aug 2024 08:14:36 +0200
+Subject: selftests: mptcp: join: validate event numbers
+
+From: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+
+[ Upstream commit 20ccc7c5f7a3aa48092441a4b182f9f40418392e ]
+
+This test extends "delete and re-add" and "delete re-add signal" to
+validate the previous commit: the number of MPTCP events are checked to
+make sure there are no duplicated or unexpected ones.
+
+A new helper has been introduced to easily check these events. The
+missing events have been added to the lib.
+
+The 'Fixes' tag here below is the same as the one from the previous
+commit: this patch here is not fixing anything wrong in the selftests,
+but it validates the previous fix for an issue introduced by this commit
+ID.
+
+Fixes: b911c97c7dc7 ("mptcp: add netlink event support")
+Cc: stable@vger.kernel.org
+Reviewed-by: Mat Martineau <martineau@kernel.org>
+Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../testing/selftests/net/mptcp/mptcp_join.sh | 74 ++++++++++++++++++-
+ .../testing/selftests/net/mptcp/mptcp_lib.sh | 4 +
+ 2 files changed, 75 insertions(+), 3 deletions(-)
+
+diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
+index 5059eae91b5c6..73f9db065788e 100755
+--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
+@@ -420,12 +420,17 @@ reset_with_fail()
+ fi
+ }
+
++start_events()
++{
++ mptcp_lib_events "${ns1}" "${evts_ns1}" evts_ns1_pid
++ mptcp_lib_events "${ns2}" "${evts_ns2}" evts_ns2_pid
++}
++
+ reset_with_events()
+ {
+ reset "${1}" || return 1
+
+- mptcp_lib_events "${ns1}" "${evts_ns1}" evts_ns1_pid
+- mptcp_lib_events "${ns2}" "${evts_ns2}" evts_ns2_pid
++ start_events
+ }
+
+ reset_with_tcp_filter()
+@@ -3333,6 +3338,36 @@ userspace_pm_chk_get_addr()
+ fi
+ }
+
++# $1: ns ; $2: event type ; $3: count
++chk_evt_nr()
++{
++ local ns=${1}
++ local evt_name="${2}"
++ local exp="${3}"
++
++ local evts="${evts_ns1}"
++ local evt="${!evt_name}"
++ local count
++
++ evt_name="${evt_name:16}" # without MPTCP_LIB_EVENT_
++ [ "${ns}" == "ns2" ] && evts="${evts_ns2}"
++
++ print_check "event ${ns} ${evt_name} (${exp})"
++
++ if [[ "${evt_name}" = "LISTENER_"* ]] &&
++ ! mptcp_lib_kallsyms_has "mptcp_event_pm_listener$"; then
++ print_skip "event not supported"
++ return
++ fi
++
++ count=$(grep -cw "type:${evt}" "${evts}")
++ if [ "${count}" != "${exp}" ]; then
++ fail_test "got ${count} events, expected ${exp}"
++ else
++ print_ok
++ fi
++}
++
+ userspace_tests()
+ {
+ # userspace pm type prevents add_addr
+@@ -3572,6 +3607,7 @@ endpoint_tests()
+
+ if reset_with_tcp_filter "delete and re-add" ns2 10.0.3.2 REJECT OUTPUT &&
+ mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then
++ start_events
+ pm_nl_set_limits $ns1 0 3
+ pm_nl_set_limits $ns2 0 3
+ pm_nl_add_endpoint $ns2 10.0.1.2 id 1 dev ns2eth1 flags subflow
+@@ -3623,12 +3659,28 @@ endpoint_tests()
+
+ mptcp_lib_kill_wait $tests_pid
+
++ kill_events_pids
++ chk_evt_nr ns1 MPTCP_LIB_EVENT_LISTENER_CREATED 1
++ chk_evt_nr ns1 MPTCP_LIB_EVENT_CREATED 1
++ chk_evt_nr ns1 MPTCP_LIB_EVENT_ESTABLISHED 1
++ chk_evt_nr ns1 MPTCP_LIB_EVENT_ANNOUNCED 0
++ chk_evt_nr ns1 MPTCP_LIB_EVENT_REMOVED 4
++ chk_evt_nr ns1 MPTCP_LIB_EVENT_SUB_ESTABLISHED 6
++ chk_evt_nr ns1 MPTCP_LIB_EVENT_SUB_CLOSED 4
++
++ chk_evt_nr ns2 MPTCP_LIB_EVENT_CREATED 1
++ chk_evt_nr ns2 MPTCP_LIB_EVENT_ESTABLISHED 1
++ chk_evt_nr ns2 MPTCP_LIB_EVENT_ANNOUNCED 0
++ chk_evt_nr ns2 MPTCP_LIB_EVENT_REMOVED 0
++ chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 6
++ chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_CLOSED 5 # one has been closed before estab
++
+ chk_join_nr 6 6 6
+ chk_rm_nr 4 4
+ fi
+
+ # remove and re-add
+- if reset "delete re-add signal" &&
++ if reset_with_events "delete re-add signal" &&
+ mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then
+ pm_nl_set_limits $ns1 0 3
+ pm_nl_set_limits $ns2 3 3
+@@ -3669,6 +3721,22 @@ endpoint_tests()
+ chk_mptcp_info subflows 3 subflows 3
+ mptcp_lib_kill_wait $tests_pid
+
++ kill_events_pids
++ chk_evt_nr ns1 MPTCP_LIB_EVENT_LISTENER_CREATED 1
++ chk_evt_nr ns1 MPTCP_LIB_EVENT_CREATED 1
++ chk_evt_nr ns1 MPTCP_LIB_EVENT_ESTABLISHED 1
++ chk_evt_nr ns1 MPTCP_LIB_EVENT_ANNOUNCED 0
++ chk_evt_nr ns1 MPTCP_LIB_EVENT_REMOVED 0
++ chk_evt_nr ns1 MPTCP_LIB_EVENT_SUB_ESTABLISHED 4
++ chk_evt_nr ns1 MPTCP_LIB_EVENT_SUB_CLOSED 2
++
++ chk_evt_nr ns2 MPTCP_LIB_EVENT_CREATED 1
++ chk_evt_nr ns2 MPTCP_LIB_EVENT_ESTABLISHED 1
++ chk_evt_nr ns2 MPTCP_LIB_EVENT_ANNOUNCED 5
++ chk_evt_nr ns2 MPTCP_LIB_EVENT_REMOVED 3
++ chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 4
++ chk_evt_nr ns2 MPTCP_LIB_EVENT_SUB_CLOSED 2
++
+ chk_join_nr 4 4 4
+ chk_add_nr 5 5
+ chk_rm_nr 3 2 invert
+diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
+index 6ffa9b7a3260d..e299090eb0426 100644
+--- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh
++++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
+@@ -9,10 +9,14 @@ readonly KSFT_SKIP=4
+ readonly KSFT_TEST="${MPTCP_LIB_KSFT_TEST:-$(basename "${0}" .sh)}"
+
+ # These variables are used in some selftests, read-only
++declare -rx MPTCP_LIB_EVENT_CREATED=1 # MPTCP_EVENT_CREATED
++declare -rx MPTCP_LIB_EVENT_ESTABLISHED=2 # MPTCP_EVENT_ESTABLISHED
++declare -rx MPTCP_LIB_EVENT_CLOSED=3 # MPTCP_EVENT_CLOSED
+ declare -rx MPTCP_LIB_EVENT_ANNOUNCED=6 # MPTCP_EVENT_ANNOUNCED
+ declare -rx MPTCP_LIB_EVENT_REMOVED=7 # MPTCP_EVENT_REMOVED
+ declare -rx MPTCP_LIB_EVENT_SUB_ESTABLISHED=10 # MPTCP_EVENT_SUB_ESTABLISHED
+ declare -rx MPTCP_LIB_EVENT_SUB_CLOSED=11 # MPTCP_EVENT_SUB_CLOSED
++declare -rx MPTCP_LIB_EVENT_SUB_PRIORITY=13 # MPTCP_EVENT_SUB_PRIORITY
+ declare -rx MPTCP_LIB_EVENT_LISTENER_CREATED=15 # MPTCP_EVENT_LISTENER_CREATED
+ declare -rx MPTCP_LIB_EVENT_LISTENER_CLOSED=16 # MPTCP_EVENT_LISTENER_CLOSED
+
+--
+2.43.0
+
--- /dev/null
+drm-fb-helper-don-t-schedule_work-to-flush-frame-buf.patch
+drm-panel-orientation-quirks-add-quirk-for-orangepi-.patch
+scsi-ufs-core-check-lsdbs-cap-when-mcq.patch
+scsi-ufs-core-bypass-quick-recovery-if-force-reset-i.patch
+btrfs-tree-checker-validate-dref-root-and-objectid.patch
+alsa-hda-generic-add-a-helper-to-mute-speakers-at-su.patch
+alsa-hda-conexant-mute-speakers-at-suspend-shutdown.patch
+x86-cpu-amd-add-models-0x60-0x6f-to-the-zen5-range.patch
+alsa-ump-transmit-rpn-nrpn-message-at-each-msb-lsb-d.patch
+alsa-ump-explicitly-reset-rpn-with-null-rpn.patch
+alsa-seq-ump-use-the-common-rpn-bank-conversion-cont.patch
+alsa-seq-ump-transmit-rpn-nrpn-message-at-each-msb-l.patch
+alsa-seq-ump-explicitly-reset-rpn-with-null-rpn.patch
+net-mlx5-dr-fix-stack-guard-page-was-hit-error-in-dr.patch
+smb-client-fix-fsctl_get_reparse_point-against-netap.patch
+asoc-amd-yc-support-mic-on-hp-14-em0002la.patch
+spi-hisi-kunpeng-add-validation-for-the-minimum-valu.patch
+platform-x86-amd-pmf-add-quirk-for-rog-ally-x.patch
+platform-x86-amd-pmf-add-new-acpi-id-amdi0107.patch
+btrfs-factor-out-stripe-length-calculation-into-a-he.patch
+btrfs-scrub-update-last_physical-after-scrubbing-one.patch
+btrfs-fix-qgroup-reserve-leaks-in-cow_file_range.patch
+i2c-fix-conditional-for-substituting-empty-acpi-func.patch
+virtio-net-check-feature-before-configuring-the-vq-c.patch
+dma-debug-avoid-deadlock-between-dma-debug-vs-printk.patch
+net-usb-qmi_wwan-add-meig-smart-srm825l.patch
+asoc-amd-yc-support-mic-on-lenovo-thinkpad-e14-gen-6.patch
+asoc-codecs-es8326-button-detect-issue.patch
+arm64-dts-qcom-x1e80100-describe-the-pcie-6a-resourc.patch
+arm64-dts-qcom-x1e80100-crd-fix-up-pcie6a-pinctrl-no.patch
+arm64-dts-qcom-x1e80100-crd-fix-missing-pcie4-gpios.patch
+arm64-dts-qcom-x1e80100-qcp-fix-up-pcie6a-pinctrl-no.patch
+arm64-dts-qcom-x1e80100-qcp-fix-missing-pcie4-gpios.patch
+selftests-mptcp-add-explicit-test-case-for-remove-re.patch
+selftests-mptcp-join-check-re-using-id-of-unused-add.patch
+selftests-mptcp-join-check-re-adding-init-endp-with-.patch
+selftests-mptcp-join-validate-event-numbers.patch
+selftests-mptcp-join-check-re-re-adding-id-0-signal.patch
--- /dev/null
+From 64ce50340eed295968508eb4ddba19a19c79333a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 1 Aug 2024 18:12:39 -0300
+Subject: smb: client: fix FSCTL_GET_REPARSE_POINT against NetApp
+
+From: Paulo Alcantara <pc@manguebit.com>
+
+[ Upstream commit ddecea00f87f0c46e9c8339a7c89fb2ff891521a ]
+
+NetApp server requires the file to be open with FILE_READ_EA access in
+order to support FSCTL_GET_REPARSE_POINT, otherwise it will return
+STATUS_INVALID_DEVICE_REQUEST. It doesn't make any sense because
+there's no requirement for FILE_READ_EA bit to be set nor
+STATUS_INVALID_DEVICE_REQUEST being used for something other than
+"unsupported reparse points" in MS-FSA.
+
+To fix it and improve compatibility, set FILE_READ_EA & SYNCHRONIZE
+bits to match what Windows client currently does.
+
+Tested-by: Sebastian Steinbeisser <Sebastian.Steinbeisser@lrz.de>
+Acked-by: Tom Talpey <tom@talpey.com>
+Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/smb/client/smb2inode.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c
+index 062b86a4936fd..9f5bc41433c15 100644
+--- a/fs/smb/client/smb2inode.c
++++ b/fs/smb/client/smb2inode.c
+@@ -950,7 +950,8 @@ int smb2_query_path_info(const unsigned int xid,
+ cmds[num_cmds++] = SMB2_OP_GET_REPARSE;
+
+ oparms = CIFS_OPARMS(cifs_sb, tcon, full_path,
+- FILE_READ_ATTRIBUTES | FILE_READ_EA,
++ FILE_READ_ATTRIBUTES |
++ FILE_READ_EA | SYNCHRONIZE,
+ FILE_OPEN, create_options |
+ OPEN_REPARSE_POINT, ACL_NO_MODE);
+ cifs_get_readable_path(tcon, full_path, &cfile);
+@@ -1258,7 +1259,8 @@ int smb2_query_reparse_point(const unsigned int xid,
+ cifs_dbg(FYI, "%s: path: %s\n", __func__, full_path);
+
+ cifs_get_readable_path(tcon, full_path, &cfile);
+- oparms = CIFS_OPARMS(cifs_sb, tcon, full_path, FILE_READ_ATTRIBUTES,
++ oparms = CIFS_OPARMS(cifs_sb, tcon, full_path,
++ FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE,
+ FILE_OPEN, OPEN_REPARSE_POINT, ACL_NO_MODE);
+ rc = smb2_compound_op(xid, tcon, cifs_sb,
+ full_path, &oparms, &in_iov,
+--
+2.43.0
+
--- /dev/null
+From 10cc6b43d951c6b547fa7369e160308e597454ec Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 30 Jul 2024 11:20:39 +0800
+Subject: spi: hisi-kunpeng: Add validation for the minimum value of speed_hz
+
+From: Devyn Liu <liudingyuan@huawei.com>
+
+[ Upstream commit c3c4f22b7c814a6ee485ce294065836f8ede30fa ]
+
+The speed specified by the user is used to calculate the clk_div based
+on the max_speed_hz in hisi_calc_effective_speed. A very low speed
+value can lead to a clk_div larger than the variable range. Avoid this
+by setting the min_speed_hz so that such a small speed value is
+rejected. __spi_validate() in spi.c will return -EINVAL for the
+specified speed_hz lower than min_speed_hz.
+
+Signed-off-by: Devyn Liu <liudingyuan@huawei.com>
+Reviewed-by: Jay Fang <f.fangjian@huawei.com>
+Link: https://patch.msgid.link/20240730032040.3156393-2-liudingyuan@huawei.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-hisi-kunpeng.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/spi/spi-hisi-kunpeng.c b/drivers/spi/spi-hisi-kunpeng.c
+index 77e9738e42f60..6910b4d4c427b 100644
+--- a/drivers/spi/spi-hisi-kunpeng.c
++++ b/drivers/spi/spi-hisi-kunpeng.c
+@@ -495,6 +495,7 @@ static int hisi_spi_probe(struct platform_device *pdev)
+ host->transfer_one = hisi_spi_transfer_one;
+ host->handle_err = hisi_spi_handle_err;
+ host->dev.fwnode = dev->fwnode;
++ host->min_speed_hz = DIV_ROUND_UP(host->max_speed_hz, CLK_DIV_MAX);
+
+ hisi_spi_hw_init(hs);
+
+--
+2.43.0
+
--- /dev/null
+From fcebf3a10291e21b75c3cd539acb699d9c97e41c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 1 Aug 2024 21:23:37 +0800
+Subject: virtio-net: check feature before configuring the vq coalescing
+ command
+
+From: Heng Qi <hengqi@linux.alibaba.com>
+
+[ Upstream commit b50f2af9fbc5c00103ca8b72752b15310bd77762 ]
+
+Virtio spec says:
+
+ The driver MUST have negotiated the VIRTIO_NET_F_VQ_NOTF_COAL
+ feature when issuing commands VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET
+ and VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET.
+
+So we add the feature negotiation check to
+virtnet_send_{r,t}x_ctrl_coal_vq_cmd as a basis for the next bugfix patch.
+
+Suggested-by: Michael S. Tsirkin <mst@redhat.com>
+Signed-off-by: Heng Qi <hengqi@linux.alibaba.com>
+Acked-by: Jason Wang <jasowang@redhat.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/virtio_net.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
+index f32e017b62e9b..21bd0c127b05a 100644
+--- a/drivers/net/virtio_net.c
++++ b/drivers/net/virtio_net.c
+@@ -3172,6 +3172,9 @@ static int virtnet_send_rx_ctrl_coal_vq_cmd(struct virtnet_info *vi,
+ {
+ int err;
+
++ if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_VQ_NOTF_COAL))
++ return -EOPNOTSUPP;
++
+ err = virtnet_send_ctrl_coal_vq_cmd(vi, rxq2vq(queue),
+ max_usecs, max_packets);
+ if (err)
+@@ -3189,6 +3192,9 @@ static int virtnet_send_tx_ctrl_coal_vq_cmd(struct virtnet_info *vi,
+ {
+ int err;
+
++ if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_VQ_NOTF_COAL))
++ return -EOPNOTSUPP;
++
+ err = virtnet_send_ctrl_coal_vq_cmd(vi, txq2vq(queue),
+ max_usecs, max_packets);
+ if (err)
+--
+2.43.0
+
--- /dev/null
+From 4708b0a4d145a08fe00a5a81ff6c12d82bbe5674 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 29 Jul 2024 08:46:26 +0200
+Subject: x86/CPU/AMD: Add models 0x60-0x6f to the Zen5 range
+
+From: Perry Yuan <perry.yuan@amd.com>
+
+[ Upstream commit bf5641eccf71bcd13a849930e190563c3a19815d ]
+
+Add some new Zen5 models for the 0x1A family.
+
+ [ bp: Merge the 0x60 and 0x70 ranges. ]
+
+Signed-off-by: Perry Yuan <perry.yuan@amd.com>
+Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
+Link: https://lore.kernel.org/r/20240729064626.24297-1-bp@kernel.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/kernel/cpu/amd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
+index 44df3f11e7319..7b4940530b462 100644
+--- a/arch/x86/kernel/cpu/amd.c
++++ b/arch/x86/kernel/cpu/amd.c
+@@ -462,7 +462,7 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)
+ switch (c->x86_model) {
+ case 0x00 ... 0x2f:
+ case 0x40 ... 0x4f:
+- case 0x70 ... 0x7f:
++ case 0x60 ... 0x7f:
+ setup_force_cpu_cap(X86_FEATURE_ZEN5);
+ break;
+ default:
+--
+2.43.0
+