--- /dev/null
+From 6a32425f953b955b4ff82f339d01df0b713caa5d Mon Sep 17 00:00:00 2001
+From: Artemii Karasev <karasev@ispras.ru>
+Date: Tue, 7 Feb 2023 18:20:26 +0500
+Subject: ALSA: emux: Avoid potential array out-of-bound in snd_emux_xg_control()
+
+From: Artemii Karasev <karasev@ispras.ru>
+
+commit 6a32425f953b955b4ff82f339d01df0b713caa5d upstream.
+
+snd_emux_xg_control() can be called with an argument 'param' greater
+than size of 'control' array. It may lead to accessing 'control'
+array at a wrong index.
+
+Found by Linux Verification Center (linuxtesting.org) with SVACE.
+
+Signed-off-by: Artemii Karasev <karasev@ispras.ru>
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20230207132026.2870-1-karasev@ispras.ru
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/synth/emux/emux_nrpn.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/sound/synth/emux/emux_nrpn.c
++++ b/sound/synth/emux/emux_nrpn.c
+@@ -349,6 +349,9 @@ int
+ snd_emux_xg_control(struct snd_emux_port *port, struct snd_midi_channel *chan,
+ int param)
+ {
++ if (param >= ARRAY_SIZE(chan->control))
++ return -EINVAL;
++
+ return send_converted_effect(xg_effects, ARRAY_SIZE(xg_effects),
+ port, chan, param,
+ chan->control[param],
--- /dev/null
+From 88d18b8896bd98e636b632f805b7e84e61458255 Mon Sep 17 00:00:00 2001
+From: Edson Juliano Drosdeck <edson.drosdeck@gmail.com>
+Date: Tue, 7 Feb 2023 15:37:20 -0300
+Subject: ALSA: hda/realtek: Add Positivo N14KP6-TG
+
+From: Edson Juliano Drosdeck <edson.drosdeck@gmail.com>
+
+commit 88d18b8896bd98e636b632f805b7e84e61458255 upstream.
+
+Positivo N14KP6-TG (1c6c:1251)
+require quirk for enabling headset-mic
+
+Signed-off-by: Edson Juliano Drosdeck <edson.drosdeck@gmail.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20230207183720.2519-1-edson.drosdeck@gmail.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/pci/hda/patch_realtek.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -9701,6 +9701,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
+ SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
+ SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
++ SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
+ SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
+ SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
--- /dev/null
+From 7a17e8423a133a6ac238462126d7f88faaccc681 Mon Sep 17 00:00:00 2001
+From: Stefan Binding <sbinding@opensource.cirrus.com>
+Date: Mon, 6 Feb 2023 15:00:19 +0000
+Subject: ALSA: hda/realtek: Add quirk for ASUS UM3402 using CS35L41
+
+From: Stefan Binding <sbinding@opensource.cirrus.com>
+
+commit 7a17e8423a133a6ac238462126d7f88faaccc681 upstream.
+
+This Asus Zenbook laptop use Realtek HDA codec combined with
+2xCS35L41 Amplifiers using I2C with External Boost.
+
+Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20230206150019.3825120-1-sbinding@opensource.cirrus.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/pci/hda/patch_realtek.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -9481,6 +9481,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
+ SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402", ALC245_FIXUP_CS35L41_SPI_2),
+ SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
++ SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
+ SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
+ SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
+ SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
--- /dev/null
+From 9a6804aa1c92cd28e89e746ace44d5ba101db76c Mon Sep 17 00:00:00 2001
+From: Elvis Angelaccio <elvis.angelaccio@kde.org>
+Date: Sun, 5 Feb 2023 19:56:18 +0100
+Subject: ALSA: hda/realtek: Enable mute/micmute LEDs on HP Elitebook, 645 G9
+
+From: Elvis Angelaccio <elvis.angelaccio@kde.org>
+
+commit 9a6804aa1c92cd28e89e746ace44d5ba101db76c upstream.
+
+The HP Elitebook 645 G9 laptop (with motherboard model 89D2) uses the
+ALC236 codec and requires the alc236_fixup_hp_mute_led_micmute_vref
+fixup in order to enable mute/micmute LEDs.
+
+Note: the alc236_fixup_hp_gpio_led fixup, which is used by the Elitebook
+640 G9, does not work with the 645 G9.
+
+[ rearranged the entry in SSID order -- tiwai ]
+
+Signed-off-by: Elvis Angelaccio <elvis.angelaccio@kde.org>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/4055cb48-e228-8a13-524d-afbb7aaafebe@kde.org
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/pci/hda/patch_realtek.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -9423,6 +9423,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
+ SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
+ SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
++ SND_PCI_QUIRK(0x103c, 0x89d3, "HP EliteBook 645 G9 (MB 89D2)", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
+ SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
+ SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
+ SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
--- /dev/null
+From 6c4715aa5b0ab1c0d35780b7c552e952dbb5515d Mon Sep 17 00:00:00 2001
+From: Andy Chi <andy.chi@canonical.com>
+Date: Tue, 7 Feb 2023 16:30:09 +0800
+Subject: ALSA: hda/realtek: fix mute/micmute LEDs don't work for a HP platform.
+
+From: Andy Chi <andy.chi@canonical.com>
+
+commit 6c4715aa5b0ab1c0d35780b7c552e952dbb5515d upstream.
+
+There is a HP platform needs ALC236_FIXUP_HP_GPIO_LED quirk to
+make mic-mute/audio-mute working.
+
+Signed-off-by: Andy Chi <andy.chi@canonical.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20230207083011.100189-1-andy.chi@canonical.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/pci/hda/patch_realtek.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -9434,6 +9434,11 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
+ SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
+ SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
++ SND_PCI_QUIRK(0x103c, 0x8b7a, "HP", ALC236_FIXUP_HP_GPIO_LED),
++ SND_PCI_QUIRK(0x103c, 0x8b7d, "HP", ALC236_FIXUP_HP_GPIO_LED),
++ SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
++ SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
++ SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
+ SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
+ SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
+ SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
--- /dev/null
+From bd401fd730cbcb0717bbc5438f15084db10f9259 Mon Sep 17 00:00:00 2001
+From: Guillaume Pinot <texitoi@texitoi.eu>
+Date: Sun, 29 Jan 2023 18:13:38 +0100
+Subject: ALSA: hda/realtek: Fix the speaker output on Samsung Galaxy Book2 Pro 360
+
+From: Guillaume Pinot <texitoi@texitoi.eu>
+
+commit bd401fd730cbcb0717bbc5438f15084db10f9259 upstream.
+
+Samsung Galaxy Book2 Pro 360 (13" 2022 NP930QED-KA1FR) with codec SSID
+144d:ca03 requires the same workaround for enabling the speaker amp
+like other Samsung models with ALC298 codec.
+
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Guillaume Pinot <texitoi@texitoi.eu>
+Link: https://lore.kernel.org/r/20230129171338.17249-1-texitoi@texitoi.eu
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/pci/hda/patch_realtek.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -9523,6 +9523,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
+ SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
+ SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
++ SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
+ SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
+ SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
+ SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
--- /dev/null
+From 4ae5e1e97c44f4654516c1d41591a462ed62fa7b Mon Sep 17 00:00:00 2001
+From: Devid Antonio Filoni <devid.filoni@egluetechnologies.com>
+Date: Fri, 25 Nov 2022 18:04:18 +0100
+Subject: can: j1939: do not wait 250 ms if the same addr was already claimed
+
+From: Devid Antonio Filoni <devid.filoni@egluetechnologies.com>
+
+commit 4ae5e1e97c44f4654516c1d41591a462ed62fa7b upstream.
+
+The ISO 11783-5 standard, in "4.5.2 - Address claim requirements", states:
+ d) No CF shall begin, or resume, transmission on the network until 250
+ ms after it has successfully claimed an address except when
+ responding to a request for address-claimed.
+
+But "Figure 6" and "Figure 7" in "4.5.4.2 - Address-claim
+prioritization" show that the CF begins the transmission after 250 ms
+from the first AC (address-claimed) message even if it sends another AC
+message during that time window to resolve the address contention with
+another CF.
+
+As stated in "4.4.2.3 - Address-claimed message":
+ In order to successfully claim an address, the CF sending an address
+ claimed message shall not receive a contending claim from another CF
+ for at least 250 ms.
+
+As stated in "4.4.3.2 - NAME management (NM) message":
+ 1) A commanding CF can
+ d) request that a CF with a specified NAME transmit the address-
+ claimed message with its current NAME.
+ 2) A target CF shall
+ d) send an address-claimed message in response to a request for a
+ matching NAME
+
+Taking the above arguments into account, the 250 ms wait is requested
+only during network initialization.
+
+Do not restart the timer on AC message if both the NAME and the address
+match and so if the address has already been claimed (timer has expired)
+or the AC message has been sent to resolve the contention with another
+CF (timer is still running).
+
+Signed-off-by: Devid Antonio Filoni <devid.filoni@egluetechnologies.com>
+Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
+Link: https://lore.kernel.org/all/20221125170418.34575-1-devid.filoni@egluetechnologies.com
+Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
+Cc: stable@vger.kernel.org
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/can/j1939/address-claim.c | 40 ++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 40 insertions(+)
+
+--- a/net/can/j1939/address-claim.c
++++ b/net/can/j1939/address-claim.c
+@@ -165,6 +165,46 @@ static void j1939_ac_process(struct j193
+ * leaving this function.
+ */
+ ecu = j1939_ecu_get_by_name_locked(priv, name);
++
++ if (ecu && ecu->addr == skcb->addr.sa) {
++ /* The ISO 11783-5 standard, in "4.5.2 - Address claim
++ * requirements", states:
++ * d) No CF shall begin, or resume, transmission on the
++ * network until 250 ms after it has successfully claimed
++ * an address except when responding to a request for
++ * address-claimed.
++ *
++ * But "Figure 6" and "Figure 7" in "4.5.4.2 - Address-claim
++ * prioritization" show that the CF begins the transmission
++ * after 250 ms from the first AC (address-claimed) message
++ * even if it sends another AC message during that time window
++ * to resolve the address contention with another CF.
++ *
++ * As stated in "4.4.2.3 - Address-claimed message":
++ * In order to successfully claim an address, the CF sending
++ * an address claimed message shall not receive a contending
++ * claim from another CF for at least 250 ms.
++ *
++ * As stated in "4.4.3.2 - NAME management (NM) message":
++ * 1) A commanding CF can
++ * d) request that a CF with a specified NAME transmit
++ * the address-claimed message with its current NAME.
++ * 2) A target CF shall
++ * d) send an address-claimed message in response to a
++ * request for a matching NAME
++ *
++ * Taking the above arguments into account, the 250 ms wait is
++ * requested only during network initialization.
++ *
++ * Do not restart the timer on AC message if both the NAME and
++ * the address match and so if the address has already been
++ * claimed (timer has expired) or the AC message has been sent
++ * to resolve the contention with another CF (timer is still
++ * running).
++ */
++ goto out_ecu_put;
++ }
++
+ if (!ecu && j1939_address_is_unicast(skcb->addr.sa))
+ ecu = j1939_ecu_create_locked(priv, name);
+
--- /dev/null
+From f6933c01e42d2fc83b9133ed755609e4aac6eadd Mon Sep 17 00:00:00 2001
+From: Mark Brown <broonie@kernel.org>
+Date: Sat, 28 Jan 2023 17:47:50 +0000
+Subject: of/address: Return an error when no valid dma-ranges are found
+
+From: Mark Brown <broonie@kernel.org>
+
+commit f6933c01e42d2fc83b9133ed755609e4aac6eadd upstream.
+
+Commit 7a8b64d17e35 ("of/address: use range parser for of_dma_get_range")
+converted the parsing of dma-range properties to use code shared with the
+PCI range parser. The intent was to introduce no functional changes however
+in the case where we fail to translate the first resource instead of
+returning -EINVAL the new code we return 0. Restore the previous behaviour
+by returning an error if we find no valid ranges, the original code only
+handled the first range but subsequently support for parsing all supplied
+ranges was added.
+
+This avoids confusing code using the parsed ranges which doesn't expect to
+successfully parse ranges but have only a list terminator returned, this
+fixes breakage with so far as I can tell all DMA for on SoC devices on the
+Socionext Synquacer platform which has a firmware supplied DT. A bisect
+identified the original conversion as triggering the issues there.
+
+Fixes: 7a8b64d17e35 ("of/address: use range parser for of_dma_get_range")
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Cc: Luca Di Stefano <luca.distefano@linaro.org>
+Cc: 993612@bugs.debian.org
+Cc: stable@kernel.org
+Link: https://lore.kernel.org/r/20230126-synquacer-boot-v2-1-cb80fd23c4e2@kernel.org
+Signed-off-by: Rob Herring <robh@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/of/address.c | 21 +++++++++++++++------
+ 1 file changed, 15 insertions(+), 6 deletions(-)
+
+--- a/drivers/of/address.c
++++ b/drivers/of/address.c
+@@ -965,8 +965,19 @@ int of_dma_get_range(struct device_node
+ }
+
+ of_dma_range_parser_init(&parser, node);
+- for_each_of_range(&parser, &range)
++ for_each_of_range(&parser, &range) {
++ if (range.cpu_addr == OF_BAD_ADDR) {
++ pr_err("translation of DMA address(%llx) to CPU address failed node(%pOF)\n",
++ range.bus_addr, node);
++ continue;
++ }
+ num_ranges++;
++ }
++
++ if (!num_ranges) {
++ ret = -EINVAL;
++ goto out;
++ }
+
+ r = kcalloc(num_ranges + 1, sizeof(*r), GFP_KERNEL);
+ if (!r) {
+@@ -975,18 +986,16 @@ int of_dma_get_range(struct device_node
+ }
+
+ /*
+- * Record all info in the generic DMA ranges array for struct device.
++ * Record all info in the generic DMA ranges array for struct device,
++ * returning an error if we don't find any parsable ranges.
+ */
+ *map = r;
+ of_dma_range_parser_init(&parser, node);
+ for_each_of_range(&parser, &range) {
+ pr_debug("dma_addr(%llx) cpu_addr(%llx) size(%llx)\n",
+ range.bus_addr, range.cpu_addr, range.size);
+- if (range.cpu_addr == OF_BAD_ADDR) {
+- pr_err("translation of DMA address(%llx) to CPU address failed node(%pOF)\n",
+- range.bus_addr, node);
++ if (range.cpu_addr == OF_BAD_ADDR)
+ continue;
+- }
+ r->cpu_start = range.cpu_addr;
+ r->dma_start = range.bus_addr;
+ r->size = range.size;
--- /dev/null
+From ff209ecc376a2ea8dd106a1f594427a5d94b7dd3 Mon Sep 17 00:00:00 2001
+From: Bjorn Helgaas <bhelgaas@google.com>
+Date: Fri, 3 Feb 2023 13:57:39 -0600
+Subject: Revert "PCI/ASPM: Refactor L1 PM Substates Control Register programming"
+
+From: Bjorn Helgaas <bhelgaas@google.com>
+
+commit ff209ecc376a2ea8dd106a1f594427a5d94b7dd3 upstream.
+
+This reverts commit 5e85eba6f50dc288c22083a7e213152bcc4b8208.
+
+Thomas Witt reported that 5e85eba6f50d ("PCI/ASPM: Refactor L1 PM Substates
+Control Register programming") broke suspend/resume on a Tuxedo
+Infinitybook S 14 v5, which seems to use a Clevo L140CU Mainboard.
+
+The main symptom is:
+
+ iwlwifi 0000:02:00.0: Unable to change power state from D3hot to D0, device inaccessible
+ nvme 0000:03:00.0: Unable to change power state from D3hot to D0, device inaccessible
+
+and the machine is only partially usable after resume. It can't run dmesg
+and can't do a clean reboot. This happens on every suspend/resume cycle.
+
+Revert 5e85eba6f50d until we can figure out the root cause.
+
+Fixes: 5e85eba6f50d ("PCI/ASPM: Refactor L1 PM Substates Control Register programming")
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=216877
+Reported-by: Thomas Witt <kernel@witt.link>
+Tested-by: Thomas Witt <kernel@witt.link>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Cc: stable@vger.kernel.org # v6.1+
+Cc: Vidya Sagar <vidyas@nvidia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/pci/pcie/aspm.c | 74 +++++++++++++++++++----------------------
+ 1 file changed, 34 insertions(+), 40 deletions(-)
+
+diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
+index 915cbd939dd9..4b4184563a92 100644
+--- a/drivers/pci/pcie/aspm.c
++++ b/drivers/pci/pcie/aspm.c
+@@ -470,31 +470,6 @@ static void pci_clear_and_set_dword(struct pci_dev *pdev, int pos,
+ pci_write_config_dword(pdev, pos, val);
+ }
+
+-static void aspm_program_l1ss(struct pci_dev *dev, u32 ctl1, u32 ctl2)
+-{
+- u16 l1ss = dev->l1ss;
+- u32 l1_2_enable;
+-
+- /*
+- * Per PCIe r6.0, sec 5.5.4, T_POWER_ON in PCI_L1SS_CTL2 must be
+- * programmed prior to setting the L1.2 enable bits in PCI_L1SS_CTL1.
+- */
+- pci_write_config_dword(dev, l1ss + PCI_L1SS_CTL2, ctl2);
+-
+- /*
+- * In addition, Common_Mode_Restore_Time and LTR_L1.2_THRESHOLD in
+- * PCI_L1SS_CTL1 must be programmed *before* setting the L1.2
+- * enable bits, even though they're all in PCI_L1SS_CTL1.
+- */
+- l1_2_enable = ctl1 & PCI_L1SS_CTL1_L1_2_MASK;
+- ctl1 &= ~PCI_L1SS_CTL1_L1_2_MASK;
+-
+- pci_write_config_dword(dev, l1ss + PCI_L1SS_CTL1, ctl1);
+- if (l1_2_enable)
+- pci_write_config_dword(dev, l1ss + PCI_L1SS_CTL1,
+- ctl1 | l1_2_enable);
+-}
+-
+ /* Calculate L1.2 PM substate timing parameters */
+ static void aspm_calc_l1ss_info(struct pcie_link_state *link,
+ u32 parent_l1ss_cap, u32 child_l1ss_cap)
+@@ -504,6 +479,7 @@ static void aspm_calc_l1ss_info(struct pcie_link_state *link,
+ u32 t_common_mode, t_power_on, l1_2_threshold, scale, value;
+ u32 ctl1 = 0, ctl2 = 0;
+ u32 pctl1, pctl2, cctl1, cctl2;
++ u32 pl1_2_enables, cl1_2_enables;
+
+ if (!(link->aspm_support & ASPM_STATE_L1_2_MASK))
+ return;
+@@ -552,21 +528,39 @@ static void aspm_calc_l1ss_info(struct pcie_link_state *link,
+ ctl2 == pctl2 && ctl2 == cctl2)
+ return;
+
+- pctl1 &= ~(PCI_L1SS_CTL1_CM_RESTORE_TIME |
+- PCI_L1SS_CTL1_LTR_L12_TH_VALUE |
+- PCI_L1SS_CTL1_LTR_L12_TH_SCALE);
+- pctl1 |= (ctl1 & (PCI_L1SS_CTL1_CM_RESTORE_TIME |
+- PCI_L1SS_CTL1_LTR_L12_TH_VALUE |
+- PCI_L1SS_CTL1_LTR_L12_TH_SCALE));
+- aspm_program_l1ss(parent, pctl1, ctl2);
+-
+- cctl1 &= ~(PCI_L1SS_CTL1_CM_RESTORE_TIME |
+- PCI_L1SS_CTL1_LTR_L12_TH_VALUE |
+- PCI_L1SS_CTL1_LTR_L12_TH_SCALE);
+- cctl1 |= (ctl1 & (PCI_L1SS_CTL1_CM_RESTORE_TIME |
+- PCI_L1SS_CTL1_LTR_L12_TH_VALUE |
+- PCI_L1SS_CTL1_LTR_L12_TH_SCALE));
+- aspm_program_l1ss(child, cctl1, ctl2);
++ /* Disable L1.2 while updating. See PCIe r5.0, sec 5.5.4, 7.8.3.3 */
++ pl1_2_enables = pctl1 & PCI_L1SS_CTL1_L1_2_MASK;
++ cl1_2_enables = cctl1 & PCI_L1SS_CTL1_L1_2_MASK;
++
++ if (pl1_2_enables || cl1_2_enables) {
++ pci_clear_and_set_dword(child, child->l1ss + PCI_L1SS_CTL1,
++ PCI_L1SS_CTL1_L1_2_MASK, 0);
++ pci_clear_and_set_dword(parent, parent->l1ss + PCI_L1SS_CTL1,
++ PCI_L1SS_CTL1_L1_2_MASK, 0);
++ }
++
++ /* Program T_POWER_ON times in both ports */
++ pci_write_config_dword(parent, parent->l1ss + PCI_L1SS_CTL2, ctl2);
++ pci_write_config_dword(child, child->l1ss + PCI_L1SS_CTL2, ctl2);
++
++ /* Program Common_Mode_Restore_Time in upstream device */
++ pci_clear_and_set_dword(parent, parent->l1ss + PCI_L1SS_CTL1,
++ PCI_L1SS_CTL1_CM_RESTORE_TIME, ctl1);
++
++ /* Program LTR_L1.2_THRESHOLD time in both ports */
++ pci_clear_and_set_dword(parent, parent->l1ss + PCI_L1SS_CTL1,
++ PCI_L1SS_CTL1_LTR_L12_TH_VALUE |
++ PCI_L1SS_CTL1_LTR_L12_TH_SCALE, ctl1);
++ pci_clear_and_set_dword(child, child->l1ss + PCI_L1SS_CTL1,
++ PCI_L1SS_CTL1_LTR_L12_TH_VALUE |
++ PCI_L1SS_CTL1_LTR_L12_TH_SCALE, ctl1);
++
++ if (pl1_2_enables || cl1_2_enables) {
++ pci_clear_and_set_dword(parent, parent->l1ss + PCI_L1SS_CTL1, 0,
++ pl1_2_enables);
++ pci_clear_and_set_dword(child, child->l1ss + PCI_L1SS_CTL1, 0,
++ cl1_2_enables);
++ }
+ }
+
+ static void aspm_l1ss_init(struct pcie_link_state *link)
+--
+2.39.1
+
--- /dev/null
+From a7152be79b627428c628da2a887ca4b2512a78fd Mon Sep 17 00:00:00 2001
+From: Bjorn Helgaas <bhelgaas@google.com>
+Date: Fri, 3 Feb 2023 13:57:29 -0600
+Subject: Revert "PCI/ASPM: Save L1 PM Substates Capability for suspend/resume"
+
+From: Bjorn Helgaas <bhelgaas@google.com>
+
+commit a7152be79b627428c628da2a887ca4b2512a78fd upstream.
+
+This reverts commit 4ff116d0d5fd8a025604b0802d93a2d5f4e465d1.
+
+Tasev Nikola and Mark Enriquez reported that resume from suspend was broken
+in v6.1-rc1. Tasev bisected to a47126ec29f5 ("PCI/PTM: Cache PTM
+Capability offset"), but we can't figure out how that could be related.
+
+Mark saw the same symptoms and bisected to 4ff116d0d5fd ("PCI/ASPM: Save L1
+PM Substates Capability for suspend/resume"), which does have a connection:
+it restores L1 Substates configuration while ASPM L1 may be enabled:
+
+ pci_restore_state
+ pci_restore_aspm_l1ss_state
+ aspm_program_l1ss
+ pci_write_config_dword(PCI_L1SS_CTL1, ctl1) # L1SS restore
+ pci_restore_pcie_state
+ pcie_capability_write_word(PCI_EXP_LNKCTL, cap[i++]) # L1 restore
+
+which is a problem because PCIe r6.0, sec 5.5.4, requires that:
+
+ If setting either or both of the enable bits for ASPM L1 PM
+ Substates, both ports must be configured as described in this
+ section while ASPM L1 is disabled.
+
+Separately, Thomas Witt reported that 5e85eba6f50d ("PCI/ASPM: Refactor L1
+PM Substates Control Register programming") broke suspend/resume, and it
+depends on 4ff116d0d5fd.
+
+Revert 4ff116d0d5fd ("PCI/ASPM: Save L1 PM Substates Capability for
+suspend/resume") to fix the resume issue and enable revert of 5e85eba6f50d
+to fix the issue Thomas reported.
+
+Note that reverting 4ff116d0d5fd means L1 Substates config may be lost on
+suspend/resume. As far as we know the system will use more power but will
+still *work* correctly.
+
+Fixes: 4ff116d0d5fd ("PCI/ASPM: Save L1 PM Substates Capability for suspend/resume")
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=216782
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=216877
+Reported-by: Tasev Nikola <tasev.stefanoska@skynet.be>
+Reported-by: Mark Enriquez <enriquezmark36@gmail.com>
+Reported-by: Thomas Witt <kernel@witt.link>
+Tested-by: Mark Enriquez <enriquezmark36@gmail.com>
+Tested-by: Thomas Witt <kernel@witt.link>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Cc: stable@vger.kernel.org # v6.1+
+Cc: Vidya Sagar <vidyas@nvidia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/pci/pci.c | 7 -------
+ drivers/pci/pci.h | 4 ----
+ drivers/pci/pcie/aspm.c | 37 -------------------------------------
+ 3 files changed, 48 deletions(-)
+
+--- a/drivers/pci/pci.c
++++ b/drivers/pci/pci.c
+@@ -1665,7 +1665,6 @@ int pci_save_state(struct pci_dev *dev)
+ return i;
+
+ pci_save_ltr_state(dev);
+- pci_save_aspm_l1ss_state(dev);
+ pci_save_dpc_state(dev);
+ pci_save_aer_state(dev);
+ pci_save_ptm_state(dev);
+@@ -1772,7 +1771,6 @@ void pci_restore_state(struct pci_dev *d
+ * LTR itself (in the PCIe capability).
+ */
+ pci_restore_ltr_state(dev);
+- pci_restore_aspm_l1ss_state(dev);
+
+ pci_restore_pcie_state(dev);
+ pci_restore_pasid_state(dev);
+@@ -3465,11 +3463,6 @@ void pci_allocate_cap_save_buffers(struc
+ if (error)
+ pci_err(dev, "unable to allocate suspend buffer for LTR\n");
+
+- error = pci_add_ext_cap_save_buffer(dev, PCI_EXT_CAP_ID_L1SS,
+- 2 * sizeof(u32));
+- if (error)
+- pci_err(dev, "unable to allocate suspend buffer for ASPM-L1SS\n");
+-
+ pci_allocate_vc_save_buffers(dev);
+ }
+
+--- a/drivers/pci/pci.h
++++ b/drivers/pci/pci.h
+@@ -565,14 +565,10 @@ bool pcie_wait_for_link(struct pci_dev *
+ void pcie_aspm_init_link_state(struct pci_dev *pdev);
+ void pcie_aspm_exit_link_state(struct pci_dev *pdev);
+ void pcie_aspm_powersave_config_link(struct pci_dev *pdev);
+-void pci_save_aspm_l1ss_state(struct pci_dev *dev);
+-void pci_restore_aspm_l1ss_state(struct pci_dev *dev);
+ #else
+ static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) { }
+ static inline void pcie_aspm_exit_link_state(struct pci_dev *pdev) { }
+ static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev) { }
+-static inline void pci_save_aspm_l1ss_state(struct pci_dev *dev) { }
+-static inline void pci_restore_aspm_l1ss_state(struct pci_dev *dev) { }
+ #endif
+
+ #ifdef CONFIG_PCIE_ECRC
+--- a/drivers/pci/pcie/aspm.c
++++ b/drivers/pci/pcie/aspm.c
+@@ -757,43 +757,6 @@ static void pcie_config_aspm_l1ss(struct
+ PCI_L1SS_CTL1_L1SS_MASK, val);
+ }
+
+-void pci_save_aspm_l1ss_state(struct pci_dev *dev)
+-{
+- struct pci_cap_saved_state *save_state;
+- u16 l1ss = dev->l1ss;
+- u32 *cap;
+-
+- if (!l1ss)
+- return;
+-
+- save_state = pci_find_saved_ext_cap(dev, PCI_EXT_CAP_ID_L1SS);
+- if (!save_state)
+- return;
+-
+- cap = (u32 *)&save_state->cap.data[0];
+- pci_read_config_dword(dev, l1ss + PCI_L1SS_CTL2, cap++);
+- pci_read_config_dword(dev, l1ss + PCI_L1SS_CTL1, cap++);
+-}
+-
+-void pci_restore_aspm_l1ss_state(struct pci_dev *dev)
+-{
+- struct pci_cap_saved_state *save_state;
+- u32 *cap, ctl1, ctl2;
+- u16 l1ss = dev->l1ss;
+-
+- if (!l1ss)
+- return;
+-
+- save_state = pci_find_saved_ext_cap(dev, PCI_EXT_CAP_ID_L1SS);
+- if (!save_state)
+- return;
+-
+- cap = (u32 *)&save_state->cap.data[0];
+- ctl2 = *cap++;
+- ctl1 = *cap;
+- aspm_program_l1ss(dev, ctl1, ctl2);
+-}
+-
+ static void pcie_config_aspm_dev(struct pci_dev *pdev, u32 val)
+ {
+ pcie_capability_clear_and_set_word(pdev, PCI_EXP_LNKCTL,
hv_netvsc-allocate-memory-in-netvsc_dma_map-with-gfp_atomic.patch
btrfs-limit-device-extents-to-the-device-size.patch
btrfs-zlib-zero-initialize-zlib-workspace.patch
+alsa-hda-realtek-add-positivo-n14kp6-tg.patch
+alsa-emux-avoid-potential-array-out-of-bound-in-snd_emux_xg_control.patch
+alsa-hda-realtek-fix-the-speaker-output-on-samsung-galaxy-book2-pro-360.patch
+alsa-hda-realtek-enable-mute-micmute-leds-on-hp-elitebook-645-g9.patch
+alsa-hda-realtek-add-quirk-for-asus-um3402-using-cs35l41.patch
+alsa-hda-realtek-fix-mute-micmute-leds-don-t-work-for-a-hp-platform.patch
+revert-pci-aspm-save-l1-pm-substates-capability-for-suspend-resume.patch
+revert-pci-aspm-refactor-l1-pm-substates-control-register-programming.patch
+tracing-fix-poll-and-select-do-not-work-on-per_cpu-trace_pipe-and-trace_pipe_raw.patch
+of-address-return-an-error-when-no-valid-dma-ranges-are-found.patch
+can-j1939-do-not-wait-250-ms-if-the-same-addr-was-already-claimed.patch
--- /dev/null
+From 3e46d910d8acf94e5360126593b68bf4fee4c4a1 Mon Sep 17 00:00:00 2001
+From: Shiju Jose <shiju.jose@huawei.com>
+Date: Thu, 2 Feb 2023 18:23:09 +0000
+Subject: tracing: Fix poll() and select() do not work on per_cpu trace_pipe and trace_pipe_raw
+
+From: Shiju Jose <shiju.jose@huawei.com>
+
+commit 3e46d910d8acf94e5360126593b68bf4fee4c4a1 upstream.
+
+poll() and select() on per_cpu trace_pipe and trace_pipe_raw do not work
+since kernel 6.1-rc6. This issue is seen after the commit
+42fb0a1e84ff525ebe560e2baf9451ab69127e2b ("tracing/ring-buffer: Have
+polling block on watermark").
+
+This issue is firstly detected and reported, when testing the CXL error
+events in the rasdaemon and also erified using the test application for poll()
+and select().
+
+This issue occurs for the per_cpu case, when calling the ring_buffer_poll_wait(),
+in kernel/trace/ring_buffer.c, with the buffer_percent > 0 and then wait until the
+percentage of pages are available. The default value set for the buffer_percent is 50
+in the kernel/trace/trace.c.
+
+As a fix, allow userspace application could set buffer_percent as 0 through
+the buffer_percent_fops, so that the task will wake up as soon as data is added
+to any of the specific cpu buffer.
+
+Link: https://lore.kernel.org/linux-trace-kernel/20230202182309.742-2-shiju.jose@huawei.com
+
+Cc: <mhiramat@kernel.org>
+Cc: <mchehab@kernel.org>
+Cc: <linux-edac@vger.kernel.org>
+Cc: stable@vger.kernel.org
+Fixes: 42fb0a1e84ff5 ("tracing/ring-buffer: Have polling block on watermark")
+Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
+Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/trace/trace.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+--- a/kernel/trace/trace.c
++++ b/kernel/trace/trace.c
+@@ -9144,9 +9144,6 @@ buffer_percent_write(struct file *filp,
+ if (val > 100)
+ return -EINVAL;
+
+- if (!val)
+- val = 1;
+-
+ tr->buffer_percent = val;
+
+ (*ppos)++;