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=-18.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT 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 46E0CC433E0 for ; Thu, 25 Feb 2021 09:08:04 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 D97B364F13 for ; Thu, 25 Feb 2021 09:08:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D97B364F13 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=slhgE+YRpHb3wky2/SjfAUX5ZOgh+GrKxbMuoP9QkVk=; b=XCwU+WU9/wVNGv5l6swQCCyke DPpXlFJjoMj21IBe5kA3t7fOYU4ydBVBkjdDMgf+Nv/a/fl2+q7avyg5UcyIpM3SwBh2OrnOGRPwR st+aWXBeoq7Ds1hXQjlT1y34olmeEkc1rcA/mc8ycLatN1eBwIRTLe0xsd6limQIEV30A3I7WS3fy u/6ewu+sHsu8eokJ2tvGsgL1sUl0DiAul39+zFI3jQIw0a/W2QaeJLTKpimMTLrg8ciaKwa5FpovE FAiWH/4W8bDDdrUpaycW1Nxd/Ftrothwd2eaqK4pLDh4nyRzQ4gbcnUcD3nSDYlD88Nca6a8MjB/c sCSv1Vp7g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFCbX-0003lP-Kf; Thu, 25 Feb 2021 09:06:39 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFCbS-0003jh-NC for linux-arm-kernel@lists.infradead.org; Thu, 25 Feb 2021 09:06:36 +0000 Received: by mail-pf1-x433.google.com with SMTP id q20so3177080pfu.8 for ; Thu, 25 Feb 2021 01:06:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7oTUgWWdsDaun/nhLkz8THldhf/BUoF8aFanx1A5q08=; b=u0xk/at+ZtV2khvMxKfg/zP8LeL19xpqF0Xd5cWwVG8yoHARHKPEqsTiTnyEo6I1O7 NkC3kQ7dTtzUKk4vecHpwHKT1eszAEOpHA0JG22D5mF/yEs5sBqP/0Z2B3fh1zxzFeZw O6HsRtmOswKjNLckzz3ryGM/o13LgHMDpOs6jbOBDMV+SLSWYJ0/Ukr6NZ1AuW7JeuJt S9cM8HnM5rGAlrQ4JHw11trpx2Y+bjEx1lZqTM+HYQUAYgA9PAlON2sMKjG/tRYNd+X2 g9xP79hWAGy8+Ben5MkmjZe/vZ5WyT/sMzfhLCZ550C+oHmNT3GcVG0Fxl6k26dTh495 zsqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7oTUgWWdsDaun/nhLkz8THldhf/BUoF8aFanx1A5q08=; b=W0yG1U5ntHMc+XXFbhr5bCLmsFNZCCJZluKr3IO1mhAFee5VMjHj5yfnJ8NDQ0ROJG a3q6CJsmjEl1eDqWE4gpo64XlZgouhSO1oIfdEsnkBQnHcDJvQ9iDla/fnMtZarD8Yc7 RwbDPqWm/NecaOfYFXahHNoy/bbU5O9faWTGlU5i+md9No0efyuFmExbtXPqONvKiyjc OxI3GFvJv3t9E4fp9IotSZCYV4gyBdL1ipTwCHWUpDp8y7wDO85tVC/OqT7XINj8E7dT 9bPf9R+6ItnxbyQVxZ2tV8vykd7xYXsewjWQFYplrvhKVOlhwMvzw8fdGAYWOxvexuKr vfwg== X-Gm-Message-State: AOAM531ES7gyEETp/xTPLzNXAO25r1l+ZBvvVSWwo1FHNMJAoGEDU43Y ZVH4fiLGCuvJpykFZN0aMbA= X-Google-Smtp-Source: ABdhPJzMWkMeFQSn2LCxVvarxP+/8wbrRzI/vAosKX9EfFFQv/D/yZ8qn7MiuSgNIm6m71H4uskFrg== X-Received: by 2002:a05:6a00:ac8:b029:1ed:f8dc:cb3b with SMTP id c8-20020a056a000ac8b02901edf8dccb3bmr2350632pfl.60.1614243992361; Thu, 25 Feb 2021 01:06:32 -0800 (PST) Received: from localhost.localdomain ([49.207.194.79]) by smtp.gmail.com with ESMTPSA id n11sm5098373pgm.30.2021.02.25.01.06.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Feb 2021 01:06:31 -0800 (PST) From: Allen Pais To: jens.wiklander@linaro.org, zajec5@gmail.com Subject: [PATCH v2 1/2] optee: fix tee out of memory failure seen during kexec reboot Date: Thu, 25 Feb 2021 14:36:09 +0530 Message-Id: <20210225090610.242623-2-allen.lkml@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210225090610.242623-1-allen.lkml@gmail.com> References: <20210225090610.242623-1-allen.lkml@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210225_040634_898791_9F56C68E X-CRM114-Status: GOOD ( 17.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Allen Pais , op-tee@lists.trustedfirmware.org, bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 From: Allen Pais The following out of memory errors are seen on kexec reboot from the optee core. [ 0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed [ 0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22 tee_shm_release() is not invoked on dma shm buffer. Implement .shutdown() method to handle the release of the buffers correctly. More info: https://github.com/OP-TEE/optee_os/issues/3637 Signed-off-by: Allen Pais --- drivers/tee/optee/core.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c index cf4718c6d35d..80e2774b5e2a 100644 --- a/drivers/tee/optee/core.c +++ b/drivers/tee/optee/core.c @@ -582,6 +582,13 @@ static optee_invoke_fn *get_invoke_func(struct device *dev) return ERR_PTR(-EINVAL); } +/* optee_remove - Device Removal Routine + * @pdev: platform device information struct + * + * optee_remove is called by platform subsystem to alter the driver + * that it should release the device + */ + static int optee_remove(struct platform_device *pdev) { struct optee *optee = platform_get_drvdata(pdev); @@ -612,6 +619,18 @@ static int optee_remove(struct platform_device *pdev) return 0; } +/* optee_shutdown - Device Removal Routine + * @pdev: platform device information struct + * + * platform_shutdown is called by the platform subsystem to alter + * the driver that a shutdown/reboot(or kexec) is happening and + * device must be disabled. + */ +static void optee_shutdown(struct platform_device *pdev) +{ + optee_disable_shm_cache(platform_get_drvdata(pdev)); +} + static int optee_probe(struct platform_device *pdev) { optee_invoke_fn *invoke_fn; @@ -738,6 +757,7 @@ MODULE_DEVICE_TABLE(of, optee_dt_match); static struct platform_driver optee_driver = { .probe = optee_probe, .remove = optee_remove, + .shutdown = optee_shutdown, .driver = { .name = "optee", .of_match_table = optee_dt_match, -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel