From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A198C433E0 for ; Thu, 18 Mar 2021 20:57:34 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BD79264EFD for ; Thu, 18 Mar 2021 20:57:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BD79264EFD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Q/nLHmn4EfGT5rV/MhUMCEHpQ19hFzU6/Ypi4jRFjiw=; b=JedSmpQ59QGeYfbDy8op2DDv8 hyhkIV1yJHgVR6FXt7gEVJrId7youYCPwMBpSHRuepYkmCvsawkMMKuvIV2I+iTUlkqxMEGQ2ONNX L+ON40P3NKwFgpTOTOFmm4WWgUk4l2s9l7GqHplPLi+elSjJYhzcroPH/ZJVfjcSqmd+dLxHDyu9j fm/zIblti0A4STB+Oixe68MmlCvrNNNKlqpI4q+0gSmhW2BG/106TPWdbe2XY1iIRRVKWGGyrFCm8 wMwXuin8zCQyrQcJhQB8/rl1u8jZ9J5oKuSuMeqCZ2indAwOloANNmG0niYHdkmdH+Qly7xLnwzfh Z5W/AxSzA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lMzgF-0060y2-Ts; Thu, 18 Mar 2021 20:55:45 +0000 Received: from linux.microsoft.com ([13.77.154.182]) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lMzgB-0060xA-IU for linux-arm-kernel@lists.infradead.org; Thu, 18 Mar 2021 20:55:41 +0000 Received: from sequoia (162-237-133-238.lightspeed.rcsntx.sbcglobal.net [162.237.133.238]) by linux.microsoft.com (Postfix) with ESMTPSA id 55B36209C384; Thu, 18 Mar 2021 13:55:38 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 55B36209C384 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1616100938; bh=vyX3MN32roIAb9I2amriuS+k9RGUN7SP2o/4is7afTA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Jlgiy7UkXKsEcCphJLcZ8pmcv/1I6OASqWSOtkMDAvpJM5nn9q6B90uFX4iffLg3j sFzNUwG6F1XKYKUiB3RVk7vAIB5SB4SL6PUDVv5xHtr2wZhT8IaYIN+PGm46kadyE4 RU5mGYnTubFB8ESNyqX89XZ37AQafsu1n1i2aE6g= Date: Thu, 18 Mar 2021 15:55:36 -0500 From: Tyler Hicks To: Allen Pais 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 Subject: Re: [PATCH v2 2/2] firmware: tee_bnxt: implement shutdown method to handle kexec reboots Message-ID: <20210318205536.GB6446@sequoia> References: <20210225090610.242623-1-allen.lkml@gmail.com> <20210225090610.242623-3-allen.lkml@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210225090610.242623-3-allen.lkml@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210318_205539_866638_11F1C892 X-CRM114-Status: GOOD ( 17.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2021-02-25 14:36:10, Allen Pais wrote: > From: Allen Pais > > 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 Reviewed-by: Tyler Hicks 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 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel