From: Sasha Levin Date: Sun, 22 Jan 2023 04:27:51 +0000 (-0500) Subject: Fixes for 5.4 X-Git-Tag: v4.14.304~47 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e9ebd47d68b6512f3976fd4a2170f51c0788d171;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/alsa-hda-realtek-turn-on-power-early.patch b/queue-5.4/alsa-hda-realtek-turn-on-power-early.patch new file mode 100644 index 00000000000..ff72a240007 --- /dev/null +++ b/queue-5.4/alsa-hda-realtek-turn-on-power-early.patch @@ -0,0 +1,86 @@ +From f547564acb8041b66f4bf48c1e84e4c4e3e4b59c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 30 Dec 2022 15:22:25 +0800 +Subject: ALSA: hda/realtek - Turn on power early + +From: Yuchi Yang + +[ Upstream commit 1f680609bf1beac20e2a31ddcb1b88874123c39f ] + +Turn on power early to avoid wrong state for power relation register. +This can earlier update JD state when resume back. + +Signed-off-by: Yuchi Yang +Cc: +Link: https://lore.kernel.org/r/e35d8f4fa18f4448a2315cc7d4a3715f@realtek.com +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 30 ++++++++++++++++-------------- + 1 file changed, 16 insertions(+), 14 deletions(-) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index ee4f70cea76e..413d4886f3d2 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -3503,6 +3503,15 @@ static void alc256_init(struct hda_codec *codec) + hda_nid_t hp_pin = alc_get_hp_pin(spec); + bool hp_pin_sense; + ++ if (spec->ultra_low_power) { ++ alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1); ++ alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2); ++ alc_update_coef_idx(codec, 0x08, 7<<4, 0); ++ alc_update_coef_idx(codec, 0x3b, 1<<15, 0); ++ alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); ++ msleep(30); ++ } ++ + if (!hp_pin) + hp_pin = 0x21; + +@@ -3514,14 +3523,6 @@ static void alc256_init(struct hda_codec *codec) + msleep(2); + + alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ +- if (spec->ultra_low_power) { +- alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1); +- alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2); +- alc_update_coef_idx(codec, 0x08, 7<<4, 0); +- alc_update_coef_idx(codec, 0x3b, 1<<15, 0); +- alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); +- msleep(30); +- } + + snd_hda_codec_write(codec, hp_pin, 0, + AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); +@@ -3603,6 +3604,13 @@ static void alc225_init(struct hda_codec *codec) + hda_nid_t hp_pin = alc_get_hp_pin(spec); + bool hp1_pin_sense, hp2_pin_sense; + ++ if (spec->ultra_low_power) { ++ alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2); ++ alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); ++ alc_update_coef_idx(codec, 0x33, 1<<11, 0); ++ msleep(30); ++ } ++ + if (!hp_pin) + hp_pin = 0x21; + msleep(30); +@@ -3614,12 +3622,6 @@ static void alc225_init(struct hda_codec *codec) + msleep(2); + + alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ +- if (spec->ultra_low_power) { +- alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2); +- alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); +- alc_update_coef_idx(codec, 0x33, 1<<11, 0); +- msleep(30); +- } + + if (hp1_pin_sense || spec->ultra_low_power) + snd_hda_codec_write(codec, hp_pin, 0, +-- +2.39.0 + diff --git a/queue-5.4/drm-i915-gt-reset-twice.patch b/queue-5.4/drm-i915-gt-reset-twice.patch new file mode 100644 index 00000000000..f9d71bac207 --- /dev/null +++ b/queue-5.4/drm-i915-gt-reset-twice.patch @@ -0,0 +1,89 @@ +From 6c40a415e9bdadc4c28778efa10107a7a12c50af Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 12 Dec 2022 17:13:38 +0100 +Subject: drm/i915/gt: Reset twice + +From: Chris Wilson + +[ Upstream commit d3de5616d36462a646f5b360ba82d3b09ff668eb ] + +After applying an engine reset, on some platforms like Jasperlake, we +occasionally detect that the engine state is not cleared until shortly +after the resume. As we try to resume the engine with volatile internal +state, the first request fails with a spurious CS event (it looks like +it reports a lite-restore to the hung context, instead of the expected +idle->active context switch). + +Signed-off-by: Chris Wilson +Cc: stable@vger.kernel.org +Cc: Mika Kuoppala +Signed-off-by: Andi Shyti +Reviewed-by: Gwan-gyeong Mun +Link: https://patchwork.freedesktop.org/patch/msgid/20221212161338.1007659-1-andi.shyti@linux.intel.com +(cherry picked from commit 3db9d590557da3aa2c952f2fecd3e9b703dad790) +Signed-off-by: Rodrigo Vivi +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/i915/gt/intel_reset.c | 34 ++++++++++++++++++++++----- + 1 file changed, 28 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/gt/intel_reset.c +index 8cea42379dd7..48aed34e19df 100644 +--- a/drivers/gpu/drm/i915/gt/intel_reset.c ++++ b/drivers/gpu/drm/i915/gt/intel_reset.c +@@ -257,6 +257,7 @@ static int ironlake_do_reset(struct intel_gt *gt, + static int gen6_hw_domain_reset(struct intel_gt *gt, u32 hw_domain_mask) + { + struct intel_uncore *uncore = gt->uncore; ++ int loops = 2; + int err; + + /* +@@ -264,17 +265,38 @@ static int gen6_hw_domain_reset(struct intel_gt *gt, u32 hw_domain_mask) + * for fifo space for the write or forcewake the chip for + * the read + */ +- intel_uncore_write_fw(uncore, GEN6_GDRST, hw_domain_mask); ++ do { ++ intel_uncore_write_fw(uncore, GEN6_GDRST, hw_domain_mask); + +- /* Wait for the device to ack the reset requests */ +- err = __intel_wait_for_register_fw(uncore, +- GEN6_GDRST, hw_domain_mask, 0, +- 500, 0, +- NULL); ++ /* ++ * Wait for the device to ack the reset requests. ++ * ++ * On some platforms, e.g. Jasperlake, we see that the ++ * engine register state is not cleared until shortly after ++ * GDRST reports completion, causing a failure as we try ++ * to immediately resume while the internal state is still ++ * in flux. If we immediately repeat the reset, the second ++ * reset appears to serialise with the first, and since ++ * it is a no-op, the registers should retain their reset ++ * value. However, there is still a concern that upon ++ * leaving the second reset, the internal engine state ++ * is still in flux and not ready for resuming. ++ */ ++ err = __intel_wait_for_register_fw(uncore, GEN6_GDRST, ++ hw_domain_mask, 0, ++ 2000, 0, ++ NULL); ++ } while (err == 0 && --loops); + if (err) + DRM_DEBUG_DRIVER("Wait for 0x%08x engines reset failed\n", + hw_domain_mask); + ++ /* ++ * As we have observed that the engine state is still volatile ++ * after GDRST is acked, impose a small delay to let everything settle. ++ */ ++ udelay(50); ++ + return err; + } + +-- +2.39.0 + diff --git a/queue-5.4/efi-fix-userspace-infinite-retry-read-efivars-after-.patch b/queue-5.4/efi-fix-userspace-infinite-retry-read-efivars-after-.patch new file mode 100644 index 00000000000..5033b19e7f6 --- /dev/null +++ b/queue-5.4/efi-fix-userspace-infinite-retry-read-efivars-after-.patch @@ -0,0 +1,46 @@ +From 7e5ec1bc9c05ce5b06a39db978d20675a8a27dbe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 27 Dec 2022 23:09:36 +0800 +Subject: efi: fix userspace infinite retry read efivars after EFI runtime + services page fault + +From: Ding Hui + +[ Upstream commit e006ac3003080177cf0b673441a4241f77aaecce ] + +After [1][2], if we catch exceptions due to EFI runtime service, we will +clear EFI_RUNTIME_SERVICES bit to disable EFI runtime service, then the +subsequent routine which invoke the EFI runtime service should fail. + +But the userspace cat efivars through /sys/firmware/efi/efivars/ will stuck +and infinite loop calling read() due to efivarfs_file_read() return -EINTR. + +The -EINTR is converted from EFI_ABORTED by efi_status_to_err(), and is +an improper return value in this situation, so let virt_efi_xxx() return +EFI_DEVICE_ERROR and converted to -EIO to invoker. + +Cc: +Fixes: 3425d934fc03 ("efi/x86: Handle page faults occurring while running EFI runtime services") +Fixes: 23715a26c8d8 ("arm64: efi: Recover from synchronous exceptions occurring in firmware") +Signed-off-by: Ding Hui +Signed-off-by: Ard Biesheuvel +Signed-off-by: Sasha Levin +--- + drivers/firmware/efi/runtime-wrappers.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c +index 136b9c7f9ac9..a6735f1a16d1 100644 +--- a/drivers/firmware/efi/runtime-wrappers.c ++++ b/drivers/firmware/efi/runtime-wrappers.c +@@ -62,6 +62,7 @@ struct efi_runtime_work efi_rts_work; + \ + if (!efi_enabled(EFI_RUNTIME_SERVICES)) { \ + pr_warn_once("EFI Runtime Services are disabled!\n"); \ ++ efi_rts_work.status = EFI_DEVICE_ERROR; \ + goto exit; \ + } \ + \ +-- +2.39.0 + diff --git a/queue-5.4/series b/queue-5.4/series index 7721980af92..ffe5d6aa8d4 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -6,3 +6,6 @@ f2fs-let-s-avoid-panic-if-extent_tree-is-not-created.patch wifi-brcmfmac-fix-regression-for-broadcom-pcie-wifi-devices.patch add-exception-protection-processing-for-vd-in-axi_chan_handle_err-function.patch nilfs2-fix-general-protection-fault-in-nilfs_btree_insert.patch +efi-fix-userspace-infinite-retry-read-efivars-after-.patch +drm-i915-gt-reset-twice.patch +alsa-hda-realtek-turn-on-power-early.patch