Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp880649pxf; Thu, 18 Mar 2021 13:58:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyputw4xVBAQkDaWExwI5gciS71G9bYQFg3UemzSVKjc+makle0iimE2uhtYASawR7vmkYs X-Received: by 2002:a17:906:94ca:: with SMTP id d10mr496592ejy.107.1616101080669; Thu, 18 Mar 2021 13:58:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616101080; cv=none; d=google.com; s=arc-20160816; b=PCuv+jzBiS4JHYC2S8iL0sQkTnBvU5QAwhnOM08PDPBxW9QePUVt/VULFURI5Pmyac eCUdNQy3nremO2XJRjGNor1puyN7V8yljnkQjEieyN641EogwmTtJgn8u2mjyISmpmb/ 6hGUeXyrHv8W8VciUuW1FcHYiV+Adut3e6NFfgNs77fdU+GsUDZ+ZYQLmqXW5ssmMxbj i/qdkosbsXKMlLAbvyaJFl64qlJDtcyu66admJDOo7bWfww7EKyI0Aoyf6g1KvTvWFzR GQe2xmPr5BbsB/iT+BMryiVE3QC48rKpoQKG2a5lcE+RR5F7E0Du6qx2wdXGBVFnjC85 NlRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-filter; bh=vyX3MN32roIAb9I2amriuS+k9RGUN7SP2o/4is7afTA=; b=fhYcQQymZPTiDXH5tF4MwUDrvj3JftQ8m9INDblJasG2gbuJPyYwfWPOT6p+xxpzq4 UKZYWyjQeG/mFdB6e4d7h9JEAr1y70koCbSZEzK1pG2YHUJ4+gp1qT1GtfkBy3d9WYs+ QPl0mhCxN0hUu8LD5mn0uaJyv5AiHjA+pU9qSnVLnORfKqPqDX/8kQl1XWLOILJOetzk LB0Snaki0LaX/OKNo5EG9BZY6bZPp5dt9+/myoJLJHiCeTYrkbKm9bnkACQmpI9LQLDR hsuIcfFJzvTyX7WU6XHQtW0LXTw+rvPzmEfOJAtdBXW3nL+kAA/E9cGTnakuMSDe7qNS v/ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=Jlgiy7Uk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a29si2706795edb.437.2021.03.18.13.57.37; Thu, 18 Mar 2021 13:58:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=Jlgiy7Uk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232958AbhCRU4L (ORCPT + 99 others); Thu, 18 Mar 2021 16:56:11 -0400 Received: from linux.microsoft.com ([13.77.154.182]:49890 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231501AbhCRUzj (ORCPT ); Thu, 18 Mar 2021 16:55:39 -0400 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210225090610.242623-3-allen.lkml@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 >