From: Greg Kroah-Hartman Date: Mon, 13 Jan 2020 10:09:28 +0000 (+0100) Subject: 5.4-stable patches X-Git-Tag: v4.4.210~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8e1f1381c2baacb72834ea585430673501f9ce0d;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: alsa-hda-realtek-add-new-codec-supported-for-alcs1200a.patch alsa-hda-realtek-add-quirk-for-the-bass-speaker-on-lenovo-yoga-x1-7th-gen.patch alsa-hda-realtek-set-eapd-control-to-default-for-alc222.patch alsa-usb-audio-apply-the-sample-rate-quirk-for-bose-companion-5.patch i2c-fix-bus-recovery-stop-mode-timing.patch powercap-intel_rapl-add-null-pointer-check-to-rapl_mmio_cpu_online.patch rtc-sun6i-add-support-for-rtc-clocks-on-r40.patch tpm-handle-negative-priv-response_len-in-tpm_common_read.patch tpm-revert-tpm_tis-reserve-chip-for-duration-of-tpm_tis_core_init.patch tpm-revert-tpm_tis_core-set-tpm_chip_flag_irq-before-probing-for-interrupts.patch tpm-revert-tpm_tis_core-turn-on-the-tpm-before-probing-irq-s.patch usb-chipidea-host-disable-port-power-only-if-previously-enabled.patch --- diff --git a/queue-5.4/alsa-hda-realtek-add-new-codec-supported-for-alcs1200a.patch b/queue-5.4/alsa-hda-realtek-add-new-codec-supported-for-alcs1200a.patch new file mode 100644 index 00000000000..220c80f8860 --- /dev/null +++ b/queue-5.4/alsa-hda-realtek-add-new-codec-supported-for-alcs1200a.patch @@ -0,0 +1,48 @@ +From 6d9ffcff646bbd0ede6c2a59f4cd28414ecec6e0 Mon Sep 17 00:00:00 2001 +From: Kailang Yang +Date: Fri, 3 Jan 2020 16:24:06 +0800 +Subject: ALSA: hda/realtek - Add new codec supported for ALCS1200A + +From: Kailang Yang + +commit 6d9ffcff646bbd0ede6c2a59f4cd28414ecec6e0 upstream. + +Add ALCS1200A supported. +It was similar as ALC900. + +Signed-off-by: Kailang Yang +Cc: +Link: https://lore.kernel.org/r/a9bd3cdaa02d4fa197623448d5c51e50@realtek.com +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_realtek.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -430,6 +430,7 @@ static void alc_fill_eapd_coef(struct hd + break; + case 0x10ec0899: + case 0x10ec0900: ++ case 0x10ec0b00: + case 0x10ec1168: + case 0x10ec1220: + alc_update_coef_idx(codec, 0x7, 1<<1, 0); +@@ -2526,6 +2527,7 @@ static int patch_alc882(struct hda_codec + case 0x10ec0882: + case 0x10ec0885: + case 0x10ec0900: ++ case 0x10ec0b00: + case 0x10ec1220: + break; + default: +@@ -9295,6 +9297,7 @@ static const struct hda_device_id snd_hd + HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662), + HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882), + HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882), ++ HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882), + HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882), + HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882), + {} /* terminator */ diff --git a/queue-5.4/alsa-hda-realtek-add-quirk-for-the-bass-speaker-on-lenovo-yoga-x1-7th-gen.patch b/queue-5.4/alsa-hda-realtek-add-quirk-for-the-bass-speaker-on-lenovo-yoga-x1-7th-gen.patch new file mode 100644 index 00000000000..8a6fa497aa3 --- /dev/null +++ b/queue-5.4/alsa-hda-realtek-add-quirk-for-the-bass-speaker-on-lenovo-yoga-x1-7th-gen.patch @@ -0,0 +1,33 @@ +From 54a6a7dc107da0492a9e84fd7e9a107b3c58138d Mon Sep 17 00:00:00 2001 +From: Kailang Yang +Date: Wed, 8 Jan 2020 16:47:56 +0800 +Subject: ALSA: hda/realtek - Add quirk for the bass speaker on Lenovo Yoga X1 7th gen + +From: Kailang Yang + +commit 54a6a7dc107da0492a9e84fd7e9a107b3c58138d upstream. + +Add quirk to ALC285_FIXUP_SPEAKER2_TO_DAC1, which is the same fixup +applied for X1 Carbon 7th gen in commit d2cd795c4ece ("ALSA: hda - +fixup for the bass speaker on Lenovo Carbon X1 7th gen"). + +Signed-off-by: Kailang Yang +Reviewed-by: Jaroslav Kysela +Cc: +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + 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 +@@ -7260,6 +7260,7 @@ static const struct snd_pci_quirk alc269 + SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), + SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), + SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), ++ SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Yoga 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1), + SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1), + SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), + SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), diff --git a/queue-5.4/alsa-hda-realtek-set-eapd-control-to-default-for-alc222.patch b/queue-5.4/alsa-hda-realtek-set-eapd-control-to-default-for-alc222.patch new file mode 100644 index 00000000000..9e2f78d6de5 --- /dev/null +++ b/queue-5.4/alsa-hda-realtek-set-eapd-control-to-default-for-alc222.patch @@ -0,0 +1,30 @@ +From 9194a1ebbc56d7006835e2b4cacad301201fb832 Mon Sep 17 00:00:00 2001 +From: Kailang Yang +Date: Tue, 7 Jan 2020 17:22:19 +0800 +Subject: ALSA: hda/realtek - Set EAPD control to default for ALC222 + +From: Kailang Yang + +commit 9194a1ebbc56d7006835e2b4cacad301201fb832 upstream. + +Set EAPD control to verb control. + +Signed-off-by: Kailang Yang +Cc: +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + 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 +@@ -412,6 +412,7 @@ static void alc_fill_eapd_coef(struct hd + case 0x10ec0672: + alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ + break; ++ case 0x10ec0222: + case 0x10ec0623: + alc_update_coef_idx(codec, 0x19, 1<<13, 0); + break; diff --git a/queue-5.4/alsa-usb-audio-apply-the-sample-rate-quirk-for-bose-companion-5.patch b/queue-5.4/alsa-usb-audio-apply-the-sample-rate-quirk-for-bose-companion-5.patch new file mode 100644 index 00000000000..64d9c9c3bdf --- /dev/null +++ b/queue-5.4/alsa-usb-audio-apply-the-sample-rate-quirk-for-bose-companion-5.patch @@ -0,0 +1,32 @@ +From 51d4efab7865e6ea6a4ebcd25b3f03c019515c4c Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Sat, 4 Jan 2020 12:09:36 +0100 +Subject: ALSA: usb-audio: Apply the sample rate quirk for Bose Companion 5 + +From: Takashi Iwai + +commit 51d4efab7865e6ea6a4ebcd25b3f03c019515c4c upstream. + +Bose Companion 5 (with USB ID 05a7:1020) doesn't seem supporting +reading back the sample rate, so the existing quirk is needed. + +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206063 +Cc: +Link: https://lore.kernel.org/r/20200104110936.14288-1-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/usb/quirks.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -1397,6 +1397,7 @@ bool snd_usb_get_sample_rate_quirk(struc + case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */ + case USB_ID(0x0556, 0x0014): /* Phoenix Audio TMX320VC */ + case USB_ID(0x05A3, 0x9420): /* ELP HD USB Camera */ ++ case USB_ID(0x05a7, 0x1020): /* Bose Companion 5 */ + case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */ + case USB_ID(0x1395, 0x740a): /* Sennheiser DECT */ + case USB_ID(0x1901, 0x0191): /* GE B850V3 CP2114 audio interface */ diff --git a/queue-5.4/i2c-fix-bus-recovery-stop-mode-timing.patch b/queue-5.4/i2c-fix-bus-recovery-stop-mode-timing.patch new file mode 100644 index 00000000000..7c0e5f3c441 --- /dev/null +++ b/queue-5.4/i2c-fix-bus-recovery-stop-mode-timing.patch @@ -0,0 +1,63 @@ +From cf8ce8b80f8bf9669f6ec4e71e16668430febdac Mon Sep 17 00:00:00 2001 +From: Russell King +Date: Sun, 15 Dec 2019 16:39:05 +0000 +Subject: i2c: fix bus recovery stop mode timing + +From: Russell King + +commit cf8ce8b80f8bf9669f6ec4e71e16668430febdac upstream. + +The I2C specification states that tsu:sto for standard mode timing must +be at minimum 4us. Pictographically, this is: + +SCL: ____/~~~~~~~~~ +SDA: _________/~~~~ + ->| |<- 4us minimum + +We are currently waiting 2.5us between asserting SCL and SDA, which is +in violation of the standard. Adjust the timings to ensure that we meet +what is stipulated as the minimum timings to ensure that all devices +correctly interpret the STOP bus transition. + +This is more important than trying to generate a square wave with even +duty cycle. + +Signed-off-by: Russell King +Signed-off-by: Wolfram Sang +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/i2c/i2c-core-base.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +--- a/drivers/i2c/i2c-core-base.c ++++ b/drivers/i2c/i2c-core-base.c +@@ -186,10 +186,11 @@ int i2c_generic_scl_recovery(struct i2c_ + * If we can set SDA, we will always create a STOP to ensure additional + * pulses will do no harm. This is achieved by letting SDA follow SCL + * half a cycle later. Check the 'incomplete_write_byte' fault injector +- * for details. ++ * for details. Note that we must honour tsu:sto, 4us, but lets use 5us ++ * here for simplicity. + */ + bri->set_scl(adap, scl); +- ndelay(RECOVERY_NDELAY / 2); ++ ndelay(RECOVERY_NDELAY); + if (bri->set_sda) + bri->set_sda(adap, scl); + ndelay(RECOVERY_NDELAY / 2); +@@ -211,7 +212,13 @@ int i2c_generic_scl_recovery(struct i2c_ + scl = !scl; + bri->set_scl(adap, scl); + /* Creating STOP again, see above */ +- ndelay(RECOVERY_NDELAY / 2); ++ if (scl) { ++ /* Honour minimum tsu:sto */ ++ ndelay(RECOVERY_NDELAY); ++ } else { ++ /* Honour minimum tf and thd:dat */ ++ ndelay(RECOVERY_NDELAY / 2); ++ } + if (bri->set_sda) + bri->set_sda(adap, scl); + ndelay(RECOVERY_NDELAY / 2); diff --git a/queue-5.4/powercap-intel_rapl-add-null-pointer-check-to-rapl_mmio_cpu_online.patch b/queue-5.4/powercap-intel_rapl-add-null-pointer-check-to-rapl_mmio_cpu_online.patch new file mode 100644 index 00000000000..08e5f2b21c6 --- /dev/null +++ b/queue-5.4/powercap-intel_rapl-add-null-pointer-check-to-rapl_mmio_cpu_online.patch @@ -0,0 +1,77 @@ +From 3aa3c5882e4fb2274448908aaed605a3ed7dd15d Mon Sep 17 00:00:00 2001 +From: Harry Pan +Date: Mon, 30 Dec 2019 22:36:56 +0800 +Subject: powercap: intel_rapl: add NULL pointer check to rapl_mmio_cpu_online() + +From: Harry Pan + +commit 3aa3c5882e4fb2274448908aaed605a3ed7dd15d upstream. + +RAPL MMIO support depends on the RAPL common driver. During CPU +initialization rapl_mmio_cpu_online() is called via CPU hotplug +to initialize the MMIO RAPL for the new CPU, but if that CPU is +not present in the common RAPL driver's support list, rapl_defaults +is NULL and the kernel crashes on an attempt to dereference it: + +[ 4.188566] BUG: kernel NULL pointer dereference, address: 0000000000000020 +...snip... +[ 4.189555] RIP: 0010:rapl_add_package+0x223/0x574 +[ 4.189555] Code: b5 a0 31 c0 49 8b 4d 78 48 01 d9 48 8b 0c c1 49 89 4c c6 10 48 ff c0 48 83 f8 05 75 e7 49 83 ff 03 75 15 48 8b 05 09 bc 18 01 <8b> 70 20 41 89 b6 0c 05 00 00 85 f6 75 1a 49 81 c6 18 9 +[ 4.189555] RSP: 0000:ffffb3adc00b3d90 EFLAGS: 00010246 +[ 4.189555] RAX: 0000000000000000 RBX: 0000000000000098 RCX: 0000000000000000 +[ 4.267161] usb 1-1: New USB device found, idVendor=2109, idProduct=2812, bcdDevice= b.e0 +[ 4.189555] RDX: 0000000000001000 RSI: 0000000000000000 RDI: ffff9340caafd000 +[ 4.189555] RBP: ffffb3adc00b3df8 R08: ffffffffa0246e28 R09: ffff9340caafc000 +[ 4.189555] R10: 000000000000024a R11: ffffffff9ff1f6f2 R12: 00000000ffffffed +[ 4.189555] R13: ffff9340caa94800 R14: ffff9340caafc518 R15: 0000000000000003 +[ 4.189555] FS: 0000000000000000(0000) GS:ffff9340ce200000(0000) knlGS:0000000000000000 +[ 4.189555] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +[ 4.189555] CR2: 0000000000000020 CR3: 0000000302c14001 CR4: 00000000003606f0 +[ 4.189555] Call Trace: +[ 4.189555] ? __switch_to_asm+0x40/0x70 +[ 4.189555] rapl_mmio_cpu_online+0x47/0x64 +[ 4.189555] ? rapl_mmio_write_raw+0x33/0x33 +[ 4.281059] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 +[ 4.189555] cpuhp_invoke_callback+0x29f/0x66f +[ 4.189555] ? __schedule+0x46d/0x6a0 +[ 4.189555] cpuhp_thread_fun+0xb9/0x11c +[ 4.189555] smpboot_thread_fn+0x17d/0x22f +[ 4.297006] usb 1-1: Product: USB2.0 Hub +[ 4.189555] ? cpu_report_death+0x43/0x43 +[ 4.189555] kthread+0x137/0x13f +[ 4.189555] ? cpu_report_death+0x43/0x43 +[ 4.189555] ? kthread_blkcg+0x2e/0x2e +[ 4.312951] usb 1-1: Manufacturer: VIA Labs, Inc. +[ 4.189555] ret_from_fork+0x1f/0x40 +[ 4.189555] Modules linked in: +[ 4.189555] CR2: 0000000000000020 +[ 4.189555] ---[ end trace 01bb812aabc791f4 ]--- + +To avoid that problem, check rapl_defaults NULL upfront and return an +error code if it is NULL. [Note that it does not make sense to even +try to allocate memory in that case, because it is not going to be +used anyway.] + +Fixes: 555c45fe0d04 ("int340X/processor_thermal_device: add support for MMIO RAPL") +Cc: 5.3+ # 5.3+ +Signed-off-by: Harry Pan +[ rjw: Subject & changelog ] +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/powercap/intel_rapl_common.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/powercap/intel_rapl_common.c ++++ b/drivers/powercap/intel_rapl_common.c +@@ -1293,6 +1293,9 @@ struct rapl_package *rapl_add_package(in + struct cpuinfo_x86 *c = &cpu_data(cpu); + int ret; + ++ if (!rapl_defaults) ++ return ERR_PTR(-ENODEV); ++ + rp = kzalloc(sizeof(struct rapl_package), GFP_KERNEL); + if (!rp) + return ERR_PTR(-ENOMEM); diff --git a/queue-5.4/rtc-sun6i-add-support-for-rtc-clocks-on-r40.patch b/queue-5.4/rtc-sun6i-add-support-for-rtc-clocks-on-r40.patch new file mode 100644 index 00000000000..3fd95590937 --- /dev/null +++ b/queue-5.4/rtc-sun6i-add-support-for-rtc-clocks-on-r40.patch @@ -0,0 +1,57 @@ +From 111bf02b8f544f98de53ea1f912ae01f598b161b Mon Sep 17 00:00:00 2001 +From: Chen-Yu Tsai +Date: Thu, 5 Dec 2019 16:50:54 +0800 +Subject: rtc: sun6i: Add support for RTC clocks on R40 + +From: Chen-Yu Tsai + +commit 111bf02b8f544f98de53ea1f912ae01f598b161b upstream. + +When support for the R40 in the rtc-sun6i driver was split out for a +separate compatible string, only the RTC half was covered, and not the +clock half. Unfortunately this results in the whole driver not working, +as the RTC half expects the clock half to have been initialized. + +Add support for the clock part as well. The clock part is like the H3, +but does not need to export the internal oscillator, nor does it have +a gateable LOSC external output. + +This fixes issues with WiFi and Bluetooth not working on the BPI M2U. + +Fixes: d6624cc75021 ("rtc: sun6i: Add R40 compatible") +Cc: # 5.3.x +Signed-off-by: Chen-Yu Tsai +Acked-by: Maxime Ripard +Link: https://lore.kernel.org/r/20191205085054.6049-1-wens@kernel.org +Signed-off-by: Alexandre Belloni +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/rtc/rtc-sun6i.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +--- a/drivers/rtc/rtc-sun6i.c ++++ b/drivers/rtc/rtc-sun6i.c +@@ -380,6 +380,22 @@ static void __init sun50i_h6_rtc_clk_ini + CLK_OF_DECLARE_DRIVER(sun50i_h6_rtc_clk, "allwinner,sun50i-h6-rtc", + sun50i_h6_rtc_clk_init); + ++/* ++ * The R40 user manual is self-conflicting on whether the prescaler is ++ * fixed or configurable. The clock diagram shows it as fixed, but there ++ * is also a configurable divider in the RTC block. ++ */ ++static const struct sun6i_rtc_clk_data sun8i_r40_rtc_data = { ++ .rc_osc_rate = 16000000, ++ .fixed_prescaler = 512, ++}; ++static void __init sun8i_r40_rtc_clk_init(struct device_node *node) ++{ ++ sun6i_rtc_clk_init(node, &sun8i_r40_rtc_data); ++} ++CLK_OF_DECLARE_DRIVER(sun8i_r40_rtc_clk, "allwinner,sun8i-r40-rtc", ++ sun8i_r40_rtc_clk_init); ++ + static const struct sun6i_rtc_clk_data sun8i_v3_rtc_data = { + .rc_osc_rate = 32000, + .has_out_clk = 1, diff --git a/queue-5.4/series b/queue-5.4/series index 27ac0106d58..afd525e7848 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -1 +1,13 @@ chardev-avoid-potential-use-after-free-in-chrdev_open.patch +i2c-fix-bus-recovery-stop-mode-timing.patch +powercap-intel_rapl-add-null-pointer-check-to-rapl_mmio_cpu_online.patch +usb-chipidea-host-disable-port-power-only-if-previously-enabled.patch +alsa-usb-audio-apply-the-sample-rate-quirk-for-bose-companion-5.patch +alsa-hda-realtek-add-new-codec-supported-for-alcs1200a.patch +alsa-hda-realtek-set-eapd-control-to-default-for-alc222.patch +alsa-hda-realtek-add-quirk-for-the-bass-speaker-on-lenovo-yoga-x1-7th-gen.patch +tpm-revert-tpm_tis-reserve-chip-for-duration-of-tpm_tis_core_init.patch +tpm-revert-tpm_tis_core-set-tpm_chip_flag_irq-before-probing-for-interrupts.patch +tpm-revert-tpm_tis_core-turn-on-the-tpm-before-probing-irq-s.patch +tpm-handle-negative-priv-response_len-in-tpm_common_read.patch +rtc-sun6i-add-support-for-rtc-clocks-on-r40.patch diff --git a/queue-5.4/tpm-handle-negative-priv-response_len-in-tpm_common_read.patch b/queue-5.4/tpm-handle-negative-priv-response_len-in-tpm_common_read.patch new file mode 100644 index 00000000000..cd8e01fe5af --- /dev/null +++ b/queue-5.4/tpm-handle-negative-priv-response_len-in-tpm_common_read.patch @@ -0,0 +1,49 @@ +From a430e67d9a2c62a8c7b315b99e74de02018d0a96 Mon Sep 17 00:00:00 2001 +From: Tadeusz Struk +Date: Tue, 7 Jan 2020 14:04:48 -0800 +Subject: tpm: Handle negative priv->response_len in tpm_common_read() + +From: Tadeusz Struk + +commit a430e67d9a2c62a8c7b315b99e74de02018d0a96 upstream. + +The priv->response_length can hold the size of an response or an negative +error code, and the tpm_common_read() needs to handle both cases correctly. +Changed the type of response_length to signed and accounted for negative +value in tpm_common_read(). + +Cc: stable@vger.kernel.org +Fixes: d23d12484307 ("tpm: fix invalid locking in NONBLOCKING mode") +Reported-by: Laura Abbott +Signed-off-by: Tadeusz Struk +Reviewed-by: Jarkko Sakkinen +Signed-off-by: Jarkko Sakkinen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/char/tpm/tpm-dev-common.c | 2 +- + drivers/char/tpm/tpm-dev.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/char/tpm/tpm-dev-common.c ++++ b/drivers/char/tpm/tpm-dev-common.c +@@ -130,7 +130,7 @@ ssize_t tpm_common_read(struct file *fil + priv->response_read = true; + + ret_size = min_t(ssize_t, size, priv->response_length); +- if (!ret_size) { ++ if (ret_size <= 0) { + priv->response_length = 0; + goto out; + } +--- a/drivers/char/tpm/tpm-dev.h ++++ b/drivers/char/tpm/tpm-dev.h +@@ -14,7 +14,7 @@ struct file_priv { + struct work_struct timeout_work; + struct work_struct async_work; + wait_queue_head_t async_wait; +- size_t response_length; ++ ssize_t response_length; + bool response_read; + bool command_enqueued; + diff --git a/queue-5.4/tpm-revert-tpm_tis-reserve-chip-for-duration-of-tpm_tis_core_init.patch b/queue-5.4/tpm-revert-tpm_tis-reserve-chip-for-duration-of-tpm_tis_core_init.patch new file mode 100644 index 00000000000..ca22158a318 --- /dev/null +++ b/queue-5.4/tpm-revert-tpm_tis-reserve-chip-for-duration-of-tpm_tis_core_init.patch @@ -0,0 +1,126 @@ +From 9550f210492c6f88415709002f42a9d15c0e6231 Mon Sep 17 00:00:00 2001 +From: Jarkko Sakkinen +Date: Tue, 31 Dec 2019 01:19:59 +0200 +Subject: tpm: Revert "tpm_tis: reserve chip for duration of tpm_tis_core_init" + +From: Jarkko Sakkinen + +commit 9550f210492c6f88415709002f42a9d15c0e6231 upstream. + +Revert a commit, which was included in Linux v5.5-rc3 because it did not +properly fix the issues it was supposed to fix. + +Fixes: 21df4a8b6018 ("tpm_tis: reserve chip for duration of tpm_tis_core_init") +Link: https://bugzilla.kernel.org/show_bug.cgi?id=205935 +Cc: stable@vger.kernel.org +Cc: Jerry Snitselaar +Cc: Dan Williams +Tested-by: Dan Williams +Tested-by: Xiaoping Zhou +Signed-off-by: Jarkko Sakkinen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/char/tpm/tpm_tis_core.c | 35 +++++++++++++++++------------------ + 1 file changed, 17 insertions(+), 18 deletions(-) + +--- a/drivers/char/tpm/tpm_tis_core.c ++++ b/drivers/char/tpm/tpm_tis_core.c +@@ -899,13 +899,13 @@ int tpm_tis_core_init(struct device *dev + + if (wait_startup(chip, 0) != 0) { + rc = -ENODEV; +- goto err_start; ++ goto out_err; + } + + /* Take control of the TPM's interrupt hardware and shut it off */ + rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask); + if (rc < 0) +- goto err_start; ++ goto out_err; + + intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT | + TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT; +@@ -914,21 +914,21 @@ int tpm_tis_core_init(struct device *dev + + rc = tpm_chip_start(chip); + if (rc) +- goto err_start; +- ++ goto out_err; + rc = tpm2_probe(chip); ++ tpm_chip_stop(chip); + if (rc) +- goto err_probe; ++ goto out_err; + + rc = tpm_tis_read32(priv, TPM_DID_VID(0), &vendor); + if (rc < 0) +- goto err_probe; ++ goto out_err; + + priv->manufacturer_id = vendor; + + rc = tpm_tis_read8(priv, TPM_RID(0), &rid); + if (rc < 0) +- goto err_probe; ++ goto out_err; + + dev_info(dev, "%s TPM (device-id 0x%X, rev-id %d)\n", + (chip->flags & TPM_CHIP_FLAG_TPM2) ? "2.0" : "1.2", +@@ -937,13 +937,13 @@ int tpm_tis_core_init(struct device *dev + probe = probe_itpm(chip); + if (probe < 0) { + rc = -ENODEV; +- goto err_probe; ++ goto out_err; + } + + /* Figure out the capabilities */ + rc = tpm_tis_read32(priv, TPM_INTF_CAPS(priv->locality), &intfcaps); + if (rc < 0) +- goto err_probe; ++ goto out_err; + + dev_dbg(dev, "TPM interface capabilities (0x%x):\n", + intfcaps); +@@ -977,9 +977,10 @@ int tpm_tis_core_init(struct device *dev + if (tpm_get_timeouts(chip)) { + dev_err(dev, "Could not get TPM timeouts and durations\n"); + rc = -ENODEV; +- goto err_probe; ++ goto out_err; + } + ++ tpm_chip_start(chip); + chip->flags |= TPM_CHIP_FLAG_IRQ; + if (irq) { + tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED, +@@ -990,20 +991,18 @@ int tpm_tis_core_init(struct device *dev + } else { + tpm_tis_probe_irq(chip, intmask); + } ++ tpm_chip_stop(chip); + } + +- tpm_chip_stop(chip); +- + rc = tpm_chip_register(chip); + if (rc) +- goto err_start; ++ goto out_err; + +- return 0; +- +-err_probe: +- tpm_chip_stop(chip); ++ if (chip->ops->clk_enable != NULL) ++ chip->ops->clk_enable(chip, false); + +-err_start: ++ return 0; ++out_err: + if ((chip->ops != NULL) && (chip->ops->clk_enable != NULL)) + chip->ops->clk_enable(chip, false); + diff --git a/queue-5.4/tpm-revert-tpm_tis_core-set-tpm_chip_flag_irq-before-probing-for-interrupts.patch b/queue-5.4/tpm-revert-tpm_tis_core-set-tpm_chip_flag_irq-before-probing-for-interrupts.patch new file mode 100644 index 00000000000..53aa94f81bf --- /dev/null +++ b/queue-5.4/tpm-revert-tpm_tis_core-set-tpm_chip_flag_irq-before-probing-for-interrupts.patch @@ -0,0 +1,48 @@ +From dda8b2af395b2ed508e2ef314ae32e122841b447 Mon Sep 17 00:00:00 2001 +From: Stefan Berger +Date: Tue, 26 Nov 2019 08:17:52 -0500 +Subject: tpm: Revert "tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts" + +From: Stefan Berger + +commit dda8b2af395b2ed508e2ef314ae32e122841b447 upstream. + +There has been a bunch of reports (one from kernel bugzilla linked) +reporting that when this commit is applied it causes on some machines +boot freezes. + +Unfortunately hardware where this commit causes a failure is not widely +available (only one I'm aware is Lenovo T490), which means we cannot +predict yet how long it will take to properly fix tpm_tis interrupt +probing. + +Thus, the least worst short term action is to revert the code to the +state before this commit. In long term we need fix the tpm_tis probing +code to work on machines that Stefan's fix was supposed to fix. + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=205935 +Fixes: 1ea32c83c699 ("tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts") +Cc: stable@vger.kernel.org +Cc: Jerry Snitselaar +Cc: Dan Williams +Tested-by: Dan Williams +Tested-by: Xiaoping Zhou +Signed-off-by: Stefan Berger +Reported-by: Jerry Snitselaar +Signed-off-by: Jarkko Sakkinen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/char/tpm/tpm_tis_core.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/char/tpm/tpm_tis_core.c ++++ b/drivers/char/tpm/tpm_tis_core.c +@@ -981,7 +981,6 @@ int tpm_tis_core_init(struct device *dev + } + + tpm_chip_start(chip); +- chip->flags |= TPM_CHIP_FLAG_IRQ; + if (irq) { + tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED, + irq); diff --git a/queue-5.4/tpm-revert-tpm_tis_core-turn-on-the-tpm-before-probing-irq-s.patch b/queue-5.4/tpm-revert-tpm_tis_core-turn-on-the-tpm-before-probing-irq-s.patch new file mode 100644 index 00000000000..b668ac96b20 --- /dev/null +++ b/queue-5.4/tpm-revert-tpm_tis_core-turn-on-the-tpm-before-probing-irq-s.patch @@ -0,0 +1,56 @@ +From aa4a63dd981682b1742baa01237036e48bc11923 Mon Sep 17 00:00:00 2001 +From: Stefan Berger +Date: Tue, 26 Nov 2019 08:17:53 -0500 +Subject: tpm: Revert "tpm_tis_core: Turn on the TPM before probing IRQ's" + +From: Stefan Berger + +commit aa4a63dd981682b1742baa01237036e48bc11923 upstream. + +There has been a bunch of reports (one from kernel bugzilla linked) +reporting that when this commit is applied it causes on some machines +boot freezes. + +Unfortunately hardware where this commit causes a failure is not widely +available (only one I'm aware is Lenovo T490), which means we cannot +predict yet how long it will take to properly fix tpm_tis interrupt +probing. + +Thus, the least worst short term action is to revert the code to the +state before this commit. In long term we need fix the tpm_tis probing +code to work on machines that Stefan's fix was supposed to fix. + +Fixes: 21df4a8b6018 ("tpm_tis: reserve chip for duration of tpm_tis_core_init") +Link: https://bugzilla.kernel.org/show_bug.cgi?id=205935 +Cc: stable@vger.kernel.org +Cc: Jerry Snitselaar +Cc: Dan Williams +Tested-by: Dan Williams +Tested-by: Xiaoping Zhou +Signed-off-by: Stefan Berger +Reported-by: Jerry Snitselaar +Signed-off-by: Jarkko Sakkinen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/char/tpm/tpm_tis_core.c | 2 -- + 1 file changed, 2 deletions(-) + +--- a/drivers/char/tpm/tpm_tis_core.c ++++ b/drivers/char/tpm/tpm_tis_core.c +@@ -980,7 +980,6 @@ int tpm_tis_core_init(struct device *dev + goto out_err; + } + +- tpm_chip_start(chip); + if (irq) { + tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED, + irq); +@@ -990,7 +989,6 @@ int tpm_tis_core_init(struct device *dev + } else { + tpm_tis_probe_irq(chip, intmask); + } +- tpm_chip_stop(chip); + } + + rc = tpm_chip_register(chip); diff --git a/queue-5.4/usb-chipidea-host-disable-port-power-only-if-previously-enabled.patch b/queue-5.4/usb-chipidea-host-disable-port-power-only-if-previously-enabled.patch new file mode 100644 index 00000000000..217319c8c08 --- /dev/null +++ b/queue-5.4/usb-chipidea-host-disable-port-power-only-if-previously-enabled.patch @@ -0,0 +1,77 @@ +From c1ffba305dbcf3fb9ca969c20a97acbddc38f8e9 Mon Sep 17 00:00:00 2001 +From: Guenter Roeck +Date: Thu, 26 Dec 2019 07:57:54 -0800 +Subject: usb: chipidea: host: Disable port power only if previously enabled + +From: Guenter Roeck + +commit c1ffba305dbcf3fb9ca969c20a97acbddc38f8e9 upstream. + +On shutdown, ehci_power_off() is called unconditionally to power off +each port, even if it was never called to power on the port. +For chipidea, this results in a call to ehci_ci_portpower() with a request +to power off ports even if the port was never powered on. +This results in the following warning from the regulator code. + +WARNING: CPU: 0 PID: 182 at drivers/regulator/core.c:2596 _regulator_disable+0x1a8/0x210 +unbalanced disables for usb_otg2_vbus +Modules linked in: +CPU: 0 PID: 182 Comm: init Not tainted 5.4.6 #1 +Hardware name: Freescale i.MX7 Dual (Device Tree) +[] (unwind_backtrace) from [] (show_stack+0x10/0x14) +[] (show_stack) from [] (dump_stack+0xe0/0x10c) +[] (dump_stack) from [] (__warn+0xf4/0x10c) +[] (__warn) from [] (warn_slowpath_fmt+0x78/0xbc) +[] (warn_slowpath_fmt) from [] (_regulator_disable+0x1a8/0x210) +[] (_regulator_disable) from [] (regulator_disable+0x38/0xe8) +[] (regulator_disable) from [] (ehci_ci_portpower+0x38/0xdc) +[] (ehci_ci_portpower) from [] (ehci_port_power+0x50/0xa4) +[] (ehci_port_power) from [] (ehci_silence_controller+0x5c/0xc4) +[] (ehci_silence_controller) from [] (ehci_stop+0x3c/0xcc) +[] (ehci_stop) from [] (usb_remove_hcd+0xe0/0x19c) +[] (usb_remove_hcd) from [] (host_stop+0x38/0xa8) +[] (host_stop) from [] (ci_hdrc_remove+0x44/0xe4) +... + +Keeping track of the power enable state avoids the warning and traceback. + +Fixes: c8679a2fb8dec ("usb: chipidea: host: add portpower override") +Cc: Michael Grzeschik +Cc: Peter Chen +Cc: stable@vger.kernel.org +Signed-off-by: Guenter Roeck +Acked-by: Peter Chen +Link: https://lore.kernel.org/r/20191226155754.25451-1-linux@roeck-us.net +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/chipidea/host.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/usb/chipidea/host.c ++++ b/drivers/usb/chipidea/host.c +@@ -26,6 +26,7 @@ static int (*orig_bus_suspend)(struct us + + struct ehci_ci_priv { + struct regulator *reg_vbus; ++ bool enabled; + }; + + static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable) +@@ -37,7 +38,7 @@ static int ehci_ci_portpower(struct usb_ + int ret = 0; + int port = HCS_N_PORTS(ehci->hcs_params); + +- if (priv->reg_vbus) { ++ if (priv->reg_vbus && enable != priv->enabled) { + if (port > 1) { + dev_warn(dev, + "Not support multi-port regulator control\n"); +@@ -53,6 +54,7 @@ static int ehci_ci_portpower(struct usb_ + enable ? "enable" : "disable", ret); + return ret; + } ++ priv->enabled = enable; + } + + if (enable && (ci->platdata->phy_mode == USBPHY_INTERFACE_MODE_HSIC)) {