* [PATCH] ftpm: add shutdown call back
@ 2019-10-11 14:57 Pavel Tatashin
2019-10-14 20:03 ` Jarkko Sakkinen
0 siblings, 1 reply; 3+ messages in thread
From: Pavel Tatashin @ 2019-10-11 14:57 UTC (permalink / raw)
To: pasha.tatashin, jmorris, sashal, peterhuewe, jarkko.sakkinen,
jgg, linux-kernel, linux-doc, linux-integrity, linux-kernel,
thiruan, bryankel, tee-dev, ilias.apalodimas, sumit.garg,
rdunlap
From: thiruan <thiruan@microsoft.com>
add shutdown call back to close existing session with fTPM TA
to support kexec scenario.
Signed-off-by: Thirupathaiah Annapureddy <thiruan@microsoft.com>
Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com>
---
drivers/char/tpm/tpm_ftpm_tee.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c
index 6640a14dbe48..c245be6f4015 100644
--- a/drivers/char/tpm/tpm_ftpm_tee.c
+++ b/drivers/char/tpm/tpm_ftpm_tee.c
@@ -328,6 +328,27 @@ static int ftpm_tee_remove(struct platform_device *pdev)
return 0;
}
+/**
+ * ftpm_tee_shutdown - shutdown the TPM device
+ * @pdev: the platform_device description.
+ *
+ * Return:
+ * none.
+ */
+static void ftpm_tee_shutdown(struct platform_device *pdev)
+{
+ struct ftpm_tee_private *pvt_data = dev_get_drvdata(&pdev->dev);
+
+ /* Free the shared memory pool */
+ tee_shm_free(pvt_data->shm);
+
+ /* close the existing session with fTPM TA*/
+ tee_client_close_session(pvt_data->ctx, pvt_data->session);
+
+ /* close the context with TEE driver */
+ tee_client_close_context(pvt_data->ctx);
+}
+
static const struct of_device_id of_ftpm_tee_ids[] = {
{ .compatible = "microsoft,ftpm" },
{ }
@@ -341,6 +362,7 @@ static struct platform_driver ftpm_tee_driver = {
},
.probe = ftpm_tee_probe,
.remove = ftpm_tee_remove,
+ .shutdown = ftpm_tee_shutdown,
};
module_platform_driver(ftpm_tee_driver);
--
2.23.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ftpm: add shutdown call back
2019-10-11 14:57 [PATCH] ftpm: add shutdown call back Pavel Tatashin
@ 2019-10-14 20:03 ` Jarkko Sakkinen
2019-10-14 20:17 ` Pavel Tatashin
0 siblings, 1 reply; 3+ messages in thread
From: Jarkko Sakkinen @ 2019-10-14 20:03 UTC (permalink / raw)
To: Pavel Tatashin
Cc: jmorris, sashal, peterhuewe, jgg, linux-kernel, linux-doc,
linux-integrity, linux-kernel, thiruan, bryankel, tee-dev,
ilias.apalodimas, sumit.garg, rdunlap
On Fri, Oct 11, 2019 at 10:57:21AM -0400, Pavel Tatashin wrote:
> From: thiruan <thiruan@microsoft.com>
>
> add shutdown call back to close existing session with fTPM TA
> to support kexec scenario.
>
> Signed-off-by: Thirupathaiah Annapureddy <thiruan@microsoft.com>
> Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com>
Use the correct tag in the short summary (tpm/tpm_ftpm_tee).
> ---
> drivers/char/tpm/tpm_ftpm_tee.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c
> index 6640a14dbe48..c245be6f4015 100644
> --- a/drivers/char/tpm/tpm_ftpm_tee.c
> +++ b/drivers/char/tpm/tpm_ftpm_tee.c
> @@ -328,6 +328,27 @@ static int ftpm_tee_remove(struct platform_device *pdev)
> return 0;
> }
>
> +/**
> + * ftpm_tee_shutdown - shutdown the TPM device
> + * @pdev: the platform_device description.
> + *
> + * Return:
> + * none.
Do not document return values for a void function. The last three lines
do not serve any purpose.
> + */
> +static void ftpm_tee_shutdown(struct platform_device *pdev)
> +{
> + struct ftpm_tee_private *pvt_data = dev_get_drvdata(&pdev->dev);
> +
> + /* Free the shared memory pool */
> + tee_shm_free(pvt_data->shm);
Is it unexpected that calling tee_shm_free() free's a shared memory
pool? A comment here implies exactly that.
> + /* close the existing session with fTPM TA*/
> + tee_client_close_session(pvt_data->ctx, pvt_data->session);
Ditto.
> +
> + /* close the context with TEE driver */
> + tee_client_close_context(pvt_data->ctx);
Ditto.
> +}
> +
> static const struct of_device_id of_ftpm_tee_ids[] = {
> { .compatible = "microsoft,ftpm" },
> { }
> @@ -341,6 +362,7 @@ static struct platform_driver ftpm_tee_driver = {
> },
> .probe = ftpm_tee_probe,
> .remove = ftpm_tee_remove,
> + .shutdown = ftpm_tee_shutdown,
> };
>
> module_platform_driver(ftpm_tee_driver);
> --
> 2.23.0
>
/Jarkko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ftpm: add shutdown call back
2019-10-14 20:03 ` Jarkko Sakkinen
@ 2019-10-14 20:17 ` Pavel Tatashin
0 siblings, 0 replies; 3+ messages in thread
From: Pavel Tatashin @ 2019-10-14 20:17 UTC (permalink / raw)
To: Jarkko Sakkinen
Cc: James Morris, Sasha Levin, peterhuewe, jgg, LKML,
Linux Doc Mailing List, linux-integrity, linux-kernel, thiruan,
bryankel, tee-dev, ilias.apalodimas, sumit.garg, rdunlap
On Mon, Oct 14, 2019 at 4:03 PM Jarkko Sakkinen
<jarkko.sakkinen@linux.intel.com> wrote:
>
> On Fri, Oct 11, 2019 at 10:57:21AM -0400, Pavel Tatashin wrote:
> > From: thiruan <thiruan@microsoft.com>
> >
> > add shutdown call back to close existing session with fTPM TA
> > to support kexec scenario.
> >
> > Signed-off-by: Thirupathaiah Annapureddy <thiruan@microsoft.com>
> > Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com>
>
> Use the correct tag in the short summary (tpm/tpm_ftpm_tee).
Hi Jarkko,
Thanks, I will address your comments and send out a new patch soon.
Pasha
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-14 20:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-11 14:57 [PATCH] ftpm: add shutdown call back Pavel Tatashin
2019-10-14 20:03 ` Jarkko Sakkinen
2019-10-14 20:17 ` Pavel Tatashin
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).