Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp137184pxb; Wed, 14 Apr 2021 11:14:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2gLnymkFdnkUMqzrEBmTeYco1wLcE62d8rG6qcv2j8gpt3igYZDw0mFPAxlS9i3Cn4c88 X-Received: by 2002:a63:544e:: with SMTP id e14mr40352326pgm.288.1618424092859; Wed, 14 Apr 2021 11:14:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1618424092; cv=pass; d=google.com; s=arc-20160816; b=pppMbZ+uOnrzVEfcUcmYGBMMn2zyy/C/CzLkkfI5YAVbqmpRdGFa9dGaUB7oHEz0Ov dc+RSZ8idVPaR0hra7yj8jcQnWFLf6KuK6Ga6oTIn3Oh1p+uef21PW46mMGQHqRwBe9f f37xD0s9VgC5M5a6GixU5TLum2zaKsH1HCYki/Gp5f5yUNXRWsFo2iLKmITJyz9/mXbx KNYwQeMWPsqlPXLR65KG4aaCSkxLdMbsVqgYZcQ/bBoSnuVaW9zQsCkvayqY/xj5r3J4 eagAMmgDdhxlu7ZkjgYCeZTs8GsayXql++mxv3As4mdKMbiUubfTjxXNKu0Rz+Ej4Fsz PBCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:in-reply-to:user-agent:date:message-id:from :references:cc:to:subject:dkim-signature; bh=hgZv9M5b5lNJj3nKi57t+5/5MoOKX0fCxzwS8n+M0D0=; b=zS8NB5p/TSK3O2zN6zuDFQPcPsWL9rur7y0cRVPQo1kmznK5t0fRDqMpSGp92rVmbl PP97x3h2n+I2NGh0GeUAA8EqFdNyMR/EWqpS/7ixdcAUatrd5E8j62mw7zUtvouQy6/S yqOylUs1zrm0N2+HCdSRyfmdCVITthA6sxz2p8lTSwiW+gLINZnrXQkvSwcZn1BdSYZ4 cuXJDcMpQdJCuHFf77fndZnZUqlvky5vB76qriGFxPMu2rw8AQoQauCXIfIQo6SW8cgq UTWV8Eoq1cHKRUgMOHZlXc+o2Z+aQjTONsz3YaD+aOkFXEGml0JMTYljuR7cygNL1idX K+wA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=H0RsRp5D; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); 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=amd.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h11si349902pju.133.2021.04.14.11.14.41; Wed, 14 Apr 2021 11:14:52 -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=@amd.com header.s=selector1 header.b=H0RsRp5D; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); 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=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351083AbhDNRiA (ORCPT + 99 others); Wed, 14 Apr 2021 13:38:00 -0400 Received: from mail-bn7nam10on2059.outbound.protection.outlook.com ([40.107.92.59]:36673 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1350752AbhDNRh7 (ORCPT ); Wed, 14 Apr 2021 13:37:59 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X7PR5xWJlerZ6ls5FfqgqdDe6cy4tzurKxikvjbxhPP0l7XvnUsFMAWzhqba8Uqa69s77VnOhGb/oHS8u1h9+dkfFA6/HYKSBcopnWBwx7EvfzAf3leL7UyCmHRjcXDZWsO5j9LM/0mSV0Wrm4982SPb3yaDf3y8u/wSNMcH83dvuRp0gVvw+eEmKZznDizIIhFC5wk4273GuXitxjJYOdcu30Iufmcun8YK4ejNd29FrhdyQZxJ6qwRQOTNJdwuf4wgFU5gjIvYSmJAr+6j35yVX5fE9cZtKPTgsjgs0hvCo93zCAWc2n931tUwBDShUEQpU7X4yAaUjWE9raLAkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hgZv9M5b5lNJj3nKi57t+5/5MoOKX0fCxzwS8n+M0D0=; b=SwIpR1oyDNOAsHNbieGVjqTjEnUJYM7MaqfYdcWBPCpVBs2OY+wyW0wH/b/OtMumjhV7AAVo7CF92V4ctQZCeR555zCyQVsVHPe4K3E1qIacLO6omHXMFLJnlaaNb9qkI8pXH1uzU3KfFpGfg5WCICs1wZXk4wdXdMWBLNaxqSnhuBLK2KlWTY2iHBPMAMGgZKeaSJiAF6OxvakjnD4ABpS1w+GnzieBnW+l+ucWGW8+RbTqFJTSWOKrRxkMgeDSJQGKOg9CqdYp+8OWC4t97SZv0S3CwRyhM6bPFq98YEZu9AD1pNPP1f5zKY+XOfAxT09nLHfXFCn5zMCb4ePVwg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hgZv9M5b5lNJj3nKi57t+5/5MoOKX0fCxzwS8n+M0D0=; b=H0RsRp5D207vcf3Vrv9ZsB48urhSusjgPHKQnX+UVNYK1sNG8JQGa3eqiTS+nlvZXyWXzbbehs4WeF38uJBJdNCHtMRWfB/TfCsapq1R8PtofoJtN1zC4Chsy7xPM5jw/CeJj64Zqsu6ZMFYvwl5niEiAig7lA3okbIo+vUnCss= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB4719.namprd12.prod.outlook.com (2603:10b6:805:e9::25) by SN1PR12MB2350.namprd12.prod.outlook.com (2603:10b6:802:24::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27; Wed, 14 Apr 2021 17:37:35 +0000 Received: from SN6PR12MB4719.namprd12.prod.outlook.com ([fe80::6999:4ad6:8648:9c8b]) by SN6PR12MB4719.namprd12.prod.outlook.com ([fe80::6999:4ad6:8648:9c8b%4]) with mapi id 15.20.4020.022; Wed, 14 Apr 2021 17:37:35 +0000 Subject: Re: [PATCH v2] tee: amdtee: unload TA only when its refcount becomes 0 To: Jens Wiklander Cc: Dan Carpenter , Devaraj Rangasamy , Mythri Pandeshwara krishna , OP-TEE TrustedFirmware , Linux Kernel Mailing List References: <3150feb19421ca6b15202c853215f8b40fe35567.1617615067.git.Rijo-john.Thomas@amd.com> <1318f015-40cb-2bdd-17fb-2a3843ed45bc@amd.com> From: Rijo Thomas Message-ID: <1cff3f32-7a12-fbee-80f8-201433849f5d@amd.com> Date: Wed, 14 Apr 2021 23:07:21 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: MA1PR0101CA0022.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::32) To SN6PR12MB4719.namprd12.prod.outlook.com (2603:10b6:805:e9::25) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.138.129.146] (165.204.156.251) by MA1PR0101CA0022.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16 via Frontend Transport; Wed, 14 Apr 2021 17:37:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b6c1e310-5bf4-4427-4d77-08d8ff6bfd98 X-MS-TrafficTypeDiagnostic: SN1PR12MB2350: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sJdgitRQII0WUMSPxjDjLtsLodpmN6nXw4ITWY+kpYYZSU0oVS3/BCvsOwY/obD3+StzbOzK+aBHLsntax353j4o8W9lp/uyliZ5HkJwsQXxmYmTyPLqAMGW5JhlSyKkvcX0GB4q7QNMMeyAh9BqhByg+7qmVqmV9gIv5B6h5OUVXuJdGaQ0B2J9fiCeHBCqWxim+bJU2zrGI3Mv4E5F2D+Xkc21/druprPAW87RX/AxzEr8z8sX1JcA/Y5WG4zxn46lCeVbPlZPLG8yGbvu/Ht2dXIyLlUDDpfofQehLjeJtrsP4WcuAFP8CFf2nig+liPIbgP3l9fDyfz0zX9r/1V/xAGjFGfhipXdTUtQLXA0RR/8QqAkz17hYLbeoJClkdxeDMorbSWbPENjyBD5JQWw/aQy0bHMSvz+K0IVPeY+UhW+h+sky/fK1ypWQhMlph2nALRHwuADCqUpd8sLUKYcdnwAxWDF3Lt8eB9qaY/WgZxnBYFwT/d5Gdo0P6lyEqq4HVWWaefoNEkeWJe6nEszvE5ibakcygTjUMOvr95IYHXMzWUDZPxfx01UzeOWFWeYX53TjMv1DjfykIHMDU1aARb1xoG3ctGq1v3pD5EUFwXEngJZ12e76bKpZYKE9xR0zTPU0Wk1V1fuAxPdNPo1frt5y2bBW5M0Mhu6wMhVpasL9c71R2v1N/KntyQDCYCx81JGb8+C5q6p0s0GPA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB4719.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(396003)(39860400002)(136003)(346002)(376002)(186003)(16526019)(956004)(4326008)(66476007)(6916009)(66556008)(52116002)(31696002)(6666004)(54906003)(53546011)(31686004)(16576012)(316002)(86362001)(2906002)(6486002)(5660300002)(8936002)(38100700002)(36756003)(2616005)(26005)(83380400001)(38350700002)(8676002)(478600001)(66946007)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?MWVrNjVCcDRQRU9uUlFCSk94VHZoRnk4OWtLbDhnYVNWd3BLZkd3K1dWL25u?= =?utf-8?B?a3FzMy82S0JaMlNYTEtkb0N0YzI4Y0NCcktJWCtIMjJkb1FyeUxzZFhyaTFO?= =?utf-8?B?ZmYyeDJGaG1YRlJQMFJqMUNQTnhsSWowSDV3WlVVTmNDR01ZOUtmN3pxVTND?= =?utf-8?B?OHUyOGsxU25CWklFQ0NGY0VYdSsyREd0Z1RlMDk4THdodFVaZ2JTc2V3WWRF?= =?utf-8?B?TGRiMGRENWhtUTVwcUZ0dEx1VU14ZUR3M3MxK2tvRnFvY3o2NXlxYWtpbmVT?= =?utf-8?B?aDQyb1ROanJwQkhQUkJ2Q2kyb1lNbWp6MXBicTcyekhqWDAvQ1B1YkxnVnA3?= =?utf-8?B?MFYycnJ6MVVxM1pQS2s0VmZsRk1sZ2lqRWR1OE1BT2IwZlk3NVZSSXNIWlE3?= =?utf-8?B?Mk8yUVpxSjJQMmlObWtVLzBRbUtURGZZZkJhVldyMzJBeXpDS0NKenZmbjV4?= =?utf-8?B?UkFjVkhwaXJKdkRQRWt5clJVRzJ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ajQxZldxVzZCdmRGQUQ4aXBwMC9vWFkvTlFPQmxjUGpIVVlraEI3?= =?utf-8?B?VjYzVjc5MG8zUHlkZ0xoNGZ5L3FqSHlKOHByaldybEl5U2hnTjJSZCs3VDkw?= =?utf-8?B?R1BpM1hNdUtrMGh1YlhCN3g3VnZmRVlNZmJLNlZtT2lGMzcwYW9QaHFLL29W?= =?utf-8?B?b3M0dVNCd2pBVFVsS2w0dEFpLzhRYWw1bUlHMW5Db2VVc2NyR245Y3pYaDQy?= =?utf-8?B?cmdHaFF5NnRYQTdiMUhHM0NRTG9HU0hnWURkd1JIVmZLYWg0L0pUZ0Q0enAx?= =?utf-8?B?Y0orYWZWeUNqS0ZIc2pUc3Y5bTY3Zzl4SGZyYW5EVFFoL3paVHdJYzd3ODBJ?= =?utf-8?Q?AyUioALK3F0C8pNpcB0+30aCs+6KaHV8l44gzA5?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: b6c1e310-5bf4-4427-4d77-08d8ff6bfd98 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB4719.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2021 17:37:35.6924 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QXwTB0vOmjrDxDoIfoodzYFHd5rLVAMBMMZzYl8JpwOdEOXzOe1T7GCL0J/bXGRtL9K/pTYzjm8d6abbs72W+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2350 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/04/21 10:16 pm, Jens Wiklander wrote: > Hi Jiro, > > On Mon, Apr 12, 2021 at 12:20 PM Rijo Thomas wrote: >> >> >> >> On 12/04/21 1:06 pm, Jens Wiklander wrote: >>> 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. >>> >> >> Hi Jens, >> >> I have replied to Dan's comment. >> >> If you are okay with the current patch, request you to pull this. > > By addressing the comment I meant fixing it not just replying that > you're going to ignore it. :-) > I can't see any reason why the preferred style shouldn't be used. > :-) Sure Jens I will post patch v3 to address Dan's comment. Thanks, Rijo > Cheers, > Jens >