From patchwork Mon Apr 3 18:32:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 78681 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2505643vqo; Mon, 3 Apr 2023 11:38:07 -0700 (PDT) X-Google-Smtp-Source: AKy350ZvlnIS2QeMcDyrmjH660GoO+aBQgZAc/jABSBKbDaNXUCzmB19OeDNA7G9/IicE2z6Xa6B X-Received: by 2002:aa7:c58b:0:b0:4fa:4810:95f9 with SMTP id g11-20020aa7c58b000000b004fa481095f9mr136568edq.34.1680547086894; Mon, 03 Apr 2023 11:38:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680547086; cv=pass; d=google.com; s=arc-20160816; b=fpp7sxfKKYwcP1rIKGNquwg2HW6L6ZFQWwfjDRIIqAM7HcSnBQkp5wia1iOdbXlRW5 Pu4aMhHQ0pYzwGAMETrBLoa0xP3vYHefmCvBDOQXmKN8HBqz3zAGBx+oGZMAC+pHKZtr I4apDR5XCesX+kF853Bx+v4NNVokFCWS77MJ4O1CjQoBafNGAfZ+GSsg1yR1/Wy0MYof CAgUnrlAJkDhAniV8SYUKYgMuwsWfR96NUFrzUquxEiA+hcRxhugpSX0E62XcCkogw0O xv3YReXsxnjETavgRM47jBfTYSBNWGDLYwNVLolnt7OKU7N7O00dyc6ltVgpRk5rW+Ii f5Yg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ATpuEFcUgIFn5/ieuusPA4zt5QZhLXuduUQD0LNxC00=; b=Z6yJn5N1DhjP1TDaoldjQOeD6LCDcH77376HA+phF+Xq01A8arn+cD1sdyAO1bMMYt 66IhlYe6U8iUxyYMfQJQ9iwG4x30pRjEYxySX65mWyAFZ9nDpurFLu/zXl98FfYpUUPx hnbgc6GsitGFrLyhFLYsog+jHxOkC7NmbnYYPKmPiUKrHHeNQV8vkVOaDh6j1LuF39LS Ozcv2TXLpVfH5qnGuqRf/QWLnaM3RQxE6DR3S7h0hzP2aJ1P/aCnMdwqM2/dNY+WkjE/ QUS05zo49swlj1UdhtHRyrxZlk1Rc3ocoTCN27VH1DQCHWekUUIPWPMkAmysu5GGSIR6 Ld2g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Tzt43kGg; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g7-20020a056402180700b004fe9bb88043si6241812edy.419.2023.04.03.11.37.42; Mon, 03 Apr 2023 11:38:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Tzt43kGg; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233319AbjDCSdG (ORCPT + 99 others); Mon, 3 Apr 2023 14:33:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233226AbjDCSct (ORCPT ); Mon, 3 Apr 2023 14:32:49 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2045.outbound.protection.outlook.com [40.107.243.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9508C270F; Mon, 3 Apr 2023 11:32:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C1zqCduz4WlpLoK0o3pcTWppmoqxxZiQAp99kDcOvD7OgjiYlm0NRkpJm0uSKI+b+2zgOIaC7l4AXsUnO+xrm8OVvqSDbSBgiKfbUfZi7lLKiSkEp5NjbyReaoQG7RzS/89gBdTeaqDp8VcdLDSv4LO0Smkfw3UeG7l14zuTHbJObNiUW09nUxiEZeT1ThAQLUBRAZDnPI7gzVLODK2QkY3/r4VxjNAQRKs0zfYSUHo1ubiTLNQ/9LoPEeMLlNXbPm8tN8HFQ1X95Tw9hW20o/2flaGY6jqPZkekdr5R7pyKVEYl2TzemA+fapsNG9dWkezRYEZ3mR7NRPUCPHNFVA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ATpuEFcUgIFn5/ieuusPA4zt5QZhLXuduUQD0LNxC00=; b=EhJ4lS+yBsCrf/1VROEtCLq+vf+1YLy7kbsoDCeVM8X2jJ5jv/B6Dpm6KlEq+e47GLtym6zlVj/8+zQ7BtaF2R2cd9Cg8WnF6uvGdBdOQ62SIc5Tjr3zAkuz4HvXaTAcAXRi13hQUvCYQUWTSGoF4a9Sue6TvmwfDP7soo32Qnh7ToGDHYKAK1Hq7JU9oagpB6CfgCLw86O/FGeoxKoMcqRj0ttk7vVlW5QkL+YZhcHGLQPXuwMV0XHy0pDDylwCT7vfpriM/sIPQeFQqqp5VB9j4VK9HI80MBGi5dFrByYl05zQYia7gkeXm+rtzpdRzlslF9oh5Nz7ttVpXCJORw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=ATpuEFcUgIFn5/ieuusPA4zt5QZhLXuduUQD0LNxC00=; b=Tzt43kGguH3pxNKVqkVNzpLS9b84q1kXV/rNelQI116yeYSZGw8mDy+7SryWWh7c2HqrZNxyTLq20KSL4+6VzyiYZajP9nUz/0tbBxswolYGi3dfpCaAoFANCWGopXpnUKTC5UWE+yr9e0KUXOyCpeF81zsa81PCt4rgIRXpLHM= Received: from BL1PR13CA0200.namprd13.prod.outlook.com (2603:10b6:208:2be::25) by IA0PR12MB8838.namprd12.prod.outlook.com (2603:10b6:208:483::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.33; Mon, 3 Apr 2023 18:32:42 +0000 Received: from BL02EPF000108E9.namprd05.prod.outlook.com (2603:10b6:208:2be:cafe::be) by BL1PR13CA0200.outlook.office365.com (2603:10b6:208:2be::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.26 via Frontend Transport; Mon, 3 Apr 2023 18:32:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF000108E9.mail.protection.outlook.com (10.167.241.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.30 via Frontend Transport; Mon, 3 Apr 2023 18:32:41 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 3 Apr 2023 13:32:32 -0500 From: Mario Limonciello To: Herbert Xu , Tom Lendacky , John Allen CC: Held Felix , , , Mark Hasemeyer , "Grzegorz Bernacki" , =?utf-8?b?SmFuIETEhWJyb8Wb?= , Mario Limonciello , "David S. Miller" , Subject: [PATCH v8 1/6] crypto: ccp: Drop extra doorbell checks Date: Mon, 3 Apr 2023 13:32:10 -0500 Message-ID: <20230403183216.3493-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230403183216.3493-1-mario.limonciello@amd.com> References: <20230403183216.3493-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF000108E9:EE_|IA0PR12MB8838:EE_ X-MS-Office365-Filtering-Correlation-Id: ac15c867-b862-4a5d-9c08-08db3471cf4b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5UQ6Bi5UfytDMt8pAjhyFYe+DlVHb8chJIyfTQTlegTDV5GMvx+IZg4asojidEbVFffFkz2RGqcz7BZeAQfcybR23nNhLdgkY1BVVafjwYDHPRL00zjEXM8d2CmFAg9cxN3i4Z6XBn+4hZ2fNOUMO+jHcCTo/vNBKAPEdKsGrq7UAPBYaGEe8/17FoALvEof5YGX7CH7W41Lf4lKMuEhCm9hFOyovRN3UA4M5q5ZF67x+LXV+VM4aRGsNh+WnZdLY4yFJoAVh4qgyUBA3cXTYdAvye+dU/JRL92bluBM5O11ktftFcVC9lmCUmfmNLRnCYyE2O45desdxfJzGR077ihYkmG1zvd3r5jpeTTNXIWIMbV8pWJ6srMpMZFuo5Zl1AwBZwl/53aPzuUIkTM07lMHCywGAe+1mL3Bo5BqZtS3mVlavvsz7xBxI9eBPJrIciu/NEwW5Q3TrxfHVw7hsL2zv3v0HSz+B//Hc+UViqmMmwzy+YrZQL+TUWbqo1odZjkVm2CaXKYHdbtMGQnGatwO7KC8jCfjelUJFLoNqHcyPNmBIWg9jCi6AaGqkcoxzx6s0ZiWvpXNEO9gJ9aIYc+UqtXFzbOHj/tqsXa3Q+fz63DuBnX/vJ8kmgVw7u7ZGXE+XGksaptaFrX1WUIwJOq+4it8dsGTArNmoMbFqNoZjEUKmdB0GR3CiO/WT0c20VO+ggbEJaoigSlUBEAzKtvJLhWxEARMCQYeyz9dgII= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(136003)(346002)(396003)(376002)(451199021)(40470700004)(46966006)(36840700001)(2906002)(44832011)(81166007)(356005)(5660300002)(82740400003)(70206006)(8936002)(70586007)(41300700001)(36860700001)(4326008)(8676002)(36756003)(1076003)(40460700003)(110136005)(54906003)(316002)(47076005)(2616005)(6636002)(83380400001)(82310400005)(336012)(426003)(86362001)(16526019)(478600001)(186003)(26005)(6666004)(40480700001)(7696005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2023 18:32:41.6375 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac15c867-b862-4a5d-9c08-08db3471cf4b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF000108E9.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8838 X-Spam-Status: No, score=0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762181342481126017?= X-GMAIL-MSGID: =?utf-8?q?1762181342481126017?= The doorbell register set used for I2C arbitration is dedicated for this purpose and there is no need to utilize other safety checks the platform access register set uses. Suggested-by: Mark Hasemeyer Signed-off-by: Mario Limonciello Reviewed-by: Mark Hasemeyer Tested-by: Mark Hasemeyer --- drivers/crypto/ccp/platform-access.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/drivers/crypto/ccp/platform-access.c b/drivers/crypto/ccp/platform-access.c index b51fb1196932..1ad3a0a512b1 100644 --- a/drivers/crypto/ccp/platform-access.c +++ b/drivers/crypto/ccp/platform-access.c @@ -20,14 +20,6 @@ #define PSP_CMD_TIMEOUT_US (500 * USEC_PER_MSEC) -/* Doorbell shouldn't be ringing */ -static int check_doorbell(u32 __iomem *doorbell) -{ - u32 tmp; - - return readl_poll_timeout(doorbell, tmp, tmp != 0, 0, PSP_CMD_TIMEOUT_US); -} - /* Recovery field should be equal 0 to start sending commands */ static int check_recovery(u32 __iomem *cmd) { @@ -156,18 +148,6 @@ int psp_ring_platform_doorbell(int msg) mutex_lock(&pa_dev->doorbell_mutex); - if (check_doorbell(button)) { - dev_dbg(psp->dev, "doorbell is not ready\n"); - ret = -EBUSY; - goto unlock; - } - - if (check_recovery(cmd)) { - dev_dbg(psp->dev, "doorbell command in recovery\n"); - ret = -EBUSY; - goto unlock; - } - if (wait_cmd(cmd)) { dev_dbg(psp->dev, "doorbell command not done processing\n"); ret = -EBUSY; From patchwork Mon Apr 3 18:32:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 78689 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2530338vqo; Mon, 3 Apr 2023 12:19:43 -0700 (PDT) X-Google-Smtp-Source: AKy350Yx8IhXXhkRt4xTVXfZMaZ9K9VK5JVZa17g/6LRme04X5E02qxTkiFN5gK7h5Jx05Ihxza4 X-Received: by 2002:a62:79d3:0:b0:626:f1d5:68a with SMTP id u202-20020a6279d3000000b00626f1d5068amr38359527pfc.34.1680549583372; Mon, 03 Apr 2023 12:19:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680549583; cv=pass; d=google.com; s=arc-20160816; b=HK7gjqFLOw/jsTIeMg6xJGJdtSIyR0/RGeue+K0bpGTmvi3Qhn9mxJD026wyUBmIPk c55g3IT3lE9smcfTk1Zb32507QM4vUS+KKHQLOKsp+ilVimVSGC7D8ivM8LPo97QKsdx xKM5Z4L9K8IC8KQMFhRgsPDBMjwx14yq8lBlcIz5l58HJSULEvh/UdlT7cC789kKmBhH tXT/oberQc17byrsQzXCYQXwUHpjfdCtzLopd0V1KI6kDc7ocXiyT1jKVjx8tOP1uz1q zzPbfu82YuFwIm+rE9SJew9qg5+wVhWmg4NeEdRbUNM/QheadDcCg9/TMuA7rf8FCStl MgAA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IYhIZWbNYqFVNDpfO931gMMWdMwqo+/KUWdkInLKCoE=; b=tZe+CcPNOgbB2yw2419sQx68wWc31WwWJedV2djsSH127jHa59prJpBmPbzVJvt8NJ Mon4sJtgFW3kVWG0TiePQakBWFppAoxStQ/Wt6kfknkXA3w/xmR/XesL6c0r7oz6AubE y1dmvJMC7zw9t7cjrCBrGD00SKrfZzqPfb0C540ba4zP6cH6NCnsjAoEPJv9TQ5g+em2 0Bu9wLZLmiEOrqAlX3y+y+8biMw2Kv5oS8CMBKneyaPVFajMTUvV/RqYe6EqyG05sZCD yWscgjJSKQr6qJ+sdSW+pqa0DAZLu2Fwns2tQnXJg1n2bxQ4kwWuqhIBC8cN77Ld0Jrp s6Xg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=kS32UR7I; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8-20020aa796a8000000b0062b45474adesi8419092pfk.231.2023.04.03.12.19.31; Mon, 03 Apr 2023 12:19:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=kS32UR7I; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233252AbjDCSdC (ORCPT + 99 others); Mon, 3 Apr 2023 14:33:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233225AbjDCSct (ORCPT ); Mon, 3 Apr 2023 14:32:49 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2087.outbound.protection.outlook.com [40.107.223.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46DED212D; Mon, 3 Apr 2023 11:32:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HbyfaT7S4l4ECuDLMRxWrqBT6loFym+iIUV9htQtdbmm5+aiI0xrgbJOFxgX9lRg7pO/PBR6/PT1euPf3gaNdufGYBcML4p+LXnGoxEZllsuWqFhqEvt3SORiovqr6qMfwYV2HDbeND3itYq3S2eAB8wLcWRv3caTU3GLnKHGcl7fBsss1iqSh3zG3bFtBuLC2GhJJpP9kkxAefzeC424f3WwFeSEtguZnIZXZ+MdovziqG8tTWgniNrnSpqG62HWZvuVn5ppkY8ev6fPbDr9y2f0lh3+hAMTkwaKU204BAxvYFqisWIzTIl6UHwhkXDSKBhYyeD2Grj5fMIMEQaiA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IYhIZWbNYqFVNDpfO931gMMWdMwqo+/KUWdkInLKCoE=; b=UJS7AwD3BufCONXRS+925Ml/CNxSl6fhFpTDvhQfe4uC0BXMD8sONa5y6UYnqk5qHpltYI4jxeNzF9bZ1jQfuE+Y9dNwWv4nUc5V6D6sx+sCcA4EvYN4OXC6jdyJTEciDtO5RQ3TtIiLtTnWIuBpwCO2Z6as68yH96WBCK1/6RMKG/C8FawJX6pdmOdjcPIKQc4Juuk7HhAmuUL3qv68fi9Ltw2DhpnU7bXNnXW7vVzkAGh5S8fNmsJWQI0s7ayjDul4QKE8EIfdTvvGUQkssJuleW7Nj/gmZy7SkwOt1RnHvLdaGWF0XWBHn4nbsrcAcSc5+Q8W+VmLs/M8GFzUGA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=IYhIZWbNYqFVNDpfO931gMMWdMwqo+/KUWdkInLKCoE=; b=kS32UR7IP3RBjsjk0TuW1vOHEpCMjR3H6nw0y2aene7F74v2u4SRPHbqwjeYnrKSR+sp3LpB3bguPFftLKScVcpnh4Iycdt2OTK/NIrEGic7W+2d0SBmH5OAZ0x2ffZRjjsmuwf77Ki0Ovkpaj/duCBS6iJ89Veir/nB3ySnPpA= Received: from BL1PR13CA0200.namprd13.prod.outlook.com (2603:10b6:208:2be::25) by PH7PR12MB6612.namprd12.prod.outlook.com (2603:10b6:510:210::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.30; Mon, 3 Apr 2023 18:32:42 +0000 Received: from BL02EPF000108E9.namprd05.prod.outlook.com (2603:10b6:208:2be:cafe::be) by BL1PR13CA0200.outlook.office365.com (2603:10b6:208:2be::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.26 via Frontend Transport; Mon, 3 Apr 2023 18:32:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF000108E9.mail.protection.outlook.com (10.167.241.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.30 via Frontend Transport; Mon, 3 Apr 2023 18:32:42 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 3 Apr 2023 13:32:33 -0500 From: Mario Limonciello To: Herbert Xu , Tom Lendacky , John Allen CC: Held Felix , , , Mark Hasemeyer , "Grzegorz Bernacki" , =?utf-8?b?SmFuIETEhWJyb8Wb?= , Mario Limonciello , "David S. Miller" , Subject: [PATCH v8 2/6] crypto: ccp: Bump up doorbell debug message to error Date: Mon, 3 Apr 2023 13:32:11 -0500 Message-ID: <20230403183216.3493-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230403183216.3493-1-mario.limonciello@amd.com> References: <20230403183216.3493-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF000108E9:EE_|PH7PR12MB6612:EE_ X-MS-Office365-Filtering-Correlation-Id: 6ec6830a-b1fd-435f-4552-08db3471cff7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rvKsKyWC/jW/akMtAqCYGVvWQx3SuXp9cyv6kSoetadLOcihTd9UD9SnHXJQkWU439to768kmr4zfnO3uOiIHNOLuonjojNkbJNGf+doziSLjfOBQ+DNaeRclM7QT6K/d/R72PCvL1lewnIxAzXz2wncxlnFckGDteFYAOTD2NitV2tgFkZ5GjXlPDExYwGjyjPv3KpZtZsT/luHlWnlRP+EDRnpOOpX+AShdlk3ohwoLbDWnMlhRCpSS/mAUDCM/e0N+Op7Pk1JLwgv7SO5Gyn/mXseWoBR4+uv+vtIZPTeuGIJ0Fydbd4fyEUn8mtcSzVe1oScibsch8X9iWK9B2mJCli36Xv2Bqkx22JDRK8GLR6KvliV4vnItB3vJWQsavnIIRVqpeobt540dMglnBDEtHIuZSQ0oKMOdFBXTuoINMXqhodysjU1+HQvssbS9mWC71f/nJmvAr9AyfkGNv5zz8zY3b7/tYdqL0mQzdSL4YYWuxnH5slHwxVNSlEgCGrrz3FI59gGZAX4xApXUYdi0xwMmMXVXpzcejiMO5hfNhry77AMe/JZcmMk6x7w00Y1enrgPL8WtX8xE1jESbPZO2APXYJADoXBaKm5Evg04elbmpEy1HGudtuPPQ6U+kzRehj58iaDToCfi8340ay1JSEVi8msTv914tsH6hX+uz0cwPCApjz2aSMbpe2J89OrgAg2UzFF8N75K2hbAt3Pd/gl11zNdcvSAIeGO90= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(136003)(346002)(396003)(39860400002)(376002)(451199021)(36840700001)(40470700004)(46966006)(47076005)(478600001)(2906002)(2616005)(40480700001)(186003)(16526019)(1076003)(6666004)(36756003)(336012)(426003)(83380400001)(7696005)(40460700003)(26005)(356005)(81166007)(4744005)(86362001)(110136005)(316002)(5660300002)(41300700001)(82310400005)(8936002)(4326008)(82740400003)(8676002)(70586007)(70206006)(36860700001)(54906003)(6636002)(44832011)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2023 18:32:42.7626 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6ec6830a-b1fd-435f-4552-08db3471cff7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF000108E9.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6612 X-Spam-Status: No, score=0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762183959696092902?= X-GMAIL-MSGID: =?utf-8?q?1762183959696092902?= This is helpful not just for debugging problems, but also for investigating captured logs later on. Suggested-by: Grzegorz Bernacki Signed-off-by: Mario Limonciello Tested-by: Mark Hasemeyer --- drivers/crypto/ccp/platform-access.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/ccp/platform-access.c b/drivers/crypto/ccp/platform-access.c index 1ad3a0a512b1..1cc154a1c6ab 100644 --- a/drivers/crypto/ccp/platform-access.c +++ b/drivers/crypto/ccp/platform-access.c @@ -149,7 +149,7 @@ int psp_ring_platform_doorbell(int msg) mutex_lock(&pa_dev->doorbell_mutex); if (wait_cmd(cmd)) { - dev_dbg(psp->dev, "doorbell command not done processing\n"); + dev_err(psp->dev, "doorbell command not done processing\n"); ret = -EBUSY; goto unlock; } From patchwork Mon Apr 3 18:32:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 78692 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2531359vqo; Mon, 3 Apr 2023 12:21:33 -0700 (PDT) X-Google-Smtp-Source: AKy350Z1/2EeM73TpWgTMQosb+6TdRjri4rKX8LkPQ/XjuySdJbQ8lgLdMuyZgGY7h+kGJwKENFi X-Received: by 2002:aa7:8ec3:0:b0:625:cc03:df34 with SMTP id b3-20020aa78ec3000000b00625cc03df34mr35109145pfr.1.1680549693184; Mon, 03 Apr 2023 12:21:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680549693; cv=pass; d=google.com; s=arc-20160816; b=UwZEMKJVEL6Wfekb/quJzQtqJKmXvNFzV/iLeFUxJ24nUuakZCjxDMaNs1iVjERWO8 kGcDS/aDcVlcwnGHawLbRP3vz6pTJPF0KKxTQDcMzSm63RA7OBr0YCIBksTgNfIOdwOZ t4VrQQwZIyJ5RcpSOeoXuEOLEx2/FRv9haaYvr3GVOrmxagDkCRjebrMyOFbfALJVxXP MYKQBsVEo3EhOgXay56S1t1OBf3cTs5LpHK8B+tWVipZwuB1xZwGAH+rLci8QEaJMPxY Cabx/a0T2eHQi6reWFo5x1n6sp3xZLmOLUbxuQTqp5yAJX2amoKiRgZ4kcn2i2nilduR 7cxA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0JG8ZQbgcdWCm1NNm1RDFSg43s1mjeApJXMO1CEXoVs=; b=cXGc2jmygywzse/RjqixBT0cGJ3KGzkk2em2JgC36zpI0Je9HXeM5KqYROiy4wIW22 MlPCXB9ZUa5LL3qS0V1d2HeihkrPsXP9StbIWG+hzmH/3ahsJF/kKJnwKbnR5gzxKTmD vMij3hqCsyI7H8rNR9vx4ruJxKYjGJty9FJfxCiuju1rkvl5cIznMJeXg8ULnsguiDM+ Iswox8TB8MufGnaSOCdv4DRPtD5zlW1RiGnySVla8ZZHkblKGPZoKiN//iDI9THm3F8U Mt2BTNGxQt+kYw+mBg4g4oSxzOUirjBcXxiXq2DOw7uHS1hbyrJ6OEcoAZdtJxFhnUsM FrYg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="Xp/nOzZZ"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 185-20020a6300c2000000b00513f15fed67si2464636pga.517.2023.04.03.12.21.14; Mon, 03 Apr 2023 12:21:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="Xp/nOzZZ"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233212AbjDCSfI (ORCPT + 99 others); Mon, 3 Apr 2023 14:35:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231411AbjDCSfG (ORCPT ); Mon, 3 Apr 2023 14:35:06 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2061e.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e8a::61e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4886E448A; Mon, 3 Apr 2023 11:34:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=InUY9G2ReyTqRks6KRfvXB2yinED/yNCV/phk+rGcBhLrGDIWri40HnD7KkhFVhVe3ihpNfJpUD+PZEeFvPV3zAgahHKgO+fMx88AvraDWokAArBGNDJ/Q2Go7QWtSIiOIUbVDSFuNK95zD9g/GJhnq91U6TVfga2Kto+6JRjmom8f8dknqtXwRH7yxn5eas6hWo2sT9DeS08JXw2DFOtczLklGz8tMjHMSvWhDtYOHdYP9ngHIa6SgFMRKm5l3SkxFFeJ61EWNgMen9N5CwzOgem8IIWscPMW9iT4DyFTG4vIH+fa4JeXmws39zRvIg+tFE+R3jFWmWNHet0dYk3Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0JG8ZQbgcdWCm1NNm1RDFSg43s1mjeApJXMO1CEXoVs=; b=jFVCgfZlPFvcZsiQ7c4EWGws/H0J7ULg/J6lAoQDssfS6Wlj22132p+CDQmdpOecIZLVQTzADy3AG0X+wblUc9Hpu2DwfKzJsWfui1Ob8QprPUnFD+D8zwBCLsFTv+SQD9AVkpNtnZT+FHf+VkgdBqLaARAWgLSXG86UQlHQD851o3whYUtf8mJQfTXN2nrghKFL5IUlcTZO7aegLMFzmDXHIOpAQwR0fAryTdkiIvzKhfjJT8VpBockEPhSfWK5RIy4t6seBEVcF7PWnyn6rxzSlMAxrFfB8xsJlBAjhcORgcgLM9+C1FdCvUDcM4/RJ8aJavF9yhG52Sy2noGwWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=0JG8ZQbgcdWCm1NNm1RDFSg43s1mjeApJXMO1CEXoVs=; b=Xp/nOzZZm/bQRhdqvRJP7aAI2nP6WWT3S3xcy7nxZsCHzleAF4DPmX/jqK5rkEHk/LQmqMjbLwbvmicDxP7Imy4KNTqxLlsvmavL1ARouQDsxrPwzf/dyX0EPD7YNiquiz8HGptzNLwnMtMqBsotUrq+B2xEa47FNTmIOqd0ipA= Received: from BL1PR13CA0334.namprd13.prod.outlook.com (2603:10b6:208:2c6::9) by SJ2PR12MB8928.namprd12.prod.outlook.com (2603:10b6:a03:53e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.33; Mon, 3 Apr 2023 18:34:03 +0000 Received: from BL02EPF000108EB.namprd05.prod.outlook.com (2603:10b6:208:2c6:cafe::d2) by BL1PR13CA0334.outlook.office365.com (2603:10b6:208:2c6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.26 via Frontend Transport; Mon, 3 Apr 2023 18:34:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF000108EB.mail.protection.outlook.com (10.167.241.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.30 via Frontend Transport; Mon, 3 Apr 2023 18:32:50 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 3 Apr 2023 13:32:34 -0500 From: Mario Limonciello To: Herbert Xu , Tom Lendacky , John Allen CC: Held Felix , , , Mark Hasemeyer , "Grzegorz Bernacki" , =?utf-8?b?SmFuIETEhWJyb8Wb?= , Mario Limonciello , "David S. Miller" , Subject: [PATCH v8 3/6] crypto: ccp: Return doorbell status code as an argument Date: Mon, 3 Apr 2023 13:32:12 -0500 Message-ID: <20230403183216.3493-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230403183216.3493-1-mario.limonciello@amd.com> References: <20230403183216.3493-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF000108EB:EE_|SJ2PR12MB8928:EE_ X-MS-Office365-Filtering-Correlation-Id: d560c404-ac4c-461b-a680-08db3471fda8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wUIiIm2QUlL/ordE2+jHT5jdWeati8XQEn6EOTBH7TG7aiNXJSKjdciEcOj6XjfADbkeCBmkTS2WTpaeRtFenx8N3Iy2rJN0ujMWf8RJ9m5bxwKDoMlcCqRPzX73auZpYRV7+6aeCVGLwN5rT3xhTVKPoguv7Ko3BY3WOQQ/OpqDx8BgTNBWXL35yMMKrVEq4PrTMt95uycsp5FeywOwWHmtnZWBxaiiL188H7RAhEIsWHDp5p84OKM7VQRhFeRhNUdhtNNaw+NszCGPip0a7DddNxeHDEIssOlWvr29fejU1oj049gwctbQktP5Qadncyl+mECnG07Qc6TsrTC4sZm+5sQlRddzzPEbhOHlclJ1a9/LoaBN+zSCk8LXi4WEyUCycH3cCqZTm8UAYQCGo6R2IdKTLIu291BaPq3P4MkczZHGX/YFGRaRrVN79un+1k/D33T9e7b772qouUE9ozBq6zV3VYO1r9o7WV0ZaWsNP+PUimS4zil50kA6ZM6xrhcSDYU0gFveYhcuoiUOSng0uV4/svz4JjqgXcVeMP8cmm0SUkC8iYyDxU3f5MArgoOOHCl5uv+1TXLbW2cA6UHQl1UbqWkwGHNGDGS9Fk1rny0RhYqo9PHWPgP+ph4KhlQz/ge0JOu/cfspbqKGRSlTaGlj2PmHzsyQvLQwZKJn7HulfaYYyILVDyZxTW9SSuBIKYxeRiiikRteq3saueMCOryyHTB/fqGReKmVdE2C7AEjrlDgIOsWWLo3JBd4s9AubjKOgLxN38NaXKwQ2A== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(376002)(136003)(396003)(39860400002)(451199021)(36840700001)(40470700004)(46966006)(356005)(5660300002)(81166007)(44832011)(2616005)(82310400005)(47076005)(83380400001)(336012)(110136005)(426003)(54906003)(6636002)(316002)(7696005)(40480700001)(16526019)(186003)(478600001)(6666004)(86362001)(1076003)(26005)(36756003)(82740400003)(40460700003)(36860700001)(4326008)(41300700001)(8676002)(8936002)(70206006)(70586007)(2906002)(36900700001)(134885004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2023 18:32:50.7810 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d560c404-ac4c-461b-a680-08db3471fda8 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF000108EB.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8928 X-Spam-Status: No, score=0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762184075223034951?= X-GMAIL-MSGID: =?utf-8?q?1762184075223034951?= If the doorbell failed to ring we return -EIO, but the caller can't determine why it failed. Pass the reason for the failure in an argument for caller to investigate. Suggested-by: Mark Hasemeyer Signed-off-by: Mario Limonciello Reviewed-by: Mark Hasemeyer Tested-by: Mark Hasemeyer --- drivers/crypto/ccp/platform-access.c | 4 +++- include/linux/psp-platform-access.h | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/ccp/platform-access.c b/drivers/crypto/ccp/platform-access.c index 1cc154a1c6ab..48f59ae91692 100644 --- a/drivers/crypto/ccp/platform-access.c +++ b/drivers/crypto/ccp/platform-access.c @@ -132,7 +132,7 @@ int psp_send_platform_access_msg(enum psp_platform_access_msg msg, } EXPORT_SYMBOL_GPL(psp_send_platform_access_msg); -int psp_ring_platform_doorbell(int msg) +int psp_ring_platform_doorbell(int msg, u32 *result) { struct psp_device *psp = psp_get_master_device(); struct psp_platform_access_device *pa_dev; @@ -164,6 +164,8 @@ int psp_ring_platform_doorbell(int msg) val = FIELD_GET(PSP_CMDRESP_STS, ioread32(cmd)); if (val) { + if (result) + *result = val; ret = -EIO; goto unlock; } diff --git a/include/linux/psp-platform-access.h b/include/linux/psp-platform-access.h index 89df4549fada..1b661341d8f3 100644 --- a/include/linux/psp-platform-access.h +++ b/include/linux/psp-platform-access.h @@ -45,9 +45,9 @@ int psp_send_platform_access_msg(enum psp_platform_access_msg, struct psp_reques * -%EBUSY: mailbox in recovery or in use * -%ENODEV: driver not bound with PSP device * -%ETIMEDOUT: request timed out - * -%EIO: unknown error (see kernel log) + * -%EIO: error will be stored in result argument */ -int psp_ring_platform_doorbell(int msg); +int psp_ring_platform_doorbell(int msg, u32 *result); /** * psp_check_platform_access_status() - Checks whether platform features is ready From patchwork Mon Apr 3 18:32:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 78682 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2506442vqo; Mon, 3 Apr 2023 11:39:52 -0700 (PDT) X-Google-Smtp-Source: AKy350bJb760WqLNHjrbX2U9lWvPpqQOkVKylGwFsewwfP8oC6nMtTcCXrzkbt1bK4cmnwaHpY8F X-Received: by 2002:a17:906:d207:b0:92b:b4d9:3f07 with SMTP id w7-20020a170906d20700b0092bb4d93f07mr34141136ejz.14.1680547192773; Mon, 03 Apr 2023 11:39:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680547192; cv=pass; d=google.com; s=arc-20160816; b=Wlf6lcOEWojIRsg8hb/3dL+X1ib9QMSN6SB+kqLKNmAM+3ba4uNVMdccjIf3FEEWA7 3lwiF+8ybHvozelZ9VZOZUfhrxGzrj3YIK8yEHF+uUQKXDqYG4GpjWouvXAg/I9Nd9x2 EAI5tc1TUaQaDvekCYzosy9p1poe5/aqCce+uNKA7ICupK15pePvdPxapqzAbRN7MC93 7X2ExFOFIcQ7+Dkw2DrweBduxPnubL2v59umadevDpxCYPbzsIcCpE4EuzPls6eOPlF4 2F3l8R6Tx76IH+KwKXz7qJJBRMksING5HwDDrRfC1c1iw1nWb7+SHFun7m42T57xUwMX p1yQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NkxFWb995FakkLZLGJMKL8bJ2c/SSXP7hY31fmTC85o=; b=KMnFfP8LbtgC9eJZyfgxNrxhqr14RT8F8w8cQ6GafCPC5XKA+M0Rx+jjn/n1YdOijI QWcXuz+l0DPsnDFnDI5LsGEVuzO8R30fL/UvUOrr0XXUWhwYkXvOP1zTSPPU4KIHKV1N QkbJMx8SUeKF2yZJtdX4DmbZdXcm0dZgMWY/yBVN09IQ3gnDsZqnGxLKEmgyeegeoSpW 8slK1oQMxfriIu2s3IWSOFTMKQ0tni3CGcd4tCk9oY4ZfyZKq8ECMtn4mLw0Jl8oEhXp LMCLYp0GSxiphhN1Rkm8IORuJYe/E5GBwsf6xMCPw94yDEp5XHuyjTpxBPLDKgCYEorH 06yA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=f+qFETin; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h6-20020a1709063c0600b008cc211391bdsi482238ejg.820.2023.04.03.11.39.28; Mon, 03 Apr 2023 11:39:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=f+qFETin; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233341AbjDCSdU (ORCPT + 99 others); Mon, 3 Apr 2023 14:33:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233235AbjDCScu (ORCPT ); Mon, 3 Apr 2023 14:32:50 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2061.outbound.protection.outlook.com [40.107.94.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D3252712; Mon, 3 Apr 2023 11:32:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LGE7lPRykYgazZFk8sOEFnAa0Ba838WKmMTkLeaRn/7qsxvhZAL4BeOl6DOgpXz0x/G4ipaRjlAPIsafg/4DC5ai1AlnaUNLxvp3HsePuzSx+JQX7g0gLvnhHBRgS2jZikaPcKh/+U/D4U9yhUt3o0VCc02EhTFgd3s9g+aCBcOsnP/bcsh/UxYG58/+84oykWMwRHQJUfzLUeLq9sv/aShAytS0Lrf9SUc3VuyGvgFbjo+Myjww2v2RGxGaz4s6YcJ/8qOe8g+EYdjXCv2Tuea3M4/v0wxJWqKbTLMfnWir2XquwGntFLXMSV3KarYv2TrDPwyrLVje3WXM9TusRw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NkxFWb995FakkLZLGJMKL8bJ2c/SSXP7hY31fmTC85o=; b=kwWRNDvlmscqz1457wZIQaMDOiVHB97rqpeDprFtx5u63+qy5UhtR0gz1VtMEIFRqE1Qq5n8Dpytp6I0r0Q54qxrYwEx29CQy7p8g0zwJnwOuzUyVbDX0q1Ph0r/GWuxgSu2qsESt7AhVnxv3+Awqp2Z0S4gUVvRHk+0WK5oSydXm8q2BTldiUvb6yTrneGUhmxA1+5dwnClU962/H/y+ZqZOOHX2Scsxk9EUcsUSgV4FpZtNMIxiaJD/L5fhQHFDVRhlM5cjpbVN1xsVeDe0cUl+KwSMq5MLM9G8Qnc2U3Cz/1k8VFldoY9BJE2ZMgQX/zcgmS7Td3RbztCqFd/dQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=NkxFWb995FakkLZLGJMKL8bJ2c/SSXP7hY31fmTC85o=; b=f+qFETinAwYydm82bg+u+G13odUrpWVTDSCiZckvtbnYxlknBsUpEEI9FsK06EpQNWGiim6NSeLOIzmL87U09LlgBskGkm2qBDqrzfNHxgX6jN6FmawytEWUxVhzp9+gLihvxu/w/F69WqWkPgYdaKaOPCEAC1Lqc1wWwqD9sxY= Received: from BL1PR13CA0189.namprd13.prod.outlook.com (2603:10b6:208:2be::14) by SJ1PR12MB6049.namprd12.prod.outlook.com (2603:10b6:a03:48c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.33; Mon, 3 Apr 2023 18:32:43 +0000 Received: from BL02EPF000108E9.namprd05.prod.outlook.com (2603:10b6:208:2be:cafe::24) by BL1PR13CA0189.outlook.office365.com (2603:10b6:208:2be::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.26 via Frontend Transport; Mon, 3 Apr 2023 18:32:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF000108E9.mail.protection.outlook.com (10.167.241.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.30 via Frontend Transport; Mon, 3 Apr 2023 18:32:43 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 3 Apr 2023 13:32:35 -0500 From: Mario Limonciello To: Herbert Xu , Tom Lendacky , John Allen CC: Held Felix , , , Mark Hasemeyer , "Grzegorz Bernacki" , =?utf-8?b?SmFuIETEhWJyb8Wb?= , Mario Limonciello , "David S. Miller" , Subject: [PATCH v8 4/6] crypto: ccp: Use lower 8 bytes to communicate with doorbell command register Date: Mon, 3 Apr 2023 13:32:13 -0500 Message-ID: <20230403183216.3493-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230403183216.3493-1-mario.limonciello@amd.com> References: <20230403183216.3493-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF000108E9:EE_|SJ1PR12MB6049:EE_ X-MS-Office365-Filtering-Correlation-Id: 97cfa801-aa18-41c5-90f5-08db3471d043 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GYBWChJZBpHqtAbf1zQVOvOXOvpeCED52uhRjg+KJJsAa4wZu7QMDvn1an6JELN/M8gmWB9e8dQhYu3oViDlTPZXEuDlCI1Tt/v72F9K93NX4hvVYDhwF7tg7cMGL+mfodMQOIuI377cCQwQligegv5bOSdogd5nW6Tg9ARTS+/pjRBEPvpiPk0jx4jsTHs0UadB/7IslALaurKFuX4TpH+XdW8ropBdCne7C39aidauU83eHgalZSSbEq6YWS4bREjsgPSZJeGv0ObkyZzyM/bxdnQSFVZmsmR+lT6bpaKKGpOCsSGJoNiXthZunXk5hHwfg2Pw+dfUooEo6jdp1iXqrXDrRdvgz/gVTZXOvRVEg6gRMHFBv0ET1S2sTvgl+Rjs5YlydDzKTzlveEct4lpuWz9aNGBWb9du7dG2n7nK2yYoiIr/UJfCtv9O5/hwbY5MoZM4GB2GuLOIzOkHaGuDN/PIucFSIp19ljR8JlXgu2k5ywVRTdNw9FEhAeivvmGfABbnpUfyGsWAH2XPayINpbg3L9MjoOfLrkmm6+HnoxMdYg3Z5VtvpKVTv9oZtE1uTrxjQBk23UAdbwuWgUos91zOwvQP3O1SNhnmhnxp6cuBzmAB+MvAvULx+9UWUd7bYa1vFM5C9PFDcy8GNTDhzz3XvyvheCLUvsCwKLl2HrbSRb5MsjNBqjXDK8YqknAM5mddMSW2Q/MBFc8yUz7XZNmwfiT7dT3h8+/SRSk= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(376002)(39860400002)(396003)(136003)(451199021)(46966006)(40470700004)(36840700001)(82310400005)(81166007)(356005)(86362001)(82740400003)(40460700003)(6636002)(316002)(54906003)(2906002)(110136005)(478600001)(6666004)(36756003)(40480700001)(41300700001)(5660300002)(7696005)(26005)(47076005)(1076003)(83380400001)(4326008)(44832011)(70206006)(70586007)(8936002)(36860700001)(8676002)(336012)(186003)(2616005)(426003)(16526019)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2023 18:32:43.2626 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 97cfa801-aa18-41c5-90f5-08db3471d043 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF000108E9.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6049 X-Spam-Status: No, score=0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762181453246517097?= X-GMAIL-MSGID: =?utf-8?q?1762181453246517097?= Unlike other command registers used by the PSP, only the lower 8 bytes are used for communication for both command and status of the command. Suggested-by: Mark Hasemeyer Signed-off-by: Mario Limonciello Reviewed-by: Mark Hasemeyer Tested-by: Mark Hasemeyer --- drivers/crypto/ccp/platform-access.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/ccp/platform-access.c b/drivers/crypto/ccp/platform-access.c index 48f59ae91692..939c924fc383 100644 --- a/drivers/crypto/ccp/platform-access.c +++ b/drivers/crypto/ccp/platform-access.c @@ -19,6 +19,7 @@ #include "platform-access.h" #define PSP_CMD_TIMEOUT_US (500 * USEC_PER_MSEC) +#define DOORBELL_CMDRESP_STS GENMASK(7, 0) /* Recovery field should be equal 0 to start sending commands */ static int check_recovery(u32 __iomem *cmd) @@ -154,7 +155,7 @@ int psp_ring_platform_doorbell(int msg, u32 *result) goto unlock; } - iowrite32(FIELD_PREP(PSP_DRBL_MSG, msg), cmd); + iowrite32(FIELD_PREP(DOORBELL_CMDRESP_STS, msg), cmd); iowrite32(PSP_DRBL_RING, button); if (wait_cmd(cmd)) { @@ -162,7 +163,7 @@ int psp_ring_platform_doorbell(int msg, u32 *result) goto unlock; } - val = FIELD_GET(PSP_CMDRESP_STS, ioread32(cmd)); + val = FIELD_GET(DOORBELL_CMDRESP_STS, ioread32(cmd)); if (val) { if (result) *result = val; From patchwork Mon Apr 3 18:32:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 78687 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2528663vqo; Mon, 3 Apr 2023 12:16:32 -0700 (PDT) X-Google-Smtp-Source: AKy350aQhNQQ1+Koz9LxS+XW2jxwPQ1lBQ+TTZoRBvAWjf0rOZcTzj3pFh4nv0VMNk4Uy2aBGIQs X-Received: by 2002:a17:907:318b:b0:948:b988:8cc3 with SMTP id xe11-20020a170907318b00b00948b9888cc3mr3043730ejb.75.1680549391814; Mon, 03 Apr 2023 12:16:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680549391; cv=pass; d=google.com; s=arc-20160816; b=lUyP8jY23GuxJfZ2nkOKElob5tcrDGG7dK8rc88DEsiLDFMY68RCyL/5v8LBxIWmnB G5LKYwUtjv0WtPnUU7UPSVUh9abdXVKQKHlSTUlzou0H7yZ4lZzPtRX9TFTXIyWdGhGk 60BIclGP24IxM06wgLrsA5ZlcBHuXl3yXNNNBE3Vy40dAZAAiuk3MPO1x+7DppGgrddv sGaWZA8EpxXKr5zDbI6SxNcpGCwlVwe3cCIJ212uLAQvgEvwilPXW2aKhTahn/IV3CSB SjaFehBjCLmQMvNdunMigYe4cMJ0OkiOjGBQ0VyN6G2eNiBNfe07F7uN9/cZUh2ow/gw VIBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bMV8quoeXMSlZ6qbOJcT+4gf9PhcANIuYBy/bVjzo+M=; b=dtIO+1ioeW9HsH5LbILVIc6GZjGug5h0/z1L4DZGkl67klD6mJd7k1fwrE2xZjvI+g sHEiGI/6QyvLMxw1ERRbWEHiuThX5iNhwhiWyUb0m9tHpE2Csx2UHU9x+0BjqS2O07LG yyRmMnO44CpSx/FR3NlDF6jKPOleVap3lXdBmqnViXKE3yxveDPDbZlMBONjJprud3dO XvOtvWPHXIvQLr28Z7+5VS1DCWgZUB2FfPlQPLaxNlbunPAYdllGsyqmQiq0ytg2X5oQ sJijpSrHnkh6jWtm3pVbmJsLN5V41QSIzjbUIBioZFMuEZSAPoHNPpFVvZCZqCEHusAe c4sw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="OTH4/X/E"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e12-20020a170906080c00b00939577d1dbbsi6452454ejd.73.2023.04.03.12.16.07; Mon, 03 Apr 2023 12:16:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="OTH4/X/E"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233325AbjDCSdJ (ORCPT + 99 others); Mon, 3 Apr 2023 14:33:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233236AbjDCScu (ORCPT ); Mon, 3 Apr 2023 14:32:50 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2067.outbound.protection.outlook.com [40.107.244.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 793BD271C; Mon, 3 Apr 2023 11:32:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FnfVbSysY3h2zwoqbEaououcwnVJKV7h2OrOIm98VtBsT9cEDuMmc1L6jGFOSgvdrbUs5Z173aCl3Xxr2/5gsxyM2FO9bHmkoHpC5W/GCQcI+F7I2//TF84PZ7livAZHLXi+21luUpOieMc5P/bbhVuwqFBGv92tdX97p4vq/JsLsk6DyHjJJl7rrO33EpYqyBdKUBj6jPzZb3BnPDUU/dU4QnEgzTI/nWP/1bP4DvvNLhGXxXnIqiM47hovUbRAOyMI/YO05ANb3sxlRA/RyKEuVk72ouNYnMmoC6RUAM0DgyjMKZvjn4fphJIh5rTWZy5kha4rYgYQEb6Uf9lXrQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bMV8quoeXMSlZ6qbOJcT+4gf9PhcANIuYBy/bVjzo+M=; b=QeBSiX7RrolvcvVGZHwmEwT0PuQQ+0Uo/UFlFtuQ5Lcck5rbco+OALAtWqJIYNXTG2GUJCP12KwsjKyxObusEDwnBwvvRT+uiQZ+oBTSVOE4bR+AiOh2yWOTH7QmRKYcl9GNVp+URSIBqJbXnhmaBVBsttQWuXbSpx/DmTnQsWJbC6qZG6t/7b9ZC36Lc2Z2PbOJORE1zuTsEp/6zPyF/wkAwQgi66/QUCLr1dwa5NSfkrOuVwfLV4eY7jM8YKkBrmjd7VHGgkW7MTTR1LWPqRwMfm+ZKTxlyM/gLwY7gFBXETLV5zb2/12incKmq+QyrIXbSjUCaal+8fydTMn9Fg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=bMV8quoeXMSlZ6qbOJcT+4gf9PhcANIuYBy/bVjzo+M=; b=OTH4/X/E39QlGfsg5COuVVc4bH+zEu6Im8g9bWauH3q7CUEdoECuDs5u+/7go7NJJ0N9LZ1UcixJpcDUPQAjR01FNjUkpwnHlFaiPJy+31uczJk5zJc7AdukhUUw8A9npZtfmBEPp6D8/EDzeOQ6Mgt2MHewIjWN1AQdh9e+IZg= Received: from BL1PR13CA0195.namprd13.prod.outlook.com (2603:10b6:208:2be::20) by BL1PR12MB5755.namprd12.prod.outlook.com (2603:10b6:208:392::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.29; Mon, 3 Apr 2023 18:32:43 +0000 Received: from BL02EPF000108E9.namprd05.prod.outlook.com (2603:10b6:208:2be:cafe::91) by BL1PR13CA0195.outlook.office365.com (2603:10b6:208:2be::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.26 via Frontend Transport; Mon, 3 Apr 2023 18:32:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF000108E9.mail.protection.outlook.com (10.167.241.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.30 via Frontend Transport; Mon, 3 Apr 2023 18:32:43 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 3 Apr 2023 13:32:37 -0500 From: Mario Limonciello To: Herbert Xu , Jarkko Nikula , Andy Shevchenko , Mika Westerberg , Jan Dabros CC: Held Felix , , , Mark Hasemeyer , "Grzegorz Bernacki" , Mario Limonciello Subject: [PATCH v8 5/6] i2c: designware: Use PCI PSP driver for communication Date: Mon, 3 Apr 2023 13:32:14 -0500 Message-ID: <20230403183216.3493-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230403183216.3493-1-mario.limonciello@amd.com> References: <20230403183216.3493-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF000108E9:EE_|BL1PR12MB5755:EE_ X-MS-Office365-Filtering-Correlation-Id: 93d4a41e-8146-45af-3ecb-08db3471d092 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SQZXPaTJzcevMgTpk+5GyqhfvFuecOvvkUV+RJAFI8WtDQpTX2V17vJiul9PCTla6dnsEus0kjZoh/9jOM1EjL71L9blfPhoE5VNCJPFZGij1I7n4D+OBbr6+oPd6PV9shjDChcv/YCTAk5SciFfVfx4c6oro3fuWsrOAb4Cf03i1TDyFIZl3OKNBhbNv71u5Y9RTq07G6SpWWqatB5mlLWi8G4T1PDUaKxPnGTJHD4qlJX+3fN+svj9OUYaf6DNjlfGOxZzT0PjYlf+LBy8Ee++/MwAbuXHGV4t9aK8iIbUIvIQQOhSR8+zkqoccmomausHuKRqGrck2aphhHE/8Dsv8LJndigDiKkd4O7o+Os1Dk57kch7/j+0C79Edvmw5TwXPSi3wq1gw07+mNH8SEfuYRxY3BwokbJ89sWsU28Smf7SmD4IfJmgbn9LsHJwo8+tgUgxzWsT04RiRyE/W4lUesMdW+KUD7LxYiuQXCGQD4NWJTeasXqfO9ravWEvJKZzmthq05gxDK3jWltnClX6DffWRj+bg2Zs3oq0kJKzxWkLdrlSTdz4l/5u+jZliI4YZgvvv1695LSaJWCiBXZHmvzosOjTjyoknbT0VH/gSBKHG9XqwHVbYVrEI/kzXBe5OW1Jn/+4QP+29iZ0S49ZpnxWzA4E47ABjSw2/JI0uJRJ1REdX6txMF94jHB2glbiHKEXiqTqZNq9H8lYv/Pv32wRheV/PKlHdDCxjLE= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(396003)(346002)(376002)(136003)(451199021)(40470700004)(36840700001)(46966006)(2906002)(40460700003)(8676002)(5660300002)(8936002)(82740400003)(81166007)(41300700001)(356005)(44832011)(2616005)(36756003)(82310400005)(40480700001)(86362001)(6666004)(7696005)(26005)(1076003)(54906003)(478600001)(36860700001)(83380400001)(47076005)(336012)(426003)(16526019)(186003)(70206006)(70586007)(4326008)(110136005)(316002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2023 18:32:43.7782 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 93d4a41e-8146-45af-3ecb-08db3471d092 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF000108E9.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5755 X-Spam-Status: No, score=0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762183758874303037?= X-GMAIL-MSGID: =?utf-8?q?1762183758874303037?= Currently the PSP semaphore communication base address is discovered by using an MSR that is not architecturally guaranteed for future platforms. Also the mailbox that is utilized for communication with the PSP may have other consumers in the kernel, so it's better to make all communication go through a single driver. Signed-off-by: Mario Limonciello Reviewed-by: Mark Hasemeyer Acked-by: Jarkko Nikula Tested-by: Mark Hasemeyer Acked-by: Wolfram Sang --- v7->v8: * Drop hunk changing error message * Stop using imply. As shown by failed configs for kernel robot we need stronger dependencies. Model them off of I2C_DESIGNWARE_BAYTRAIL which has a similar relationship --- drivers/i2c/busses/Kconfig | 4 +- drivers/i2c/busses/i2c-designware-amdpsp.c | 175 +++----------------- drivers/i2c/busses/i2c-designware-core.h | 1 - drivers/i2c/busses/i2c-designware-platdrv.c | 1 - include/linux/psp-platform-access.h | 1 + 5 files changed, 29 insertions(+), 153 deletions(-) diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 25eb4e8fd22f..89f8b75043d0 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -566,9 +566,11 @@ config I2C_DESIGNWARE_PLATFORM config I2C_DESIGNWARE_AMDPSP bool "AMD PSP I2C semaphore support" - depends on X86_MSR depends on ACPI + depends on CRYPTO_DEV_SP_PSP depends on I2C_DESIGNWARE_PLATFORM + depends on (I2C_DESIGNWARE_PLATFORM=y && CRYPTO_DEV_CCP_DD=y) || \ + (I2C_DESIGNWARE_PLATFORM=m && CRYPTO_DEV_CCP_DD) help This driver enables managed host access to the selected I2C bus shared between AMD CPU and AMD PSP. diff --git a/drivers/i2c/busses/i2c-designware-amdpsp.c b/drivers/i2c/busses/i2c-designware-amdpsp.c index 652e6b64bd5f..12870dc44bdb 100644 --- a/drivers/i2c/busses/i2c-designware-amdpsp.c +++ b/drivers/i2c/busses/i2c-designware-amdpsp.c @@ -1,35 +1,20 @@ // SPDX-License-Identifier: GPL-2.0 -#include -#include #include -#include +#include #include -#include #include -#include - #include "i2c-designware-core.h" -#define MSR_AMD_PSP_ADDR 0xc00110a2 -#define PSP_MBOX_OFFSET 0x10570 -#define PSP_CMD_TIMEOUT_US (500 * USEC_PER_MSEC) - #define PSP_I2C_RESERVATION_TIME_MS 100 -#define PSP_I2C_REQ_BUS_CMD 0x64 #define PSP_I2C_REQ_RETRY_CNT 400 #define PSP_I2C_REQ_RETRY_DELAY_US (25 * USEC_PER_MSEC) #define PSP_I2C_REQ_STS_OK 0x0 #define PSP_I2C_REQ_STS_BUS_BUSY 0x1 #define PSP_I2C_REQ_STS_INV_PARAM 0x3 -struct psp_req_buffer_hdr { - u32 total_size; - u32 status; -}; - enum psp_i2c_req_type { PSP_I2C_REQ_ACQUIRE, PSP_I2C_REQ_RELEASE, @@ -41,119 +26,12 @@ struct psp_i2c_req { enum psp_i2c_req_type type; }; -struct psp_mbox { - u32 cmd_fields; - u64 i2c_req_addr; -} __packed; - static DEFINE_MUTEX(psp_i2c_access_mutex); static unsigned long psp_i2c_sem_acquired; -static void __iomem *mbox_iomem; static u32 psp_i2c_access_count; static bool psp_i2c_mbox_fail; static struct device *psp_i2c_dev; -/* - * Implementation of PSP-x86 i2c-arbitration mailbox introduced for AMD Cezanne - * family of SoCs. - */ - -static int psp_get_mbox_addr(unsigned long *mbox_addr) -{ - unsigned long long psp_mmio; - - if (rdmsrl_safe(MSR_AMD_PSP_ADDR, &psp_mmio)) - return -EIO; - - *mbox_addr = (unsigned long)(psp_mmio + PSP_MBOX_OFFSET); - - return 0; -} - -static int psp_mbox_probe(void) -{ - unsigned long mbox_addr; - int ret; - - ret = psp_get_mbox_addr(&mbox_addr); - if (ret) - return ret; - - mbox_iomem = ioremap(mbox_addr, sizeof(struct psp_mbox)); - if (!mbox_iomem) - return -ENOMEM; - - return 0; -} - -/* Recovery field should be equal 0 to start sending commands */ -static int psp_check_mbox_recovery(struct psp_mbox __iomem *mbox) -{ - u32 tmp; - - tmp = readl(&mbox->cmd_fields); - - return FIELD_GET(PSP_CMDRESP_RECOVERY, tmp); -} - -static int psp_wait_cmd(struct psp_mbox __iomem *mbox) -{ - u32 tmp, expected; - - /* Expect mbox_cmd to be cleared and the response bit to be set by PSP */ - expected = FIELD_PREP(PSP_CMDRESP_RESP, 1); - - /* - * Check for readiness of PSP mailbox in a tight loop in order to - * process further as soon as command was consumed. - */ - return readl_poll_timeout(&mbox->cmd_fields, tmp, (tmp == expected), - 0, PSP_CMD_TIMEOUT_US); -} - -/* Status equal to 0 means that PSP succeed processing command */ -static u32 psp_check_mbox_sts(struct psp_mbox __iomem *mbox) -{ - u32 cmd_reg; - - cmd_reg = readl(&mbox->cmd_fields); - - return FIELD_GET(PSP_CMDRESP_STS, cmd_reg); -} - -static int psp_send_cmd(struct psp_i2c_req *req) -{ - struct psp_mbox __iomem *mbox = mbox_iomem; - phys_addr_t req_addr; - u32 cmd_reg; - - if (psp_check_mbox_recovery(mbox)) - return -EIO; - - if (psp_wait_cmd(mbox)) - return -EBUSY; - - /* - * Fill mailbox with address of command-response buffer, which will be - * used for sending i2c requests as well as reading status returned by - * PSP. Use physical address of buffer, since PSP will map this region. - */ - req_addr = __psp_pa((void *)req); - writeq(req_addr, &mbox->i2c_req_addr); - - /* Write command register to trigger processing */ - cmd_reg = FIELD_PREP(PSP_CMDRESP_CMD, PSP_I2C_REQ_BUS_CMD); - writel(cmd_reg, &mbox->cmd_fields); - - if (psp_wait_cmd(mbox)) - return -ETIMEDOUT; - - if (psp_check_mbox_sts(mbox)) - return -EIO; - - return 0; -} - /* Helper to verify status returned by PSP */ static int check_i2c_req_sts(struct psp_i2c_req *req) { @@ -173,22 +51,25 @@ static int check_i2c_req_sts(struct psp_i2c_req *req) } } -static int psp_send_check_i2c_req(struct psp_i2c_req *req) +/* + * Errors in x86-PSP i2c-arbitration protocol may occur at two levels: + * 1. mailbox communication - PSP is not operational or some IO errors with + * basic communication had happened. + * 2. i2c-requests - PSP refuses to grant i2c arbitration to x86 for too long. + * + * In order to distinguish between these in error handling code all mailbox + * communication errors on the first level (from CCP symbols) will be passed + * up and if -EIO is returned the second level will be checked. + */ +static int psp_send_i2c_req_cezanne(struct psp_i2c_req *req) { - /* - * Errors in x86-PSP i2c-arbitration protocol may occur at two levels: - * 1. mailbox communication - PSP is not operational or some IO errors - * with basic communication had happened; - * 2. i2c-requests - PSP refuses to grant i2c arbitration to x86 for too - * long. - * In order to distinguish between these two in error handling code, all - * errors on the first level (returned by psp_send_cmd) are shadowed by - * -EIO. - */ - if (psp_send_cmd(req)) - return -EIO; + int ret; - return check_i2c_req_sts(req); + ret = psp_send_platform_access_msg(PSP_I2C_REQ_BUS_CMD, (struct psp_request *)req); + if (ret == -EIO) + return check_i2c_req_sts(req); + + return ret; } static int psp_send_i2c_req(enum psp_i2c_req_type i2c_req_type) @@ -202,11 +83,11 @@ static int psp_send_i2c_req(enum psp_i2c_req_type i2c_req_type) if (!req) return -ENOMEM; - req->hdr.total_size = sizeof(*req); + req->hdr.payload_size = sizeof(*req); req->type = i2c_req_type; start = jiffies; - ret = read_poll_timeout(psp_send_check_i2c_req, status, + ret = read_poll_timeout(psp_send_i2c_req_cezanne, status, (status != -EBUSY), PSP_I2C_REQ_RETRY_DELAY_US, PSP_I2C_REQ_RETRY_CNT * PSP_I2C_REQ_RETRY_DELAY_US, @@ -381,7 +262,8 @@ static const struct i2c_lock_operations i2c_dw_psp_lock_ops = { int i2c_dw_amdpsp_probe_lock_support(struct dw_i2c_dev *dev) { - int ret; + if (!IS_REACHABLE(CONFIG_CRYPTO_DEV_CCP_DD)) + return -ENODEV; if (!dev) return -ENODEV; @@ -393,11 +275,10 @@ int i2c_dw_amdpsp_probe_lock_support(struct dw_i2c_dev *dev) if (psp_i2c_dev) return -EEXIST; - psp_i2c_dev = dev->dev; + if (psp_check_platform_access_status()) + return -EPROBE_DEFER; - ret = psp_mbox_probe(); - if (ret) - return ret; + psp_i2c_dev = dev->dev; dev_info(psp_i2c_dev, "I2C bus managed by AMD PSP\n"); @@ -411,9 +292,3 @@ int i2c_dw_amdpsp_probe_lock_support(struct dw_i2c_dev *dev) return 0; } - -/* Unmap area used as a mailbox with PSP */ -void i2c_dw_amdpsp_remove_lock_support(struct dw_i2c_dev *dev) -{ - iounmap(mbox_iomem); -} diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h index 050d8c63ad3c..c5d87aae39c6 100644 --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h @@ -383,7 +383,6 @@ int i2c_dw_baytrail_probe_lock_support(struct dw_i2c_dev *dev); #if IS_ENABLED(CONFIG_I2C_DESIGNWARE_AMDPSP) int i2c_dw_amdpsp_probe_lock_support(struct dw_i2c_dev *dev); -void i2c_dw_amdpsp_remove_lock_support(struct dw_i2c_dev *dev); #endif int i2c_dw_validate_speed(struct dw_i2c_dev *dev); diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 74182db03a88..89ad88c54754 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -214,7 +214,6 @@ static const struct i2c_dw_semaphore_callbacks i2c_dw_semaphore_cb_table[] = { #ifdef CONFIG_I2C_DESIGNWARE_AMDPSP { .probe = i2c_dw_amdpsp_probe_lock_support, - .remove = i2c_dw_amdpsp_remove_lock_support, }, #endif {} diff --git a/include/linux/psp-platform-access.h b/include/linux/psp-platform-access.h index 1b661341d8f3..75da8f5f7ad8 100644 --- a/include/linux/psp-platform-access.h +++ b/include/linux/psp-platform-access.h @@ -7,6 +7,7 @@ enum psp_platform_access_msg { PSP_CMD_NONE = 0x0, + PSP_I2C_REQ_BUS_CMD = 0x64, }; struct psp_req_buffer_hdr { From patchwork Mon Apr 3 18:32:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 78683 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2507095vqo; Mon, 3 Apr 2023 11:41:16 -0700 (PDT) X-Google-Smtp-Source: AKy350ZkreJVrODiBkPdbT7siQ5WqnmWSVKG81Liota/pslVNXzIi4aRTe1Ly73cdEczhYx9bxS6 X-Received: by 2002:a17:906:7949:b0:93d:a14f:c9b2 with SMTP id l9-20020a170906794900b0093da14fc9b2mr41940916ejo.4.1680547275994; Mon, 03 Apr 2023 11:41:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680547275; cv=pass; d=google.com; s=arc-20160816; b=LOsAYdeisfXa2gjlemG9jIrCfpGg6cxkFYSz8i+ylrRBx3avdjM4SjaHee/5lkARz7 viGEnTcMAf0ym09Digoo9LxRM4RB0Ym7v6znsIgap6gj5W7ka/oq8WrSCdwk9B/OkgVb WboRCApAs9MMR2SEOwqBgswO0N2Upym1BLcN3PRZuL0rsYKf1nLsheqPubNb39wVz+gi 2CYGERTh1lwlekyFAHRTsncanYg6zw8cjTNLuELMCKytvaHgb8ErjHhVyvKetII8bKAA u7YEFpk0LU9beaS4NWWQznmMJUXOobss3V5dDDzMMxp32nslfOZmRLqNRBdW7YyxuGBs tT0g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=77nPVA5wWjenZP1nJ46p1Xi+uNhV+OZxPX3G1omeKGI=; b=ggbi9mrdGT+xR5ZTr6/j/vm3g14zzAvX2ur9tyWyKv1yi/mzmeNXMSJ0rqYnocWwZq k6XHAUlOLv+k1HTEhVtPjF4xLqC2A0kANmq/u+xUcQ2bwu8BOddfQqIGWlnsgAj/F7t1 MfVmMYvBRPo3bbsbWUhtLE3z+zHbo0K9Cy7loJH/qJ8X5vJNNsw/diL9RiqFr41G2Psu 74FcjAig+DyWNpSmV7kg/Cks17wN1WQU2L+ioHFt4s4QCcGWiOTfZ6re7GJdQG5X6Fod yDAuF+aRwgyUF6Ag/bFkLYkGEMNpFEilUyVYB9v1awCarOvxtgKBKvYoUuVk5YSiDreC tYow== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=0WPxo6Bc; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc43-20020a17090716ab00b0091452fdf543si5160926ejc.810.2023.04.03.11.40.51; Mon, 03 Apr 2023 11:41:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=0WPxo6Bc; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233333AbjDCSdP (ORCPT + 99 others); Mon, 3 Apr 2023 14:33:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233237AbjDCScu (ORCPT ); Mon, 3 Apr 2023 14:32:50 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on20616.outbound.protection.outlook.com [IPv6:2a01:111:f400:7ea9::616]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E73632704; Mon, 3 Apr 2023 11:32:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=khrYSxZMckhq8FoBW6nNN7iyyn/ZUQ8a3mo2BFoJm0/+ew0lsx7+zkSTDDTa5HGxQg7yRkars0uWiu3QBKglGwTFk5ns6HkXLsnIszL/VjpPf9qrA5q2tmBDPXpjKu0WrMkVKvHlAM5uHbBWseRWiskNt/I7PwY64ezRib6QuWkcqW7x6UmdQQWz/+13/kqb+2c+99RKw2XPJ2DY/O+T3CoA64zaA9rtPp5akuHGJe4OsuYJbOMGs9EFwi/U2xSls1Zn5Yw0mbKtZfUWczimv4HcAtbNQnSc/7ZSBCK/GmXZl9LmutGM3bVTiHPcmVuSQv/MO2L9dKip/Gg2wtGSzg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=77nPVA5wWjenZP1nJ46p1Xi+uNhV+OZxPX3G1omeKGI=; b=A5q6yBNICSrz2T0sHFyK0p9nKskoOfMcTeKzEPrPW4o4uG0poqrTSXItkkxOAAz7XmJ4SdHqEmSsfIMV6hUxYfqcVPfp82o2x5C3p5IcOFXyrsuTeXrphEYbIpuY9HA4fS4A7yT7T87VhB95c9R975IEazGhRGjW72O+yaB0VBLx0ERZ2m3jTpwflWLo6D78z/Cf2zwV+yaca38uLsUArzR2PP2aAYn5ORLComFZDUUdlHIm5DqOiajWlzDi57ubhwBFAPdUwH/8v4USL+DDNjOQPAjwnYSIPulWggDcoo2u3B8+OBE0J+u5FM9x3pLReyjovJbuSyIbcoQElqTAlA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=77nPVA5wWjenZP1nJ46p1Xi+uNhV+OZxPX3G1omeKGI=; b=0WPxo6Bczmt13TjcHy5GUfnZ7MU17yBVKMcGwxeZgtCP4NgtwZEY25pDDmPJKfhYdFKHTPix9pV2opYUorDaG5UibCf/1z965EXTONashU3XoEenE504UalZTI90usoPSngOMPnsaG9mWLTZ6Cs7NQvoEgh98wSFu24FMliiGbc= Received: from BL1PR13CA0192.namprd13.prod.outlook.com (2603:10b6:208:2be::17) by DM4PR12MB5280.namprd12.prod.outlook.com (2603:10b6:5:39d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.33; Mon, 3 Apr 2023 18:32:44 +0000 Received: from BL02EPF000108E9.namprd05.prod.outlook.com (2603:10b6:208:2be:cafe::2e) by BL1PR13CA0192.outlook.office365.com (2603:10b6:208:2be::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.26 via Frontend Transport; Mon, 3 Apr 2023 18:32:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF000108E9.mail.protection.outlook.com (10.167.241.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.30 via Frontend Transport; Mon, 3 Apr 2023 18:32:44 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 3 Apr 2023 13:32:38 -0500 From: Mario Limonciello To: Herbert Xu , Jarkko Nikula , Andy Shevchenko , Mika Westerberg , Jan Dabros CC: Held Felix , , , Mark Hasemeyer , "Grzegorz Bernacki" , Mario Limonciello Subject: [PATCH v8 6/6] i2c: designware: Add doorbell support for Mendocino Date: Mon, 3 Apr 2023 13:32:15 -0500 Message-ID: <20230403183216.3493-7-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230403183216.3493-1-mario.limonciello@amd.com> References: <20230403183216.3493-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF000108E9:EE_|DM4PR12MB5280:EE_ X-MS-Office365-Filtering-Correlation-Id: 17d0190e-ac91-4cc6-edde-08db3471d0c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2t0PZ7XLgzyJRegGCc9MmWrJEvX/L39WWbd1fydl//f80hfVqXq40JJYTZEU7r6gzsMgn7J2KrOb+VMhx69mT898BKA1F0ECxOLyvXVavRDptqncG4KCIuQ1GjeVN4ZCndsNXOx6ydGRv22M1IQyYJD+BDsXvsGUMsMjfgA70BH6fN0oG0nfggR7HWLHC5sMrVMS2InQLL8dgDMVaxKqJRLgBvFW9dMCctcOPCKvCg8P+1XWCxY5n3gIUAGHI4BPA2ieUFz1GQvQQjdxJ1OxqVQ8SfKPWo0FiRYhng2sJE4d+yoiSUiBbmFSnQVYyMLC5NXO3KNzwg1sMk4UCeRGIeCbHHXqBAydifAaSmVpb+VxVg0fNJkF9lLHkBglYAdco+n6VBdp8WFsWGw5zVX8ZLTSLajmp8whQUZ3n+QJtc7M41rboZ1yJKi9xFdEj229vaQs0hdjeICJKdv1lGLI4QC5ia8VQ1/LzNZZjK3VIEFL7fbL4aP9mwlvVuENp0k6BN+ovQxxI/e5mKQ/mOqm1YKYtM8XRoPRcDyU+QD/v2KZVld6dw3nBpldyRdZKpECnAwNvXx2YTompC8MOtM8rx7SvxowGoBY8KebezNQ3wj6ULjAMGfqMR+3qWz8LsZVxtMs3GqGCT2R4Z2GpzlsZVgQL4y92vm9FS9hb6KTjDW0imbRcC1AuQALzHVV1kguaVMrPhrI1N13iEOGDafWeZucxra0042oqOYUWNFIU6c= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(396003)(39860400002)(376002)(136003)(451199021)(36840700001)(40470700004)(46966006)(40480700001)(40460700003)(36860700001)(4326008)(8676002)(316002)(70586007)(70206006)(478600001)(110136005)(8936002)(54906003)(41300700001)(356005)(82740400003)(81166007)(44832011)(5660300002)(426003)(186003)(47076005)(83380400001)(16526019)(2616005)(336012)(6666004)(26005)(1076003)(86362001)(36756003)(2906002)(82310400005)(7696005)(966005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2023 18:32:44.0907 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 17d0190e-ac91-4cc6-edde-08db3471d0c1 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF000108E9.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5280 X-Spam-Status: No, score=0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762181540594187448?= X-GMAIL-MSGID: =?utf-8?q?1762181540594187448?= Mendocino and later platform don't use the platform feature mailbox for communication for I2C arbitration, they rely upon ringing a doorbell. Detect the platform by the device ID of the root port and choose the appropriate method. Link: https://lore.kernel.org/linux-i2c/20220916131854.687371-3-jsd@semihalf.com/ Signed-off-by: Mario Limonciello Acked-by: Jarkko Nikula Reviewed-by: Mark Hasemeyer Tested-by: Mark Hasemeyer Acked-by: Wolfram Sang --- drivers/i2c/busses/Kconfig | 1 + drivers/i2c/busses/i2c-designware-amdpsp.c | 26 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 89f8b75043d0..4b4323bbf268 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -568,6 +568,7 @@ config I2C_DESIGNWARE_AMDPSP bool "AMD PSP I2C semaphore support" depends on ACPI depends on CRYPTO_DEV_SP_PSP + depends on PCI depends on I2C_DESIGNWARE_PLATFORM depends on (I2C_DESIGNWARE_PLATFORM=y && CRYPTO_DEV_CCP_DD=y) || \ (I2C_DESIGNWARE_PLATFORM=m && CRYPTO_DEV_CCP_DD) diff --git a/drivers/i2c/busses/i2c-designware-amdpsp.c b/drivers/i2c/busses/i2c-designware-amdpsp.c index 12870dc44bdb..63454b06e5da 100644 --- a/drivers/i2c/busses/i2c-designware-amdpsp.c +++ b/drivers/i2c/busses/i2c-designware-amdpsp.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include +#include #include #include #include @@ -32,6 +33,8 @@ static u32 psp_i2c_access_count; static bool psp_i2c_mbox_fail; static struct device *psp_i2c_dev; +static int (*_psp_send_i2c_req)(struct psp_i2c_req *req); + /* Helper to verify status returned by PSP */ static int check_i2c_req_sts(struct psp_i2c_req *req) { @@ -72,6 +75,17 @@ static int psp_send_i2c_req_cezanne(struct psp_i2c_req *req) return ret; } +static int psp_send_i2c_req_doorbell(struct psp_i2c_req *req) +{ + int ret; + + ret = psp_ring_platform_doorbell(req->type, &req->hdr.status); + if (ret == -EIO) + return check_i2c_req_sts(req); + + return ret; +} + static int psp_send_i2c_req(enum psp_i2c_req_type i2c_req_type) { struct psp_i2c_req *req; @@ -87,7 +101,7 @@ static int psp_send_i2c_req(enum psp_i2c_req_type i2c_req_type) req->type = i2c_req_type; start = jiffies; - ret = read_poll_timeout(psp_send_i2c_req_cezanne, status, + ret = read_poll_timeout(_psp_send_i2c_req, status, (status != -EBUSY), PSP_I2C_REQ_RETRY_DELAY_US, PSP_I2C_REQ_RETRY_CNT * PSP_I2C_REQ_RETRY_DELAY_US, @@ -262,6 +276,8 @@ static const struct i2c_lock_operations i2c_dw_psp_lock_ops = { int i2c_dw_amdpsp_probe_lock_support(struct dw_i2c_dev *dev) { + struct pci_dev *rdev; + if (!IS_REACHABLE(CONFIG_CRYPTO_DEV_CCP_DD)) return -ENODEV; @@ -275,6 +291,14 @@ int i2c_dw_amdpsp_probe_lock_support(struct dw_i2c_dev *dev) if (psp_i2c_dev) return -EEXIST; + /* Cezanne uses platform mailbox, Mendocino and later use doorbell */ + rdev = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0)); + if (rdev->device == 0x1630) + _psp_send_i2c_req = psp_send_i2c_req_cezanne; + else + _psp_send_i2c_req = psp_send_i2c_req_doorbell; + pci_dev_put(rdev); + if (psp_check_platform_access_status()) return -EPROBE_DEFER;