Hi all, Since kernel >= 6.2.15 I have to add "tpm_tis.interrupts=0" to successfully boot up. Without "tpm_tis.interrupts=0" the system freezes right after taking over from the boot loader, no graphical output to diagnose the problem. But: It seems to be a race. 1 out of 10 boot tries might be successful without any changes. Hardware: - Lenovo L590 laptop - Secure boot is disabled - Disk is encrypted (LUKS) - TPM information below The first graphical output on my system is normally the "enter the password" screen to unlock the disk encryption. Waiting for some time and then typing the password "into the dark" does not work. I started a git bisect session on the 6.2 stable tree and this is the result: 32e3f11f2888b62a690596865598c8952916b6b3 is the first bad commit commit 32e3f11f2888b62a690596865598c8952916b6b3 Author: Lino Sanfilippo <l.sanfilippo> Date: Thu Nov 24 14:55:29 2022 +0100 tpm, tpm_tis: Claim locality before writing interrupt registers [ Upstream commit 15d7aa4e46eba87242a320f39773aa16faddadee ] In tpm_tis_probe_single_irq() interrupt registers TPM_INT_VECTOR, TPM_INT_STATUS and TPM_INT_ENABLE are modified to setup the interrupts. Currently these modifications are done without holding a locality thus they have no effect. Fix this by claiming the (default) locality before the registers are written. Since now tpm_tis_gen_interrupt() is called with the locality already claimed remove locality request and release from this function. Signed-off-by: Lino Sanfilippo <l.sanfilippo> Tested-by: Jarkko Sakkinen <jarkko> Reviewed-by: Jarkko Sakkinen <jarkko> Signed-off-by: Jarkko Sakkinen <jarkko> Stable-dep-of: 955df4f87760 ("tpm, tpm_tis: Claim locality when interrupts are reenabled on resume") Signed-off-by: Sasha Levin <sashal> The same commit is in the 6.3 stable tree as cc1b06934237ed3fb2b9f75a577fd102f2dba471. I went on and tried to revert that commit on top of 6.3.8. The simple git operation failed due to conflicts. The manual revert (which helps to solve my problem but might be faulty) is: diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c index e05d2b227de3..74d96449ff46 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -1153,23 +1153,21 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, goto out_err; } - if (irq) + if (irq) { tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED, irq); - else - tpm_tis_probe_irq(chip, intmask); - - if (chip->flags & TPM_CHIP_FLAG_IRQ) { - priv->int_mask = intmask; - } else { - dev_err(&chip->dev, FW_BUG + if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) { + dev_err(&chip->dev, FW_BUG "TPM interrupt not working, polling instead\n"); - rc = tpm_tis_request_locality(chip, 0); - if (rc < 0) - goto out_err; - disable_interrupts(chip); - tpm_tis_relinquish_locality(chip, 0); + rc = tpm_tis_request_locality(chip, 0); + if (rc < 0) + goto out_err; + disable_interrupts(chip); + tpm_tis_relinquish_locality(chip, 0); + } + } else { + tpm_tis_probe_irq(chip, intmask); } } When booting up with 6.2.14 I have the following TPM stuff in my boot log: [ 0.013514] ACPI: TPM2 0x000000007DC66000 000034 (v04 LENOVO TP-R0Z 00001200 PTEC 00000002) [ 0.013637] ACPI: Reserving TPM2 table memory at [mem 0x7dc66000-0x7dc66033] [ 1.197242] tpm_tis STM7364:00: 2.0 TPM (device-id 0x0, rev-id 78) [ 1.198978] tpm tpm0: [Firmware Bug]: TPM interrupt not working, polling instead With the revert (from above) applied the "TPM interrupt not working" line is gone. My temporary workaround is adding "tpm_tis.interrupts=0" for kernels > 6.2.14. That makes my system booting up reliably. I think this is a regression and should be reported upstream, no? Reproducible: Always Steps to Reproduce: 1. Reboot 2. Select a kernel >= 6.2.15 in boot menu 3. Make sure "tpm_tis.interrupts=0" is not part of the kernel cmdline options Actual Results: The system does not boot up, it seems to hang after uncompressing the kernel/initrd. No graphical output. Expected Results: Successful system boot Note: This bug report has been updated. v1 was wrong, "nomodeset" is completely unrelated.
Hm... Seems that nomodeset does not (fully) solve the problem. After some more reboots it seems that I'm facing a race here. 1 of 10 boot tries is successful with the ACPI dump in the boot log but that might just be "luck".
Florian, Thank you for the bug report and thank you for investigating this yourself. There is a known firmware bug on some ThinkPad models which causes an interrupt storm with the TPM. Recently TPM IRQ support was re-enabled in the kernel after being disabled for a while, which is why you are seeing this now. There is a DMI quirk table in: drivers/char/tpm/tpm_tis.c which lists laptops where the IRQ support is known to be broken (IRQ trigger type configured wrongly) in the firmware causing the interrupt storm. The L490 is already listed listed there. Can you try adding the L590 and see if that helps ? If that helps please submit a patch for this upstream. And please let me know if you need any help with this. Regards, Hans
Hans, thanks for this very valuable input! I will try to build and test something with L590 added to the DMI quirk table. Due to my schedule this will take a few days. I will report back here. Best regards, Florian
Hi all, the suggestion from Hans seems to work, patch has been submitted, see [1]. Let's see what the maintainers say, hopefully I got all the CC and Fixes tags right... Best regards, Florian [1] https://lore.kernel.org/linux-integrity/20230620-flo-lenovo-l590-tpm-fix-v1-1-16032a8b5a1d@bezdeka.de/T/#u
Hi all, the referenced patch got merged into Linux 6.4.5 and is meanwhile shipped by Fedora and works as expected. We can close this one now. Best regards, Florian