Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1561144pxb; Mon, 12 Apr 2021 00:38:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjcCkMayEOBPb2MpSkwYLsIvtXzobHaVCgNm4FXhzFdztx4NNFeYiJksrlfz41wFn3G0l1 X-Received: by 2002:a05:6402:3122:: with SMTP id dd2mr27868684edb.253.1618213100109; Mon, 12 Apr 2021 00:38:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618213100; cv=none; d=google.com; s=arc-20160816; b=ZvxTBzSR1zapiom9HVUVg9nnwzUI+7A44L2pm0LTD+vDBj5Wlv3UdUWvuaep3jeFQZ lIVXAzxgn5m0WOZJBvhnb2nxCOGMMiqwiNynqsFt+tDmyPkRcmiDLTEvqPKJZTtZcs3u UblPqmn+C9nVgocJ1qv6EDOKfAxIol4+cg8Q7HxNLJgKTPyhWu7n2STHrVi5dGzTfa2U K3igjdtldV9zvReFEtT7Zw7UbYa6t0WP4Zpw/Fc42+l+NSkIShXWA5mRGNnp9ULTSkwy VHJBlAW5bwkXZKGZ6L08WnyNr+03Jt54HzOu3uUq1hOOUY6wodUjXChlKZ3Kc7k5r1Cp ErfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ObdGU65M/fnAKtrmSC1hHUrnCEDTl7tLsUN7Hou/Kx4=; b=Pt2XtBTzHZShviGi84nNrmrNXDO2BWnbMThHZvGSGtjXmHi5rt8x/bkVPRTIaAwNCT wNyJuEcxd+TXH8v0zY0G0qBi/ZroqZc+2/DYL86PiNUIsIHi6fvdYyl9YwEOsFTFO5Fx YXbiKoV9YHO/Hey4R1xWBpDxa5hL0GeUvH3d60hqQRpPT367g2tdqXgBb0rcng6i+vlM kCTIF5FsZZtSxI+9ckAYlIXR5SnMTD9uPSKqNhQlKmNABkoPlPOw9yMH6dpapCWrixHJ KznsMTm+oSwbRb/wLzl32E18nfpBsQe21eMwUqKmpIH/NmbSCj/e/tO77qlXN69lZbEQ ZmBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yN8W8ckW; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k19si7331400eds.343.2021.04.12.00.37.56; Mon, 12 Apr 2021 00:38:20 -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=@linaro.org header.s=google header.b=yN8W8ckW; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235386AbhDLHhX (ORCPT + 99 others); Mon, 12 Apr 2021 03:37:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230034AbhDLHhW (ORCPT ); Mon, 12 Apr 2021 03:37:22 -0400 Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20CA3C061574 for ; Mon, 12 Apr 2021 00:37:05 -0700 (PDT) Received: by mail-oi1-x22b.google.com with SMTP id d12so12517874oiw.12 for ; Mon, 12 Apr 2021 00:37:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ObdGU65M/fnAKtrmSC1hHUrnCEDTl7tLsUN7Hou/Kx4=; b=yN8W8ckWqJqQfldppJ47OT5b2E4pKRK0BLlhP9fLIJ6osYzKw34KRwccZexV0QgwM1 GArPGikPnzqoRDfbCWlOcQggDwnVl4LBSoOae+jeLMQxWicJ5rRR9vlyv0F60liBnF4o s7FR16D6Enp+X5ouGsncFZhsLMx1FB7+9nTaf8H5K7I6aZFTdQJKvFgk6mqSU8LFTh0G a1XJeCH8+CZnkDvnL8FLWwMi9Gw9Mu58Iq0iQYkmRBRk6EwH3eIPaLUSkZd7xhP8cRam JzTbPreggEOCYI90uhDidgzHErm83HptfmSHtI/CsSLaP2KhDZk+Wl7WccZq4Vfj3Dkx IA1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ObdGU65M/fnAKtrmSC1hHUrnCEDTl7tLsUN7Hou/Kx4=; b=V88MHxAYwWNquAEsXsRTxSX4uzCKU8+oNWZE4z+rfjgoK6paGSQiX2u1OOWbdZNYrN 6K5XaC9dg1j5tzfJ0z2iKTAVcNDOaKonTltwIFTHV1UDAtj1sA2GpIxIqs0lh/CNWBhb cmkJ+bs8P09gg+ZHaz6QD/X/F8FybFEhWvfMU8yDk9QkThMjcJUeNgSKvMhJvWt1eZBu v+VxHr5VmTqZQMvmjgI90RiEkaNJdwfoop2KbAluLa2I9tNH9DvajYoxI+fGgCFnNs0r fdLpYw7FuYjIMWzI4/RqDKnbgNgrVDY2Hki6VYH9MCgdqeFGuCQAdRfFZOM3DoyE6Kca okvw== X-Gm-Message-State: AOAM5333nL71Lu04mPTU6EDWDNRQf13iCvmlyPHOu6ZKTLIwJfAyBtZd sbk5kp2pREB2K/OOuM9tmMJib7+V0a1uD0SQkRqQ9g== X-Received: by 2002:aca:7c4:: with SMTP id 187mr18620213oih.47.1618213024537; Mon, 12 Apr 2021 00:37:04 -0700 (PDT) MIME-Version: 1.0 References: <3150feb19421ca6b15202c853215f8b40fe35567.1617615067.git.Rijo-john.Thomas@amd.com> In-Reply-To: <3150feb19421ca6b15202c853215f8b40fe35567.1617615067.git.Rijo-john.Thomas@amd.com> From: Jens Wiklander Date: Mon, 12 Apr 2021 09:36:53 +0200 Message-ID: Subject: Re: [PATCH v2] tee: amdtee: unload TA only when its refcount becomes 0 To: Rijo Thomas Cc: Dan Carpenter , Devaraj Rangasamy , Mythri Pandeshwara krishna , OP-TEE TrustedFirmware , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 5, 2021 at 11:43 AM Rijo Thomas wrote: > > Same Trusted Application (TA) can be loaded in multiple TEE contexts. > > If it is a single instance TA, the TA should not get unloaded from AMD > Secure Processor, while it is still in use in another TEE context. > > Therefore reference count TA and unload it when the count becomes zero. > > Fixes: 757cc3e9ff1d ("tee: add AMD-TEE driver") > Reviewed-by: Devaraj Rangasamy > Signed-off-by: Rijo Thomas > --- > v2: > * Unload TA if get_ta_refcount() fails > > drivers/tee/amdtee/amdtee_private.h | 13 ++++ > drivers/tee/amdtee/call.c | 94 ++++++++++++++++++++++++++--- > drivers/tee/amdtee/core.c | 15 +++-- > 3 files changed, 106 insertions(+), 16 deletions(-) Looks good to me. Please address Dan's comment. Cheers, Jens