From: Greg Kroah-Hartman Date: Sun, 18 Aug 2019 05:10:58 +0000 (+0200) Subject: 4.9-stable patches X-Git-Tag: v4.19.68~57 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=765e3f472eaf7611f90eae822414e92d099b6b11;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: alsa-hda-add-a-generic-reboot_notify.patch alsa-hda-fix-a-memory-leak-bug.patch alsa-hda-let-all-conexant-codec-enter-d3-when-rebooting.patch xtensa-add-missing-isync-to-the-cpu_reset-tlb-code.patch --- diff --git a/queue-4.9/alsa-hda-add-a-generic-reboot_notify.patch b/queue-4.9/alsa-hda-add-a-generic-reboot_notify.patch new file mode 100644 index 00000000000..234946df5bf --- /dev/null +++ b/queue-4.9/alsa-hda-add-a-generic-reboot_notify.patch @@ -0,0 +1,114 @@ +From 871b9066027702e6e6589da0e1edd3b7dede7205 Mon Sep 17 00:00:00 2001 +From: Hui Wang +Date: Wed, 14 Aug 2019 12:09:08 +0800 +Subject: ALSA: hda - Add a generic reboot_notify + +From: Hui Wang + +commit 871b9066027702e6e6589da0e1edd3b7dede7205 upstream. + +Make codec enter D3 before rebooting or poweroff can fix the noise +issue on some laptops. And in theory it is harmless for all codecs +to enter D3 before rebooting or poweroff, let us add a generic +reboot_notify, then realtek and conexant drivers can call this +function. + +Cc: stable@vger.kernel.org +Signed-off-by: Hui Wang +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/hda_generic.c | 19 +++++++++++++++++++ + sound/pci/hda/hda_generic.h | 1 + + sound/pci/hda/patch_conexant.c | 6 +----- + sound/pci/hda/patch_realtek.c | 11 +---------- + 4 files changed, 22 insertions(+), 15 deletions(-) + +--- a/sound/pci/hda/hda_generic.c ++++ b/sound/pci/hda/hda_generic.c +@@ -5849,6 +5849,24 @@ void snd_hda_gen_free(struct hda_codec * + } + EXPORT_SYMBOL_GPL(snd_hda_gen_free); + ++/** ++ * snd_hda_gen_reboot_notify - Make codec enter D3 before rebooting ++ * @codec: the HDA codec ++ * ++ * This can be put as patch_ops reboot_notify function. ++ */ ++void snd_hda_gen_reboot_notify(struct hda_codec *codec) ++{ ++ /* Make the codec enter D3 to avoid spurious noises from the internal ++ * speaker during (and after) reboot ++ */ ++ snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3); ++ snd_hda_codec_write(codec, codec->core.afg, 0, ++ AC_VERB_SET_POWER_STATE, AC_PWRST_D3); ++ msleep(10); ++} ++EXPORT_SYMBOL_GPL(snd_hda_gen_reboot_notify); ++ + #ifdef CONFIG_PM + /** + * snd_hda_gen_check_power_status - check the loopback power save state +@@ -5876,6 +5894,7 @@ static const struct hda_codec_ops generi + .init = snd_hda_gen_init, + .free = snd_hda_gen_free, + .unsol_event = snd_hda_jack_unsol_event, ++ .reboot_notify = snd_hda_gen_reboot_notify, + #ifdef CONFIG_PM + .check_power_status = snd_hda_gen_check_power_status, + #endif +--- a/sound/pci/hda/hda_generic.h ++++ b/sound/pci/hda/hda_generic.h +@@ -322,6 +322,7 @@ int snd_hda_gen_parse_auto_config(struct + struct auto_pin_cfg *cfg); + int snd_hda_gen_build_controls(struct hda_codec *codec); + int snd_hda_gen_build_pcms(struct hda_codec *codec); ++void snd_hda_gen_reboot_notify(struct hda_codec *codec); + + /* standard jack event callbacks */ + void snd_hda_gen_hp_automute(struct hda_codec *codec, +--- a/sound/pci/hda/patch_conexant.c ++++ b/sound/pci/hda/patch_conexant.c +@@ -216,11 +216,7 @@ static void cx_auto_reboot_notify(struct + /* 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); +- +- snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3); +- snd_hda_codec_write(codec, codec->core.afg, 0, +- AC_VERB_SET_POWER_STATE, AC_PWRST_D3); +- msleep(10); ++ snd_hda_gen_reboot_notify(codec); + } + + static void cx_auto_free(struct hda_codec *codec) +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -802,15 +802,6 @@ static void alc_reboot_notify(struct hda + alc_shutup(codec); + } + +-/* power down codec to D3 at reboot/shutdown; set as reboot_notify ops */ +-static void alc_d3_at_reboot(struct hda_codec *codec) +-{ +- snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3); +- snd_hda_codec_write(codec, codec->core.afg, 0, +- AC_VERB_SET_POWER_STATE, AC_PWRST_D3); +- msleep(10); +-} +- + #define alc_free snd_hda_gen_free + + #ifdef CONFIG_PM +@@ -4473,7 +4464,7 @@ static void alc_fixup_tpt440_dock(struct + struct alc_spec *spec = codec->spec; + + if (action == HDA_FIXUP_ACT_PRE_PROBE) { +- spec->reboot_notify = alc_d3_at_reboot; /* reduce noise */ ++ spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */ + spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; + codec->power_save_node = 0; /* avoid click noises */ + snd_hda_apply_pincfgs(codec, pincfgs); diff --git a/queue-4.9/alsa-hda-fix-a-memory-leak-bug.patch b/queue-4.9/alsa-hda-fix-a-memory-leak-bug.patch new file mode 100644 index 00000000000..c1f40e85775 --- /dev/null +++ b/queue-4.9/alsa-hda-fix-a-memory-leak-bug.patch @@ -0,0 +1,36 @@ +From cfef67f016e4c00a2f423256fc678a6967a9fc09 Mon Sep 17 00:00:00 2001 +From: Wenwen Wang +Date: Fri, 9 Aug 2019 23:29:48 -0500 +Subject: ALSA: hda - Fix a memory leak bug + +From: Wenwen Wang + +commit cfef67f016e4c00a2f423256fc678a6967a9fc09 upstream. + +In snd_hda_parse_generic_codec(), 'spec' is allocated through kzalloc(). +Then, the pin widgets in 'codec' are parsed. However, if the parsing +process fails, 'spec' is not deallocated, leading to a memory leak. + +To fix the above issue, free 'spec' before returning the error. + +Fixes: 352f7f914ebb ("ALSA: hda - Merge Realtek parser code to generic parser") +Signed-off-by: Wenwen Wang +Cc: +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/hda_generic.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sound/pci/hda/hda_generic.c ++++ b/sound/pci/hda/hda_generic.c +@@ -5898,7 +5898,7 @@ static int snd_hda_parse_generic_codec(s + + err = snd_hda_parse_pin_defcfg(codec, &spec->autocfg, NULL, 0); + if (err < 0) +- return err; ++ goto error; + + err = snd_hda_gen_parse_auto_config(codec, &spec->autocfg); + if (err < 0) diff --git a/queue-4.9/alsa-hda-let-all-conexant-codec-enter-d3-when-rebooting.patch b/queue-4.9/alsa-hda-let-all-conexant-codec-enter-d3-when-rebooting.patch new file mode 100644 index 00000000000..d452e6ac5d2 --- /dev/null +++ b/queue-4.9/alsa-hda-let-all-conexant-codec-enter-d3-when-rebooting.patch @@ -0,0 +1,47 @@ +From 401714d9534aad8c24196b32600da683116bbe09 Mon Sep 17 00:00:00 2001 +From: Hui Wang +Date: Wed, 14 Aug 2019 12:09:07 +0800 +Subject: ALSA: hda - Let all conexant codec enter D3 when rebooting + +From: Hui Wang + +commit 401714d9534aad8c24196b32600da683116bbe09 upstream. + +We have 3 new lenovo laptops which have conexant codec 0x14f11f86, +these 3 laptops also have the noise issue when rebooting, after +letting the codec enter D3 before rebooting or poweroff, the noise +disappers. + +Instead of adding a new ID again in the reboot_notify(), let us make +this function apply to all conexant codec. In theory make codec enter +D3 before rebooting or poweroff is harmless, and I tested this change +on a couple of other Lenovo laptops which have different conexant +codecs, there is no side effect so far. + +Cc: stable@vger.kernel.org +Signed-off-by: Hui Wang +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_conexant.c | 9 --------- + 1 file changed, 9 deletions(-) + +--- a/sound/pci/hda/patch_conexant.c ++++ b/sound/pci/hda/patch_conexant.c +@@ -204,15 +204,6 @@ static void cx_auto_reboot_notify(struct + { + struct conexant_spec *spec = codec->spec; + +- switch (codec->core.vendor_id) { +- case 0x14f12008: /* CX8200 */ +- case 0x14f150f2: /* CX20722 */ +- case 0x14f150f4: /* CX20724 */ +- break; +- default: +- return; +- } +- + /* 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); diff --git a/queue-4.9/series b/queue-4.9/series index cf4ac5a8df4..63512aa7f04 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -56,3 +56,7 @@ siphash-add-cryptographically-secure-prf.patch siphash-implement-halfsiphash1-3-for-hash-tables.patch inet-switch-ip-id-generator-to-siphash.patch netfilter-ctnetlink-don-t-use-conntrack-expect-object-addresses-as-id.patch +xtensa-add-missing-isync-to-the-cpu_reset-tlb-code.patch +alsa-hda-fix-a-memory-leak-bug.patch +alsa-hda-add-a-generic-reboot_notify.patch +alsa-hda-let-all-conexant-codec-enter-d3-when-rebooting.patch diff --git a/queue-4.9/xtensa-add-missing-isync-to-the-cpu_reset-tlb-code.patch b/queue-4.9/xtensa-add-missing-isync-to-the-cpu_reset-tlb-code.patch new file mode 100644 index 00000000000..8ed56c7cc81 --- /dev/null +++ b/queue-4.9/xtensa-add-missing-isync-to-the-cpu_reset-tlb-code.patch @@ -0,0 +1,32 @@ +From cd8869f4cb257f22b89495ca40f5281e58ba359c Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Mon, 12 Aug 2019 15:01:30 -0700 +Subject: xtensa: add missing isync to the cpu_reset TLB code + +From: Max Filippov + +commit cd8869f4cb257f22b89495ca40f5281e58ba359c upstream. + +ITLB entry modifications must be followed by the isync instruction +before the new entries are possibly used. cpu_reset lacks one isync +between ITLB way 6 initialization and jump to the identity mapping. +Add missing isync to xtensa cpu_reset. + +Cc: stable@vger.kernel.org +Signed-off-by: Max Filippov +Signed-off-by: Greg Kroah-Hartman + +--- + arch/xtensa/kernel/setup.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/xtensa/kernel/setup.c ++++ b/arch/xtensa/kernel/setup.c +@@ -626,6 +626,7 @@ void cpu_reset(void) + "add %2, %2, %7\n\t" + "addi %0, %0, -1\n\t" + "bnez %0, 1b\n\t" ++ "isync\n\t" + /* Jump to identity mapping */ + "jx %3\n" + "2:\n\t"