[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210318205536.GB6446@sequoia>
Date: Thu, 18 Mar 2021 15:55:36 -0500
From: Tyler Hicks <tyhicks@...ux.microsoft.com>
To: Allen Pais <allen.lkml@...il.com>
Cc: jens.wiklander@...aro.org, zajec5@...il.com,
bcm-kernel-feedback-list@...adcom.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
op-tee@...ts.trustedfirmware.org,
Allen Pais <apais@...ux.microsoft.com>
Subject: Re: [PATCH v2 2/2] firmware: tee_bnxt: implement shutdown method to
handle kexec reboots
On 2021-02-25 14:36:10, Allen Pais wrote:
> From: Allen Pais <apais@...ux.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@...ux.microsoft.com>
Reviewed-by: Tyler Hicks <tyhicks@...ux.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
>
Powered by blists - more mailing lists