From: "Jarkko Sakkinen" <jarkko@kernel.org>
To: "Adam Alves" <adamoa@gmail.com>, "Peter Huewe" <peterhuewe@gmx.de>
Cc: "Jason Gunthorpe" <jgg@ziepe.ca>, <linux-integrity@vger.kernel.org>
Subject: Re: [PATCH 1/1] Fix TPM chip hanging system before suspend/shutdown
Date: Thu, 07 Mar 2024 21:54:37 +0200 [thread overview]
Message-ID: <CZNS5B6JRFLS.28TOPENHJIKCQ@kernel.org> (raw)
In-Reply-To: <20240307000331.14848-2-adamoa@gmail.com>
On Thu Mar 7, 2024 at 2:03 AM EET, Adam Alves wrote:
> My PC would hang on almost every shutdown/suspend until I started
> testing this patch and so far in the past week I haven’t experienced
> any problems anymore.
>
> I suspect that the root cause on my specific board is that after the
> ACPI command to put the device to S3 or S5, some firmware
> application/driver will try to use the TPM chip expecting it to be in
> Locality 0 as expected by TCG PC Client Platform Firmware Profile
> Version 1.06 Revision 52 (3.1.1 – Pre-OS Environment) and then when it
> fails to do so it simply halts the whole system.
>
> This issue might be related to the following bug:
> https://bugzilla.kernel.org/show_bug.cgi?id=217890
>
> Enable a user to configure the kernel
> through “tpm.locality_on_suspend=1” boot parameter so that the locality
> is set before suspend/shutdown in order to diagnose whether or not the
> board is one of the buggy ones that require this workaround. Since this
> bug is related to the board/platform instead of the specific TPM chip,
> call dmi_check_system on the tpm_init function so that this setting is
> automatically enabled for boards specified in code (ASUS TUF GAMING
> B460M-PLUS already included) – automatic configuration only works in
> case CONFIG_DMI is set though, since dmi_check_system is a non-op when
> CONFIG_DMI is not set.
>
> In case “tpm.locality_on_suspend=0” (the default) don't change any
> behavior thus preserving current functionality of any other board
> except ASUSTeK COMPUTER INC. TUF GAMING B460M-PLUS and possibly future
> boards as we successfully diagnose other boards with the same issue
> fixed by using “tpm.locality_on_suspend=1”.
>
> Signed-off-by: Adam Alves <adamoa@gmail.com>
> ---
> drivers/char/tpm/tpm-chip.c | 9 ++++++++
> drivers/char/tpm/tpm-interface.c | 36 +++++++++++++++++++++++++++++++-
> drivers/char/tpm/tpm.h | 1 +
> include/linux/tpm.h | 1 +
> 4 files changed, 46 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
> index 42b1062e33cd..8fdf7a137a94 100644
> --- a/drivers/char/tpm/tpm-chip.c
> +++ b/drivers/char/tpm/tpm-chip.c
> @@ -139,6 +139,9 @@ void tpm_chip_stop(struct tpm_chip *chip)
> {
> tpm_go_idle(chip);
> tpm_relinquish_locality(chip);
> + // If locality is to be preserved, we need to make sure it is Locality 0.
If you put that kind C++ comment you should also check out
https://www.kernel.org/doc/html/latest/process/coding-style.html
Other stuff that I said in my earlier response still applies.
BR, Jarkko
next prev parent reply other threads:[~2024-03-07 19:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 0:03 [PATCH 0/1] Fix TPM chip hanging system before suspend/shutdown Adam Alves
2024-03-07 0:03 ` [PATCH 1/1] " Adam Alves
2024-03-07 19:54 ` Jarkko Sakkinen [this message]
2024-03-07 22:17 ` Adam Alves
2024-03-07 22:49 ` [PATCH v2] tpm: Fix suspend/shutdown on some boards by preserving chip Locality Adam Alves
2024-03-08 9:33 ` Paul Menzel
2024-03-08 14:22 ` Adam Alves
2024-03-08 14:53 ` [PATCH v3] " Adam Alves
2024-03-11 20:04 ` [PATCH v2] " Jarkko Sakkinen
2024-03-13 17:02 ` Adam Alves
2024-03-14 16:31 ` Adam Alves
2024-03-14 16:32 ` Adam Alves
2024-03-19 20:07 ` Jarkko Sakkinen
2024-03-19 19:57 ` Jarkko Sakkinen
2024-03-19 21:38 ` Jarkko Sakkinen
2024-03-19 21:41 ` Jarkko Sakkinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CZNS5B6JRFLS.28TOPENHJIKCQ@kernel.org \
--to=jarkko@kernel.org \
--cc=adamoa@gmail.com \
--cc=jgg@ziepe.ca \
--cc=linux-integrity@vger.kernel.org \
--cc=peterhuewe@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).