From: Andrey Pronin <apronin@chromium.org> To: Peter Huewe <peterhuewe@gmx.de>, Marcel Selhorst <tpmdd@selhorst.net>, Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Cc: Andrey Pronin <apronin@chromium.org>, Jason Gunthorpe <jgunthorpe@obsidianresearch.com>, tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, semenzato@chromium.org, groeck@chromium.org Subject: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown Date: Fri, 13 Jan 2017 16:09:54 -0800 [thread overview] Message-ID: <20170114000954.17728-1-apronin@chromium.org> (raw) Resetting TPM while processing a command may lead to issues on the next boot. Ensure that we don't have any ongoing commands, and that no further commands can be sent to the chip by unregistering the device in the shutdown handler. tpm_chip_unregister() waits for the completion of an ongoing command, if any, and then clears out chip->ops and unregisters sysfs entities. Signed-off-by: Andrey Pronin <apronin@chromium.org> --- drivers/char/tpm/tpm_i2c_infineon.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c index 62ee44e57ddc..0c829fe26561 100644 --- a/drivers/char/tpm/tpm_i2c_infineon.c +++ b/drivers/char/tpm/tpm_i2c_infineon.c @@ -689,14 +689,18 @@ static int tpm_tis_i2c_probe(struct i2c_client *client, return rc; } -static int tpm_tis_i2c_remove(struct i2c_client *client) +static void tpm_tis_i2c_shutdown(struct i2c_client *client) { struct tpm_chip *chip = tpm_dev.chip; tpm_chip_unregister(chip); release_locality(chip, tpm_dev.locality, 1); tpm_dev.client = NULL; +} +static int tpm_tis_i2c_remove(struct i2c_client *client) +{ + tpm_tis_i2c_shutdown(client); return 0; } @@ -704,6 +708,7 @@ static struct i2c_driver tpm_tis_i2c_driver = { .id_table = tpm_tis_i2c_table, .probe = tpm_tis_i2c_probe, .remove = tpm_tis_i2c_remove, + .shutdown = tpm_tis_i2c_shutdown, .driver = { .name = "tpm_i2c_infineon", .pm = &tpm_tis_i2c_ops, -- 2.11.0.483.g087da7b7c-goog
WARNING: multiple messages have this Message-ID (diff)
From: Andrey Pronin <apronin-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> To: Peter Huewe <peterhuewe-Mmb7MZpHnFY@public.gmane.org>, Marcel Selhorst <tpmdd-yWjUBOtONefk1uMJSBkQmQ@public.gmane.org>, Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, semenzato-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, groeck-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org Subject: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown Date: Fri, 13 Jan 2017 16:09:54 -0800 [thread overview] Message-ID: <20170114000954.17728-1-apronin@chromium.org> (raw) Resetting TPM while processing a command may lead to issues on the next boot. Ensure that we don't have any ongoing commands, and that no further commands can be sent to the chip by unregistering the device in the shutdown handler. tpm_chip_unregister() waits for the completion of an ongoing command, if any, and then clears out chip->ops and unregisters sysfs entities. Signed-off-by: Andrey Pronin <apronin-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> --- drivers/char/tpm/tpm_i2c_infineon.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c index 62ee44e57ddc..0c829fe26561 100644 --- a/drivers/char/tpm/tpm_i2c_infineon.c +++ b/drivers/char/tpm/tpm_i2c_infineon.c @@ -689,14 +689,18 @@ static int tpm_tis_i2c_probe(struct i2c_client *client, return rc; } -static int tpm_tis_i2c_remove(struct i2c_client *client) +static void tpm_tis_i2c_shutdown(struct i2c_client *client) { struct tpm_chip *chip = tpm_dev.chip; tpm_chip_unregister(chip); release_locality(chip, tpm_dev.locality, 1); tpm_dev.client = NULL; +} +static int tpm_tis_i2c_remove(struct i2c_client *client) +{ + tpm_tis_i2c_shutdown(client); return 0; } @@ -704,6 +708,7 @@ static struct i2c_driver tpm_tis_i2c_driver = { .id_table = tpm_tis_i2c_table, .probe = tpm_tis_i2c_probe, .remove = tpm_tis_i2c_remove, + .shutdown = tpm_tis_i2c_shutdown, .driver = { .name = "tpm_i2c_infineon", .pm = &tpm_tis_i2c_ops, -- 2.11.0.483.g087da7b7c-goog ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi
next reply other threads:[~2017-01-14 0:09 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-01-14 0:09 Andrey Pronin [this message] 2017-01-14 0:09 ` [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown Andrey Pronin 2017-01-14 0:28 ` Jason Gunthorpe 2017-01-14 0:28 ` Jason Gunthorpe 2017-01-14 0:42 ` Andrey Pronin 2017-01-16 9:33 ` Jarkko Sakkinen 2017-01-25 18:59 ` [tpmdd-devel] " Jarkko Sakkinen 2017-01-16 16:19 ` Jason Gunthorpe 2017-01-17 17:58 ` Andrey Pronin 2017-01-17 17:58 ` Andrey Pronin 2017-01-17 19:27 ` Jason Gunthorpe 2017-01-17 19:27 ` Jason Gunthorpe 2017-01-17 20:13 ` Andrey Pronin 2017-01-17 20:13 ` Andrey Pronin 2017-01-17 20:59 ` Jason Gunthorpe 2017-01-17 20:59 ` Jason Gunthorpe 2017-01-17 23:00 ` Andrey Pronin 2017-01-17 23:00 ` Andrey Pronin 2017-01-17 23:22 ` Jason Gunthorpe 2017-01-17 23:22 ` Jason Gunthorpe 2017-01-23 20:02 ` Andrey Pronin 2017-01-23 20:02 ` Andrey Pronin 2017-01-23 20:16 ` [tpmdd-devel] " Andrey Pronin 2017-01-23 20:39 ` Jason Gunthorpe 2017-01-23 20:39 ` Jason Gunthorpe 2017-01-23 22:19 ` Andrey Pronin 2017-01-23 22:57 ` Jason Gunthorpe 2017-01-23 22:57 ` Jason Gunthorpe
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=20170114000954.17728-1-apronin@chromium.org \ --to=apronin@chromium.org \ --cc=groeck@chromium.org \ --cc=jarkko.sakkinen@linux.intel.com \ --cc=jgunthorpe@obsidianresearch.com \ --cc=linux-kernel@vger.kernel.org \ --cc=peterhuewe@gmx.de \ --cc=semenzato@chromium.org \ --cc=tpmdd-devel@lists.sourceforge.net \ --cc=tpmdd@selhorst.net \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.