From patchwork Tue Mar 9 08:11:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rijo Thomas X-Patchwork-Id: 396176 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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, 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 EBB01C43381 for ; Tue, 9 Mar 2021 08:13:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B2BF2652AB for ; Tue, 9 Mar 2021 08:13:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229553AbhCIIM2 (ORCPT ); Tue, 9 Mar 2021 03:12:28 -0500 Received: from mail-co1nam11on2072.outbound.protection.outlook.com ([40.107.220.72]:56608 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229481AbhCIILx (ORCPT ); Tue, 9 Mar 2021 03:11:53 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j0+7jaKSzW0yyDe5vzpINpJUd/PkYcvDSjQMX9X9xY9qDp7LBlN8mfdXhRXtsZZwNNWPwZ1s6oYemM/a7wHT5T01sbO/y0M5tjQYrqNvyBfisvZIU+twCt4BKv927wrRM5hSKQ3Tl1pzVZa2eA3YvQsaEBT3MgQZVKrFVAcH3EyH6/KCkgGbOvNPsyCAbVVTqHYF8fMyvbEJe2Sr+PmWZqqzFJKMaz/Tz+MwiIc9NaqH/ZcFdk1ruh28tuNk1/LWOkNYX3IYLHXebF0SRvVCa+xraRDO4naxvPYfyTQzty3N9jnWX/ojLJ6/LzVDoFAPedjczT/wqVjyY+dUV6XyrA== 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=NvjwnCt2abTdauRa/uML1N1ktrM1KajkJKGSQnq0ZoI=; b=HGZmmakeL5wsx5jR18CbxJt87cBTNNbwoh2L0l1GHPDTE21fmToyO08iRwMCXa7WJ6iHvdkdRhVsqvfzUNDBEP9YChP2Xm04A4qhnKXj9KfPi29NCKYDR1ifVhoMeNr/+gaoxHUIy5JpjknOQ0499A5joZFHU3LVKuqo2PuZH5hD3S413rPjT104sneDpfp/k1NIcIFzA9UF521lPCB5k2wBEQfGQQAxccj8bTbUnEz4U5rXGUky0j6C7unVth4KKib9usSt1qVFFxnMLk5Tc2j2+pv6eWZ1JpUK3dQifEblIiuaPEhXo3dmitsDPCgbTuL2b3BZzSSuc1ERPpARDQ== 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=NvjwnCt2abTdauRa/uML1N1ktrM1KajkJKGSQnq0ZoI=; b=f/FvGjDjB9b+YuTffnfOv/CDJxjDVkOSIbnDuYDfV2GW9s7ZD8G58nNF/NISP7C8q/VQi8gH30nGbuBwO2+JS5Bhj4XcpG/V5D/2QExTj9QveKGSVMoD8AE9SdkiUDQeBlt1ZmdvdTkntrk3l1PL+RMLaaCZb2C3/sxn8Puc9Vo= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB4719.namprd12.prod.outlook.com (2603:10b6:805:e9::25) by SA0PR12MB4397.namprd12.prod.outlook.com (2603:10b6:806:93::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.20; Tue, 9 Mar 2021 08:11:49 +0000 Received: from SN6PR12MB4719.namprd12.prod.outlook.com ([fe80::c32:245b:4812:ee03]) by SN6PR12MB4719.namprd12.prod.outlook.com ([fe80::c32:245b:4812:ee03%3]) with mapi id 15.20.3912.027; Tue, 9 Mar 2021 08:11:49 +0000 From: Rijo Thomas To: Tom Lendacky , John Allen , Herbert Xu , "David S . Miller" , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Cc: Rijo Thomas , Mythri Pandeshwara krishna , Devaraj Rangasamy , Jens Wiklander , Ard Biesheuvel Subject: [PATCH 1/3] crypto: ccp - reduce tee command status polling interval from 5ms to 1ms Date: Tue, 9 Mar 2021 13:41:11 +0530 Message-Id: <5cc883bc9bf3ed88056f87ecae1a4e28a52adfe8.1615276206.git.Rijo-john.Thomas@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: MA1PR0101CA0068.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:20::30) To SN6PR12MB4719.namprd12.prod.outlook.com (2603:10b6:805:e9::25) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from andbang6.amd.com (165.204.156.251) by MA1PR0101CA0068.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:20::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Tue, 9 Mar 2021 08:11:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2fe53886-7949-47eb-f5d4-08d8e2d2fd2b X-MS-TrafficTypeDiagnostic: SA0PR12MB4397: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VVJCv2xYTtFxZk8mK5TGyWWTe8KdYvTpFP8U4rTtF4oWx8Sjr6/VK+wlAVXU2VyB3a/HqnEvAsE2NYA2ZKGqbZAzF79hULzGjS4ReB/0kebEvKyjUh/ZfEmbbbPUNCKSRzcogNzfmsQUTE5mlcFr3jr04o6xLzMUJxq5m2V3HPmEVEJfIErjuRd/VC0kYak5GYK69b6lOVlOTfBahun8ixbZOePs9DCDYM67TZOATr7n59jF8vrXhnHMLnD98aqkOuPtOmOY7i2GKBKOUVZZFO38UtxEUogGDk67+eA7QH5gf2d80s10VqbUYyr6Z+PpBe8NmdKW3hGJIoz9g+cjh5gQAIOqeUnLwdj//oBK33j+mexIoER+SVMPbYFA7/mTYAPVUn97VBQU54KMkpV3mhghKqHM8lYH+3LR1APKU+rsk+ItPYafcjsIB0Cc+VL2+t5Pgas+g9rsrH69SAsXCSTnZ8a6Go2HgVENczLhvDM2kyZcEw6R2yJUdLaMm1TbuXCCHwo8byXdSM4LwlFwfw== 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)(376002)(346002)(396003)(39860400002)(136003)(66476007)(8936002)(5660300002)(4326008)(66556008)(2616005)(956004)(316002)(54906003)(26005)(2906002)(6666004)(8676002)(110136005)(6486002)(83380400001)(66946007)(36756003)(86362001)(186003)(478600001)(16526019)(52116002)(7696005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ddR1vlnR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GSRVOMZI6pHt42dpwUwbGZu8xIir9cxosw1HVkUiWxZKWlbK1LZIKCHmbK/g3YFAJe8Vfo2HfP5Vn+pqN4LwI/s2LnK1EYKurxBxRU9RnmfZgY8ogDNE0r2EkZ4Aj4qIAD4Vp8b+rjD4J191D79EvwfEvh4sRQE1qsFTu87m4996ChOqH0r3DWJAyH5fe8dVntBGN4kDLCyR8HX4QlwfEpWh0nq6/4xIoDL4rZdKMcI8265M5CIT6l6ZodYcIEw X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2fe53886-7949-47eb-f5d4-08d8e2d2fd2b X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB4719.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2021 08:11:49.5798 (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: DgRIndQ+mHjAskdyxqPYGPBRKSue61NVCeyBq2QGkvAG02xbkSUSg00ckcjFZMRYuI2R9hnetVjhXqEWpdnscQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4397 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The PSP TEE device driver polls the command status variable every 5ms to check for command completion. Reduce this time to 1ms so that there is an improvement in driver response time to clients which submit TEE commands. Reviewed-by: Devaraj Rangasamy Signed-off-by: Rijo Thomas --- drivers/crypto/ccp/tee-dev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/ccp/tee-dev.c b/drivers/crypto/ccp/tee-dev.c index 5e697a90ea7f..fe18a92d51ad 100644 --- a/drivers/crypto/ccp/tee-dev.c +++ b/drivers/crypto/ccp/tee-dev.c @@ -309,14 +309,14 @@ static int tee_wait_cmd_completion(struct psp_tee_device *tee, struct tee_ring_cmd *resp, unsigned int timeout) { - /* ~5ms sleep per loop => nloop = timeout * 200 */ - int nloop = timeout * 200; + /* ~1ms sleep per loop => nloop = timeout * 1000 */ + int nloop = timeout * 1000; while (--nloop) { if (resp->cmd_state == TEE_CMD_STATE_COMPLETED) return 0; - usleep_range(5000, 5100); + usleep_range(1000, 1100); } dev_err(tee->dev, "tee: command 0x%x timed out, disabling PSP\n",