From patchwork Fri May 19 03:24: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: 684045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86385C77B75 for ; Fri, 19 May 2023 17:28:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230203AbjESR2h (ORCPT ); Fri, 19 May 2023 13:28:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229932AbjESR2e (ORCPT ); Fri, 19 May 2023 13:28:34 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2081.outbound.protection.outlook.com [40.107.93.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ADFFBC; Fri, 19 May 2023 10:28:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fZrguVHrmYErYxtd29Huhph1aXDrTMzXiCjMq75ywSgEGOF9O05NSExFatA8P84gkte8f/dtdLEdsxKCpk6moBiSFzgUqBt9NxobH4Jh4enodl22AYZ5GI+Q3bDpgusXK/CQ/LZULMgpv354t/bzKL8KeK03ZcjDfox37xEvaBFiQ0OVbW9AH1ovg3g38KciIZPggUeigg/l/9GXrZ4r5WfbMWnhK8vrsDNajXPxTpD9dG5UydAldFsOo/HgtFREE9auHsI9iHWGKVDlmlXakLR4EhdIy5CWzt1Ppw1/Q2F/iEd/QYlcqqV7gbkcZwrsyTnrO5Z00VSLySonf8NYMg== 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=xISGo/DhlU67XWiPpElk8BO8w40MEfpTWkofp4Jk8Y0=; b=Rta91m8shJsC+69UWLTJcQ5nSqKb3l62IxTTf+AiW2zZiKA2IZdZ615SwQX6w6q1w62jCgBPWPT76mlPubJyAjklZP/aMwfA2T5iU7FgMIYYpFgGStnxSlGImVqLHJneSI3G0udddXgq/nMiURFosATR0iaeNGwkFwLuorLah7+EUp767HfgawZcn6nh+cJThfwBJ47ztfUcCDn7OKZnxCkDlLu01YXdiYtlQkvbV1/Asq6pFzKUWBViEpVShA2DrL5fZFBFX0BUek7JuJQMIoZUBLC0MLTPMY84KRHfdSpcdo1J5ir58qoZlbxlXpoJ3i2tC3QF7dvonIoFLCxAQg== 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=xISGo/DhlU67XWiPpElk8BO8w40MEfpTWkofp4Jk8Y0=; b=uZz06JUWBiRyxhYs2ZlxKSFg6Nl6xT7mvrw7m3hdmCpoKXQGTuv84VAwA2M7cjOpbILaQFYhmA+L0Hl3RiwERGkhZO9Rt2MnZKTpzFQcpvIMSHvOE3N2/EplNuJQuwA9GQp6rZ1rI4G9+AWhf//tKj5sr5xderRY+qqHYhoWpK8= Received: from DM6PR02CA0147.namprd02.prod.outlook.com (2603:10b6:5:332::14) by IA0PR12MB7579.namprd12.prod.outlook.com (2603:10b6:208:43c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 17:28:30 +0000 Received: from DM6NAM11FT031.eop-nam11.prod.protection.outlook.com (2603:10b6:5:332:cafe::bb) by DM6PR02CA0147.outlook.office365.com (2603:10b6:5:332::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.20 via Frontend Transport; Fri, 19 May 2023 17:28:29 +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 DM6NAM11FT031.mail.protection.outlook.com (10.13.172.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6411.21 via Frontend Transport; Fri, 19 May 2023 17:28:29 +0000 Received: from SITE-L-T34-2.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; Fri, 19 May 2023 12:28:27 -0500 From: Mario Limonciello To: Tom Lendacky , Herbert Xu , "David S . Miller" CC: John Allen , , , Mario Limonciello Subject: [PATCH 1/3] crypto: ccp - Validate that platform access mailbox registers are declared Date: Thu, 18 May 2023 22:24:12 -0500 Message-ID: <20230519032414.94247-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230519032414.94247-1-mario.limonciello@amd.com> References: <20230519032414.94247-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: DM6NAM11FT031:EE_|IA0PR12MB7579:EE_ X-MS-Office365-Filtering-Correlation-Id: c189b4d2-5a6c-4bda-59b7-08db588e765b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hnvaPjmOWTgiDEcy/zVAp85VioPQg647+PcoH8ScE4S4MUmxKR1kENygGv6NyASS9mrxnExuTw8l0EqogRixSifqBJGy9uwid9jpGomVklLI1keoVP3IozndLM8jeO6uIsT9RtOEvA7qL21J/KJ2LWbmEEt17uca7DswabT9X/X1gYUetz2jD46nM+kaPoPX3wksZ8mmqOnBbWWLqc6bVPxavr/pOWophOcCLkmEZ9UfRZ/8dJ8oXdYojMnhbiCoIYj+lh+JfyA8WLu3kv+J1bChbtcQPX7Cb8PkqZuSA6HSrJupQJMVUhD+2rNdeyUdH8oAfyMw8cyHWccRB2V8wDe4yjSOycz7gms0pPllH94qLFWoIXIxn8Ckoc8QZTG5T3/Av57XMXdJaKzBKXwssPNryVye02tS4hzOS8D3StAjEA0WwBxoADleEeiz95UCj2+xSb5/GNXv2yrZxeF3oJzqaRuTwJHtfI3hhTBBra/v5s5Wv62q1X/TpNgKPsOPzr4HNuyPd0MWZ/neP1xdBvlpQuMfRJ02doSmL8kxV1AC1E4xNk+0dDwv6GiRWV4FV9kDwlsiuAiV51kv7ePp1FnJmNBHTmPciuSMUyx2umuQw+x3EruqXSSaVOV2aQY0lb0Ff+Splmh74cnjoAqR4KuYLT228vMTEt4sZFHiGC0rYNRov/PHvXQAfk9mp/1jpV+F0blmzpgdpk2T0lUKk58+y3uaw1mNuVIQcgRmgQdQPG5Zn2hiS1JGd7Xxg88yn5H7DrCJ7XjAE4CjcAR2eA== 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)(396003)(136003)(39860400002)(376002)(346002)(451199021)(46966006)(40470700004)(36840700001)(70206006)(70586007)(4744005)(2906002)(8936002)(8676002)(5660300002)(44832011)(316002)(4326008)(15650500001)(41300700001)(86362001)(2616005)(426003)(54906003)(47076005)(110136005)(40460700003)(478600001)(36756003)(7696005)(6666004)(40480700001)(26005)(186003)(16526019)(336012)(1076003)(36860700001)(83380400001)(81166007)(82310400005)(356005)(82740400003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 17:28:29.6574 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c189b4d2-5a6c-4bda-59b7-08db588e765b 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: DM6NAM11FT031.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7579 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Some platforms might support platform access doorbell but not mailbox. Add an extra guard to ensure this doesn't cause accesses to wrong ranges if a consumer calls psp_send_platform_access_msg(). Signed-off-by: Mario Limonciello --- drivers/crypto/ccp/platform-access.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/crypto/ccp/platform-access.c b/drivers/crypto/ccp/platform-access.c index 939c924fc383..94367bc49e35 100644 --- a/drivers/crypto/ccp/platform-access.c +++ b/drivers/crypto/ccp/platform-access.c @@ -67,6 +67,11 @@ int psp_send_platform_access_msg(enum psp_platform_access_msg msg, return -ENODEV; pa_dev = psp->platform_access_data; + + if (!pa_dev->vdata->cmdresp_reg || !pa_dev->vdata->cmdbuff_addr_lo_reg || + !pa_dev->vdata->cmdbuff_addr_hi_reg) + return -ENODEV; + cmd = psp->io_regs + pa_dev->vdata->cmdresp_reg; lo = psp->io_regs + pa_dev->vdata->cmdbuff_addr_lo_reg; hi = psp->io_regs + pa_dev->vdata->cmdbuff_addr_hi_reg; From patchwork Fri May 19 03:24: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: 684044 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA507C77B7A for ; Fri, 19 May 2023 17:28:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230329AbjESR2i (ORCPT ); Fri, 19 May 2023 13:28:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230121AbjESR2g (ORCPT ); Fri, 19 May 2023 13:28:36 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2078.outbound.protection.outlook.com [40.107.220.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7732C110; Fri, 19 May 2023 10:28:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lwboxHf4y2AlvwJs6efXpgPrSEO0HblcElOl/B9x6hhGGOgjAFot5Z1Xcne0TlFLbp+oINc90rCn6f6SeB41N3xlXYyTXiJu1cyMwCLHpNUO4REEyQDjDV+GnKFQWa41iSSAEKv3k0ezfNOZ463kvfNLjucmuXTVlGaxgEq4JGKuzPXPQIoVcH6IzodEGZKQtsOxY65Tkbsze/9D5lWKvoatfuIWRFLsRbsFFbaNfow/F39IuF7RBr6DXTMbfCsRSez7B/X5ow/BBJ8uX48CUUatGa1yYA2uqroyJEsCTSJE0Tug5Fw12eOGIb7AKMeC9KFotatdKiWEtz7n70E+og== 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=qm5sJ8gAzIBeTYjQxKniEt/dido43KVBJOfMwpxCchk=; b=S7RJE+gs1zCJQOcCBmflbGshZM3bsRHV8wlpavdGk4SI6MRdlm4VcLT54nExM3sUsqV/xi/O19WAD/7stR1Fy187ld3NLQFH79A4eFkSKU8yDTTg1wmciOWfPgj9JFB1JXDxvtWLF8SJT3GZuVD36C+SpFkNrGvaFjg+lpEeeLjs52TdWSP3iViAQ9bcIDl/9Ia6UQYpx8TezqkKiO0AdRDBGhPP8wpWxV6jd2kRbG5cZ8jW6/sgVsHEoYVX4RDcJXTJrbPYiN1b/DFpsAFKpyIHsOk8Dl32mjHYTDugvukLRLRSsKi1Ltk9/2oXQiVnfYG3cGJv6hzCTFoL6ZBCpw== 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=qm5sJ8gAzIBeTYjQxKniEt/dido43KVBJOfMwpxCchk=; b=eKjliyg3S7cydheijgDU4neZgzFIQa/EYf+aoI8xy3VGWRUs9xV6PEX7CNsCzWm+rOYjjfJtbHXfwZiK4Z9JPK5eULOUH4wvxdlgqEMN6aWwpdGendv2ASJ74ysrBISt6wucKdgDWLDZA0A1dklnjTzjJ/VvG/me7U0GB3uFjWw= Received: from DM6PR02CA0163.namprd02.prod.outlook.com (2603:10b6:5:332::30) by PH8PR12MB7446.namprd12.prod.outlook.com (2603:10b6:510:216::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 17:28:31 +0000 Received: from DM6NAM11FT031.eop-nam11.prod.protection.outlook.com (2603:10b6:5:332:cafe::3e) by DM6PR02CA0163.outlook.office365.com (2603:10b6:5:332::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21 via Frontend Transport; Fri, 19 May 2023 17:28:30 +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 DM6NAM11FT031.mail.protection.outlook.com (10.13.172.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6411.21 via Frontend Transport; Fri, 19 May 2023 17:28:30 +0000 Received: from SITE-L-T34-2.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; Fri, 19 May 2023 12:28:29 -0500 From: Mario Limonciello To: Tom Lendacky , Herbert Xu , "David S . Miller" CC: John Allen , , , Mario Limonciello Subject: [PATCH 2/3] crypto: ccp - Add support for PCI device 0x17E0 Date: Thu, 18 May 2023 22:24:13 -0500 Message-ID: <20230519032414.94247-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230519032414.94247-1-mario.limonciello@amd.com> References: <20230519032414.94247-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: DM6NAM11FT031:EE_|PH8PR12MB7446:EE_ X-MS-Office365-Filtering-Correlation-Id: 81d2113a-8ee5-4af1-3af5-08db588e7702 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gFkYh3j/dnsDP0AUxYoouSveqenSUvm4hkM+Z5TTfdfGmDsgnVEQhHds43zZA+Nu1BTNY8M7qYiKqoH3HMgstY6CsYoybPoTHRn7huFRT/ogrgf0ALljXuyJj0DbAU7+JL9wfvMVJ3CfB6BG5nOw66tTzi89KpUl7paXC5tqbIc8aPn/2bBRzoG4dHSrGrdvCSS3vzyOKvUxVwZ971cdPQI1Ee7sd2few4qZ8n6+1y2GGJfwEO0yM8hsD+fC5NoMGllWPMU4q9LkpBEUsNx6Nd/58KO6GD0RMM/bWUtriZKujRdJhOTJ4QGs18KvdLVzYHH6aZ7wotjsbH0IuRUM96DMCdxhcwEJb3mJBUH0mToQjAjaWFgyYfVomhDzf7iHMGp4qmIIN9IS4D3yzPCgxew/6+LIXLcxLGbtliHcWvLxRv4ORr1O9GlBqYGr0HtkGBwY10TT6rZHtUEJISK2cHYvWNTErL3mPUyU+d1+9NOhN3dLzxsZmYVlBxdHMZkfuSvi5EVLHzmyFJGljynRAXurnVzQtiotubT/IEJXKhKYmDoRY3iI/aEkylI/1J7yPCsDBxMDv8S9iWjYrupNy1JQtq4yLC0iVddQjCMLZrZA/ZBcFhW1aOK6qVXP30SqdcftgsRD5lEMhuevR1o+6VhIENUW6biLpgemgjU1C+QwR6f22tNnY+sj3jt+3zUDgLlQ3PS+bP7e1sdLbcItt8VniR+lLSK70OrWaW8H+Cd7IIZ7w/QCBC+H1cQdEM7R7Of43JTPgNxQPAQ1MgIabA== 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)(396003)(346002)(136003)(39860400002)(376002)(451199021)(40470700004)(46966006)(36840700001)(16526019)(70206006)(70586007)(4326008)(110136005)(54906003)(82740400003)(8676002)(8936002)(40480700001)(478600001)(316002)(6666004)(41300700001)(7696005)(40460700003)(2906002)(86362001)(81166007)(356005)(26005)(44832011)(47076005)(2616005)(83380400001)(1076003)(36860700001)(186003)(426003)(336012)(36756003)(5660300002)(82310400005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 17:28:30.7511 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81d2113a-8ee5-4af1-3af5-08db588e7702 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: DM6NAM11FT031.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7446 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org PCI device 0x17E0 includes new TEE offsets, doesn't support a platform mailbox, and does support platform doorbell so introduce a new structure to represent it. Signed-off-by: Mario Limonciello --- drivers/crypto/ccp/sp-pci.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c index aa15bc4cac2b..d0d70af0c4c0 100644 --- a/drivers/crypto/ccp/sp-pci.c +++ b/drivers/crypto/ccp/sp-pci.c @@ -361,6 +361,14 @@ static const struct tee_vdata teev1 = { .ring_rptr_reg = 0x10554, /* C2PMSG_21 */ }; +static const struct tee_vdata teev2 = { + .cmdresp_reg = 0x10944, /* C2PMSG_17 */ + .cmdbuff_addr_lo_reg = 0x10948, /* C2PMSG_18 */ + .cmdbuff_addr_hi_reg = 0x1094c, /* C2PMSG_19 */ + .ring_wptr_reg = 0x10950, /* C2PMSG_20 */ + .ring_rptr_reg = 0x10954, /* C2PMSG_21 */ +}; + static const struct platform_access_vdata pa_v1 = { .cmdresp_reg = 0x10570, /* C2PMSG_28 */ .cmdbuff_addr_lo_reg = 0x10574, /* C2PMSG_29 */ @@ -369,6 +377,11 @@ static const struct platform_access_vdata pa_v1 = { .doorbell_cmd_reg = 0x10a40, /* C2PMSG_80 */ }; +static const struct platform_access_vdata pa_v2 = { + .doorbell_button_reg = 0x10a24, /* C2PMSG_73 */ + .doorbell_cmd_reg = 0x10a40, /* C2PMSG_80 */ +}; + static const struct psp_vdata pspv1 = { .sev = &sevv1, .feature_reg = 0x105fc, /* C2PMSG_63 */ @@ -399,6 +412,14 @@ static const struct psp_vdata pspv4 = { .intsts_reg = 0x10694, /* P2CMSG_INTSTS */ }; +static const struct psp_vdata pspv5 = { + .tee = &teev2, + .platform_access = &pa_v2, + .feature_reg = 0x109fc, /* C2PMSG_63 */ + .inten_reg = 0x10510, /* P2CMSG_INTEN */ + .intsts_reg = 0x10514, /* P2CMSG_INTSTS */ +}; + #endif static const struct sp_dev_vdata dev_vdata[] = { @@ -451,6 +472,12 @@ static const struct sp_dev_vdata dev_vdata[] = { .bar = 2, #ifdef CONFIG_CRYPTO_DEV_SP_PSP .psp_vdata = &pspv3, +#endif + }, + { /* 7 */ + .bar = 2, +#ifdef CONFIG_CRYPTO_DEV_SP_PSP + .psp_vdata = &pspv5, #endif }, }; @@ -463,6 +490,7 @@ static const struct pci_device_id sp_pci_table[] = { { PCI_VDEVICE(AMD, 0x14CA), (kernel_ulong_t)&dev_vdata[5] }, { PCI_VDEVICE(AMD, 0x15C7), (kernel_ulong_t)&dev_vdata[6] }, { PCI_VDEVICE(AMD, 0x1649), (kernel_ulong_t)&dev_vdata[6] }, + { PCI_VDEVICE(AMD, 0x17E0), (kernel_ulong_t)&dev_vdata[7] }, /* Last entry must be zero */ { 0, } }; From patchwork Fri May 19 03:24: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: 684779 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08329C7EE29 for ; Fri, 19 May 2023 17:28:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230110AbjESR2m (ORCPT ); Fri, 19 May 2023 13:28:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229932AbjESR2j (ORCPT ); Fri, 19 May 2023 13:28:39 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on20606.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eaa::606]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29CB118F; Fri, 19 May 2023 10:28:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U7HWTrc07BPtghTwKVDGIiigES69NXF0jOZUDEpE/tiB5Hj9BoQTsENFCwkN9HiNT1/PAlzM29XDckBDd+XvLxK6amdQaVUEAA6kbQaigUabyNzqAEEfcxKsBsrXVPeyhyHyztri/TDc1J6aIKrKambOdLjm/7u6zdyIYhoH8ucZOhvtnuaymWgMD2XLK5YfBPQM+Q4gNak23moYmgIfevrZxmlFSCOcoHXRltIwXKkInB9QwTa71xujubCw2F6rSn/BmkHyp/WI90BwwjGGziakeTjsI02rZkHtQ/+xLAq4H+lSLvHO5R565ptrXSQLHfiaFK4FVWzZtW97thqbzA== 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=33zng0V4+/r/isgoeEknAvCd27yu7Ztkc92N4txYOhY=; b=lqwouS/Q3CYQYvrHlxm1et2bDy0VfmtU1JJCCSD/f+FpQgYxG3my27QeirXznSskmjhZGrPG0oztxulaieoO5oiOTl2j2NG7vTudN7NdeFT3rmTvRdlJ+TSS++SM7RcUGk2i4kLgUPND3ZJYKDWBfg786sWCWgtPUdxuXOkJkdMj+BkV0jIopKn/tQkFN/Ph4OqXNsK3ZYLNV6Wo4mMi45WO/sdGQ2ksZ6KLTgjPKVTxClHF+f2uFa2b7qp2XxObeLBEMln16JpEYAnm8Ii4ChqhXk14sknJiRbSr6OjXt/AMjDiuzdqwQUx8Fj3TbCDmbh+sAKImn7YCYyWWXw88Q== 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=33zng0V4+/r/isgoeEknAvCd27yu7Ztkc92N4txYOhY=; b=wuOQ/IAAu345Ukx3OZkaiwEUiOB60KvznXIsVUW7hSyBx4/UmB+B4nslnPHlXrFnvZdoiK6X+JixP74G9tEMzsMxafo4d7Pmg8fUlPyCWM3hkqrlus4kt9TzE0B6ZOgC8UEy9XQtvX74kARwJi3Ia5c8to2w8ZAwXdEsqM2Y7xo= Received: from DM6PR02CA0153.namprd02.prod.outlook.com (2603:10b6:5:332::20) by IA0PR12MB7673.namprd12.prod.outlook.com (2603:10b6:208:435::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 17:28:31 +0000 Received: from DM6NAM11FT031.eop-nam11.prod.protection.outlook.com (2603:10b6:5:332:cafe::1e) by DM6PR02CA0153.outlook.office365.com (2603:10b6:5:332::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.19 via Frontend Transport; Fri, 19 May 2023 17:28:31 +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 DM6NAM11FT031.mail.protection.outlook.com (10.13.172.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6411.21 via Frontend Transport; Fri, 19 May 2023 17:28:31 +0000 Received: from SITE-L-T34-2.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; Fri, 19 May 2023 12:28:30 -0500 From: Mario Limonciello To: Tom Lendacky , Herbert Xu , "David S . Miller" CC: John Allen , , Subject: [PATCH 3/3] crypto: ccp - Add support for PCI device 0x156E Date: Thu, 18 May 2023 22:24:14 -0500 Message-ID: <20230519032414.94247-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230519032414.94247-1-mario.limonciello@amd.com> References: <20230519032414.94247-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: DM6NAM11FT031:EE_|IA0PR12MB7673:EE_ X-MS-Office365-Filtering-Correlation-Id: 485d5025-fe55-4fe2-f75a-08db588e7782 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0vhemVVw31y7/OC+JEDxwbx5D5rCxVtgcoiYPqHu33J9vJc0YH9D5ZVaJMXEOHDWvj7+XJf8ShSEHZyeIHYPIsMTTD5bsE8ZJ/4PQOFAyNOlPXYtzJpL91C1eCEdI0XJxC1lvM6kunZX+pVEtXu9StCqG4byiZZ/HZrCnCSbfHMlKmtS81LFlB5sM94J91yKRjjwIYWlUrVOQ6tB0reXewLPp14RumCuDpBAgJdwPL5hCj0Oi0nqwBF5FqY+sJeahJjCyO4VfsWqIni195/o7AC+Ug29nBznphInxRds8jVzhAPr3OOLIIPr1t0xdSUMcLkNDXKtKEyLpox9fPxEemraGj6aRsFip3GugXSd0bwDrTP3wTjpDzJ3vvFZ9qGegUo9pYeEgpdg6pNnwI2w1yj1jTTL+tN5BEvh+P3U/aAkMRF2eB2Cr+IePe90OsVI0RbLW/XdOvHyAxSQhwIiZ1EWKlxoIAVjJfyf+osZHuJBW6J1QtgGKFGgqf75xlLoDx/obfeNWWB1nDBiwdtATG5ChRl9ZL0jXRjJtyLJkPT4NmIELEODdA7iqW2TJiwhzHyQIcDY9DyVRBrgPZnkel130XZG21yeuGSvJbqNzP4m4TvBsCPZagWErKmySCaTGsFIwlW5/waZ21sSGdSWGt1VHvDsv8zIvVMuLpSlYrF/wtWPxcVRi/JJR+w8aINyKk+NQQffxXtKBdDnA5KbwD4Sxqs/LiW0OPrCuhDbIx01lTJ0JTrCpadxnN9EzbeURaEJIQZYy1p3m8ZV3xWgPA== 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)(396003)(346002)(136003)(39860400002)(376002)(451199021)(40470700004)(46966006)(36840700001)(16526019)(70206006)(70586007)(4326008)(110136005)(54906003)(82740400003)(8676002)(8936002)(40480700001)(478600001)(316002)(6666004)(41300700001)(7696005)(40460700003)(2906002)(86362001)(81166007)(356005)(26005)(44832011)(47076005)(2616005)(1076003)(36860700001)(186003)(426003)(336012)(36756003)(5660300002)(82310400005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 17:28:31.5948 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 485d5025-fe55-4fe2-f75a-08db588e7782 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: DM6NAM11FT031.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7673 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: John Allen Add a new CCP/PSP PCI device ID and new PSP register offsets. Signed-off-by: John Allen --- drivers/crypto/ccp/sp-pci.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c index d0d70af0c4c0..b603ad9b8341 100644 --- a/drivers/crypto/ccp/sp-pci.c +++ b/drivers/crypto/ccp/sp-pci.c @@ -420,6 +420,14 @@ static const struct psp_vdata pspv5 = { .intsts_reg = 0x10514, /* P2CMSG_INTSTS */ }; +static const struct psp_vdata pspv6 = { + .sev = &sevv2, + .tee = &teev2, + .feature_reg = 0x109fc, /* C2PMSG_63 */ + .inten_reg = 0x10510, /* P2CMSG_INTEN */ + .intsts_reg = 0x10514, /* P2CMSG_INTSTS */ +}; + #endif static const struct sp_dev_vdata dev_vdata[] = { @@ -478,6 +486,12 @@ static const struct sp_dev_vdata dev_vdata[] = { .bar = 2, #ifdef CONFIG_CRYPTO_DEV_SP_PSP .psp_vdata = &pspv5, +#endif + }, + { /* 8 */ + .bar = 2, +#ifdef CONFIG_CRYPTO_DEV_SP_PSP + .psp_vdata = &pspv6, #endif }, }; @@ -491,6 +505,7 @@ static const struct pci_device_id sp_pci_table[] = { { PCI_VDEVICE(AMD, 0x15C7), (kernel_ulong_t)&dev_vdata[6] }, { PCI_VDEVICE(AMD, 0x1649), (kernel_ulong_t)&dev_vdata[6] }, { PCI_VDEVICE(AMD, 0x17E0), (kernel_ulong_t)&dev_vdata[7] }, + { PCI_VDEVICE(AMD, 0x156E), (kernel_ulong_t)&dev_vdata[8] }, /* Last entry must be zero */ { 0, } };