Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1772009ybl; Sat, 11 Jan 2020 02:30:35 -0800 (PST) X-Google-Smtp-Source: APXvYqzQIQtQlOeMS2kLpFwPDAhfO+Qtj9wY79CWFu0qpO0KeSiEJ34DUBU//32+epQp5R7o0p4D X-Received: by 2002:a05:6830:14d9:: with SMTP id t25mr6559649otq.258.1578738635805; Sat, 11 Jan 2020 02:30:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578738635; cv=none; d=google.com; s=arc-20160816; b=Tsx4JnMtQG4vwC4XiWOlz3mZ+mBs+b6egdWOYA1N4ohBUpYY3+WDYjsXewW4mZK93u 3Nt594JvVHl59eYIJ8Auc4i2+pMQOPvbsjQs8uGYjUc9BRRuIV6sQP0pZCK2+qMscI3Z lkk8WEVhhC66fITCKGVsmoJET44bfbnM5zvST7e2KsyOG9aZIU6CyPvmtNagfDDm6Ven kMx39kRvVskRbhkYNd6AhGi1RUARaGIC0yEb5MSgEMPWpXgf8ysFJEYgKgQVWKQiF4x3 UZLBECikGQuXvuwuQndnlXCkyYY5kY3HP5ezKgGSpahFaWAVQjKtGYpCCCKl2q6Ruxxo wu5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6QAPbb6mS7aPNq4SqhuU++2I6Ibr4X5nCE3QM2Qd4vI=; b=w5EuCShchtbBqc0yCZX3qt9Y/GKGjlfjIKabE7Q5JRSiopqqDL5Fef2j1kTlBxMNyU /RggrAN54eLq5B16hSBD5IFxdG/1tSM7W3ySGRpgPkL27K8x8jtxsRylEp5f0xgNQF0o iBEW52+cvccPBgMmQSr1Mh0S1vIqOJzqgqznY2r1hKNgYR2sVSBXauYDheTLvF6Baa+P rWgEOozPjNIBJi2MR9Jy1CgUmNFmDmHvl13uMCs+M3hoMY8ntlm7DYh6WuSL+Yffwj7x 1rKTrWeArJX4iu/+E3IPccVnhLYBoM0MALF2X0yAA12dcXLr8jYqIVQXvud410EhCcxq 2w3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=k802gher; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 25si2690001oiz.230.2020.01.11.02.30.24; Sat, 11 Jan 2020 02:30:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=k802gher; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731247AbgAKK31 (ORCPT + 99 others); Sat, 11 Jan 2020 05:29:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:38558 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729171AbgAKK31 (ORCPT ); Sat, 11 Jan 2020 05:29:27 -0500 Received: from localhost (unknown [62.119.166.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 713F820842; Sat, 11 Jan 2020 10:29:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578738566; bh=w+TK/z6q5eNOhYC/9sUbz1Bb8kYTxNA9IKc3SIJiSLE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k802gherOn40Syrg6Au90Nte7VpxJb5sNCkUg+ER37h48Lmks1e952hriAuMCp2lL acPKcROh/5AYeT6FdnhF+Fo8Ci4Aj4j3/b3LyzKLO768KVt8DXu9etUMfWKaMAubO+ +n52YY/8ISwTAu2zeK4KD8Sc1ROeS9vnQHLWQELs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thirupathaiah Annapureddy , Pavel Tatashin , Jarkko Sakkinen , Sasha Levin Subject: [PATCH 5.4 118/165] tpm/tpm_ftpm_tee: add shutdown call back Date: Sat, 11 Jan 2020 10:50:37 +0100 Message-Id: <20200111094933.053228465@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200111094921.347491861@linuxfoundation.org> References: <20200111094921.347491861@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Tatashin [ Upstream commit 1760eb689ed68c6746744aff2092bff57c78d907 ] Add shutdown call back to close existing session with fTPM TA to support kexec scenario. Add parentheses to function names in comments as specified in kdoc. Signed-off-by: Thirupathaiah Annapureddy Signed-off-by: Pavel Tatashin Reviewed-by: Jarkko Sakkinen Tested-by: Sasha Levin Signed-off-by: Jarkko Sakkinen Signed-off-by: Sasha Levin --- drivers/char/tpm/tpm_ftpm_tee.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c index 6640a14dbe48..22bf553ccf9d 100644 --- a/drivers/char/tpm/tpm_ftpm_tee.c +++ b/drivers/char/tpm/tpm_ftpm_tee.c @@ -32,7 +32,7 @@ static const uuid_t ftpm_ta_uuid = 0x82, 0xCB, 0x34, 0x3F, 0xB7, 0xF3, 0x78, 0x96); /** - * ftpm_tee_tpm_op_recv - retrieve fTPM response. + * ftpm_tee_tpm_op_recv() - retrieve fTPM response. * @chip: the tpm_chip description as specified in driver/char/tpm/tpm.h. * @buf: the buffer to store data. * @count: the number of bytes to read. @@ -61,7 +61,7 @@ static int ftpm_tee_tpm_op_recv(struct tpm_chip *chip, u8 *buf, size_t count) } /** - * ftpm_tee_tpm_op_send - send TPM commands through the TEE shared memory. + * ftpm_tee_tpm_op_send() - send TPM commands through the TEE shared memory. * @chip: the tpm_chip description as specified in driver/char/tpm/tpm.h * @buf: the buffer to send. * @len: the number of bytes to send. @@ -208,7 +208,7 @@ static int ftpm_tee_match(struct tee_ioctl_version_data *ver, const void *data) } /** - * ftpm_tee_probe - initialize the fTPM + * ftpm_tee_probe() - initialize the fTPM * @pdev: the platform_device description. * * Return: @@ -298,7 +298,7 @@ static int ftpm_tee_probe(struct platform_device *pdev) } /** - * ftpm_tee_remove - remove the TPM device + * ftpm_tee_remove() - remove the TPM device * @pdev: the platform_device description. * * Return: @@ -328,6 +328,19 @@ static int ftpm_tee_remove(struct platform_device *pdev) return 0; } +/** + * ftpm_tee_shutdown() - shutdown the TPM device + * @pdev: the platform_device description. + */ +static void ftpm_tee_shutdown(struct platform_device *pdev) +{ + struct ftpm_tee_private *pvt_data = dev_get_drvdata(&pdev->dev); + + tee_shm_free(pvt_data->shm); + tee_client_close_session(pvt_data->ctx, pvt_data->session); + tee_client_close_context(pvt_data->ctx); +} + static const struct of_device_id of_ftpm_tee_ids[] = { { .compatible = "microsoft,ftpm" }, { } @@ -341,6 +354,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.20.1