linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tyler Hicks <tyhicks@linux.microsoft.com>
To: Allen Pais <allen.lkml@gmail.com>
Cc: jens.wiklander@linaro.org, zajec5@gmail.com,
	bcm-kernel-feedback-list@broadcom.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, op-tee@lists.trustedfirmware.org,
	Allen Pais <apais@linux.microsoft.com>
Subject: Re: [PATCH v2 2/2] firmware: tee_bnxt: implement shutdown method to handle kexec reboots
Date: Thu, 18 Mar 2021 15:55:36 -0500	[thread overview]
Message-ID: <20210318205536.GB6446@sequoia> (raw)
In-Reply-To: <20210225090610.242623-3-allen.lkml@gmail.com>

On 2021-02-25 14:36:10, Allen Pais wrote:
> From: Allen Pais <apais@linux.microsoft.com>
> 
>  On kexec reboot the firmware driver fails to deallocate
> shm memory leading to a memory leak. Implement .shutdown()
> method to handle kexec reboots and to release shm buffers
> correctly.
> 
> Signed-off-by: Allen Pais <apais@linux.microsoft.com>

Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>

Tyler

> ---
>  drivers/firmware/broadcom/tee_bnxt_fw.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/firmware/broadcom/tee_bnxt_fw.c b/drivers/firmware/broadcom/tee_bnxt_fw.c
> index ed10da5313e8..4c62e044a99f 100644
> --- a/drivers/firmware/broadcom/tee_bnxt_fw.c
> +++ b/drivers/firmware/broadcom/tee_bnxt_fw.c
> @@ -242,6 +242,14 @@ static int tee_bnxt_fw_remove(struct device *dev)
>  	return 0;
>  }
>  
> +static void tee_bnxt_fw_shutdown(struct device *dev)
> +{
> +	tee_shm_free(pvt_data.fw_shm_pool);
> +	tee_client_close_session(pvt_data.ctx, pvt_data.session_id);
> +	tee_client_close_context(pvt_data.ctx);
> +	pvt_data.ctx = NULL;
> +}
> +
>  static const struct tee_client_device_id tee_bnxt_fw_id_table[] = {
>  	{UUID_INIT(0x6272636D, 0x2019, 0x0716,
>  		    0x42, 0x43, 0x4D, 0x5F, 0x53, 0x43, 0x48, 0x49)},
> @@ -257,6 +265,7 @@ static struct tee_client_driver tee_bnxt_fw_driver = {
>  		.bus		= &tee_bus_type,
>  		.probe		= tee_bnxt_fw_probe,
>  		.remove		= tee_bnxt_fw_remove,
> +		.shutdown	= tee_bnxt_fw_shutdown,
>  	},
>  };
>  
> -- 
> 2.25.1
> 

  reply	other threads:[~2021-03-18 20:56 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-25  9:06 [PATCH v2 0/2] optee: fix OOM seen due to tee_shm_free() Allen Pais
2021-02-25  9:06 ` [PATCH v2 1/2] optee: fix tee out of memory failure seen during kexec reboot Allen Pais
2021-03-01 14:35   ` Jens Wiklander
2021-03-02  5:51     ` Allen Pais
2021-03-16 13:21     ` Allen Pais
2021-03-19  7:00       ` Jens Wiklander
2021-03-22  7:59         ` Allen Pais
2021-05-05 13:45         ` Allen Pais
2021-05-06  7:02           ` Jens Wiklander
2021-05-06  7:10             ` Allen Pais
2021-05-06  7:19               ` Jens Wiklander
2021-05-06  7:29                 ` Allen Pais
2021-05-06  8:15                   ` Jens Wiklander
2021-05-06  8:35                     ` Allen Pais
2021-05-07  7:03                     ` Allen Pais
2021-03-18 20:51   ` Tyler Hicks
2021-02-25  9:06 ` [PATCH v2 2/2] firmware: tee_bnxt: implement shutdown method to handle kexec reboots Allen Pais
2021-03-18 20:55   ` Tyler Hicks [this message]
2021-05-07  3:58 ` [PATCH] optee: Disable shm cache when booting the crash kernel Tyler Hicks
2021-05-07  7:00   ` Allen Pais
2021-05-07  9:23     ` Jens Wiklander
2021-05-07  9:32       ` Allen Pais
2021-05-07 13:17       ` Tyler Hicks
2021-05-10  7:31         ` Jens Wiklander
2021-05-12  0:23           ` Tyler Hicks
2021-05-12  5:50             ` Jens Wiklander
2021-05-17 20:24               ` Tyler Hicks
2021-05-17 20:31   ` Tyler Hicks

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=20210318205536.GB6446@sequoia \
    --to=tyhicks@linux.microsoft.com \
    --cc=allen.lkml@gmail.com \
    --cc=apais@linux.microsoft.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=jens.wiklander@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=op-tee@lists.trustedfirmware.org \
    --cc=zajec5@gmail.com \
    --subject='Re: [PATCH v2 2/2] firmware: tee_bnxt: implement shutdown method to handle kexec reboots' \
    /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

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).