From patchwork Wed Jul 27 00:09:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary R Hook X-Patchwork-Id: 9249131 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 073AE607D8 for ; Wed, 27 Jul 2016 00:24:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB87826B41 for ; Wed, 27 Jul 2016 00:24:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF1C627BF8; Wed, 27 Jul 2016 00:24:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6487E26B41 for ; Wed, 27 Jul 2016 00:24:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757924AbcG0AY0 (ORCPT ); Tue, 26 Jul 2016 20:24:26 -0400 Received: from mail-by2nam01on0066.outbound.protection.outlook.com ([104.47.34.66]:63232 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756964AbcG0AYZ (ORCPT ); Tue, 26 Jul 2016 20:24:25 -0400 X-Greylist: delayed 834 seconds by postgrey-1.27 at vger.kernel.org; Tue, 26 Jul 2016 20:24:25 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=EGbSuH+Vja5VV9dmKohugkUGviS8XIOYXbAdaS/cLcs=; b=wATKt4+3ZZJMuWKBs3jFfLN8LLNZLREJ1pQPy9BJBSoRidLNnvSl5mY26goG1GJfXlyW2+hrrqaUhWEkWKi5htLl9Y8MEsGxPUl3ElPgxBtKe+ZjwarTuqe2b2FhSAEW4lpApv4T4fPR1fmwSrg2lddUhqKNF6xAMH+PPTIqJSM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gary.Hook@amd.com; Received: from [10.236.19.42] (165.204.77.1) by BY2PR12MB0338.namprd12.prod.outlook.com (10.162.84.13) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.544.10; Wed, 27 Jul 2016 00:09:25 +0000 Subject: [PATCH 01/10] crypto: ccp - Abstract PCI info for the CCP From: Gary R Hook To: CC: , , Date: Tue, 26 Jul 2016 19:09:20 -0500 Message-ID: <20160727000920.24944.33926.stgit@taos> In-Reply-To: <20160727000652.24944.44919.stgit@taos> References: <20160727000652.24944.44919.stgit@taos> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BY2PR21CA0012.namprd21.prod.outlook.com (10.162.74.150) To BY2PR12MB0338.namprd12.prod.outlook.com (10.162.84.13) X-MS-Office365-Filtering-Correlation-Id: 3a2dce6e-aeef-415c-cb34-08d3b5b2451a X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0338; 2:eS3O1KH20wZM7p4vbijZqyfABPBWtV4fQ064+ipcM7rRR7PvvLFPxeZktg2xDwZC0h2Nio/nfPDbYyHtk8d12qBzB2yr6vLKXqV6cg+tLnSWQUSmeIi7M5fhVSDItzLRB+DUB9gLS7MgOANey6EATECSj6xbGMKeLpFhqD61AoN2t8cGJpVnz3HOdkUAKaDz; 3:j8T7dKBu19HUnGN/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M/xYmRO0mNjZmogNzcphPu05rYXOiFYdVUZBHp9uMWEDFmNPuqiHayS5tH4pYpiILleZW/5OcLOU9wZbfBjKes8nEFh5gyI8mfKXiYAoN7N6AeAL+OOmOP54y8MN+0OCG9iIARy/uYn2yqDD3QxIKF5oZ5sBQ0bDHFe93GI8JxUoUteXKqvesAeVSDx6bNH740oWrC04pqrP4y8icYDd52VyqXhpyoVFW4Bgu83JYrriJzyokmv+DjHltWf9V2cgquY30x1/YquxnxuqcqAhjE3Z; 4:qlYkD/MlYSz2uDJTNumjCzjwDL7ZbWHXMIkeNsjN4R7NId5gAd1Lqma5MrlbJsxYeZaRLcmvFpfZ7H+tU2GT30CSdUakc5pecLUhqAIOeBoAbybQ1TgZ5wBb0+W51FN4jZQInb4JlupH0TXbKUOCXzypYTYz5lrF/bQtc0mLVxQUZnFCC8P6Y9Ht6yMDW8EcVyCVwYqbHqrXs9H3kGTi5w3NidYwnPgxg0VFoKK21iUcOcz22wLcTJHzXJpaox6gn7SWmVU2lJPjAR6TuqufoFDs/M/px3OiDZpFROd81xMed2paSOsfa4Z06NPVBcRbjeEJvVsLyysrvZ4yTln6OlpVNE59KshWbjNvxPfBmPgLRDa2r/A7FCd51eXKbEwGOYdQyv95NhQ69nS3xnBhUC+xapDbSal5BGvuwl mpG/s= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:BY2PR12MB0338; BCL:0; PCL:0; RULEID:; SRVR:BY2PR12MB0338; X-Forefront-PRVS: 0016DEFF96 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6049001)(7916002)(199003)(189002)(105586002)(42186005)(47776003)(50466002)(1076002)(9686002)(103116003)(86362001)(54356999)(50986999)(23676002)(97746001)(19580395003)(76176999)(19580405001)(68736007)(189998001)(3846002)(586003)(6116002)(83506001)(2906002)(8676002)(66066001)(4326007)(230700001)(4001350100001)(110136002)(97736004)(2950100001)(33716001)(7846002)(77096005)(7736002)(305945005)(2351001)(229853001)(33646002)(106356001)(81166006)(81156014)(92566002)(101416001)(2004002)(71626007); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0338; H:[10.236.19.42]; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTJQUjEyTUIwMzM4OzIzOndERlJ5SVp6VXZBWUhpU1BrODBKRm9ac0Nx?= =?utf-8?B?OWdUUytnNTVRQjNJS1lsL3NZaWtRL1JKdFJMZGJka0pNWm5xaG1HbDBTVXp0?= =?utf-8?B?QzZTNnZwdERrTnV4WG0rNlZkUDdYODFybStzTGR5b3JXeGxJc0loNHNjdzZG?= =?utf-8?B?Sm4rSW1QVXJERW1nNk1LS3BRdFVPODJkN1h6QzZFNTRIMmJoVTc0bjhYMVR1?= =?utf-8?B?bGV2SVl5QWJacEZCcExXU1JBemptN3lacEhDTTJJYXZvRFJwaVA0UzFvRzB6?= =?utf-8?B?MFVSL1dzV0prYVlqZU1WdURWc3ZzcmxzWDBMQVFBMUgxQTRmYXZnTG40aCto?= =?utf-8?B?VjJ0OEJ3bkpMdmwwN25zbS9yMTVuLzdDYi9oU3VCVTdqbkNtcG1PaDVSY2lw?= =?utf-8?B?bDBxQjZDdm96cVZNUGJQOVNRVWlFUzA5QWUrUlVYMm1rWGRLOFhjUFFFMU8r?= =?utf-8?B?R09FQUhCak95WUhKL1Byb2EwSC96MkNEaEdQU1N1WGVWd0w2V1ByMUZTd2VF?= =?utf-8?B?empwNlQrNUlKR0x5OVV5RGdHV0FWc1JNU2VSTStuU2RPb2dHd09HNVBucWFh?= =?utf-8?B?U21zNG5VcVZhWDNNeTFmV0lER1I3U1RzTks4YnJBdU5adnRqTGM1QlJ3ZnZ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c88O9XFj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0338; 20:fdHsgdc8fBOGauDvz+lVUD7eHmSaq+nzOxd5Gc7JP4xsWajukiUl9gljCYVb0VXJAOCkfI1TVwa+z0fPUB0Zn4ptZFo58JqfoeYTtFQJwk/qPGQfQFhSRTes4yvB4qD28Vd7/Q+8oyxQlkmG5coXLVokjEb7yPMEcN1gZvJh2W6MZj+OwZYwa5sxhBVCNRdIqF2E5aUOk/juudwHLTPOeK4FpgrsCWA3LW5sweHjCoUDKjJDIuaYt/xHn/POMt3N X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2016 00:09:25.3378 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0338 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Device-specific values for the BAR and offset should be found in the version data structure. Signed-off-by: Gary R Hook --- drivers/crypto/ccp/ccp-dev-v3.c | 3 +++ drivers/crypto/ccp/ccp-dev.h | 3 +++ drivers/crypto/ccp/ccp-pci.c | 15 +++++++-------- 3 files changed, 13 insertions(+), 8 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/crypto/ccp/ccp-dev-v3.c b/drivers/crypto/ccp/ccp-dev-v3.c index d7a7103..2f7f3c5 100644 --- a/drivers/crypto/ccp/ccp-dev-v3.c +++ b/drivers/crypto/ccp/ccp-dev-v3.c @@ -4,6 +4,7 @@ * Copyright (C) 2013,2016 Advanced Micro Devices, Inc. * * Author: Tom Lendacky + * Author: Gary R Hook * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -541,4 +542,6 @@ static const struct ccp_actions ccp3_actions = { struct ccp_vdata ccpv3 = { .version = CCP_VERSION(3, 0), .perform = &ccp3_actions, + .bar = 2, + .offset = 0x20000, }; diff --git a/drivers/crypto/ccp/ccp-dev.h b/drivers/crypto/ccp/ccp-dev.h index 5fbee638..8824e41 100644 --- a/drivers/crypto/ccp/ccp-dev.h +++ b/drivers/crypto/ccp/ccp-dev.h @@ -4,6 +4,7 @@ * Copyright (C) 2013,2016 Advanced Micro Devices, Inc. * * Author: Tom Lendacky + * Author: Gary R Hook * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -163,6 +164,8 @@ struct ccp_actions { struct ccp_vdata { unsigned int version; const struct ccp_actions *perform; + const unsigned int bar; + const unsigned int offset; }; extern struct ccp_vdata ccpv3; diff --git a/drivers/crypto/ccp/ccp-pci.c b/drivers/crypto/ccp/ccp-pci.c index 0bf262e..072bced 100644 --- a/drivers/crypto/ccp/ccp-pci.c +++ b/drivers/crypto/ccp/ccp-pci.c @@ -4,6 +4,7 @@ * Copyright (C) 2013,2016 Advanced Micro Devices, Inc. * * Author: Tom Lendacky + * Author: Gary R Hook * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -25,9 +26,6 @@ #include "ccp-dev.h" -#define IO_BAR 2 -#define IO_OFFSET 0x20000 - #define MSIX_VECTORS 2 struct ccp_msix { @@ -156,10 +154,11 @@ static int ccp_find_mmio_area(struct ccp_device *ccp) resource_size_t io_len; unsigned long io_flags; - io_flags = pci_resource_flags(pdev, IO_BAR); - io_len = pci_resource_len(pdev, IO_BAR); - if ((io_flags & IORESOURCE_MEM) && (io_len >= (IO_OFFSET + 0x800))) - return IO_BAR; + io_flags = pci_resource_flags(pdev, ccp->vdata->bar); + io_len = pci_resource_len(pdev, ccp->vdata->bar); + if ((io_flags & IORESOURCE_MEM) && + (io_len >= (ccp->vdata->offset + 0x800))) + return ccp->vdata->bar; return -EIO; } @@ -216,7 +215,7 @@ static int ccp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) dev_err(dev, "pci_iomap failed\n"); goto e_device; } - ccp->io_regs = ccp->io_map + IO_OFFSET; + ccp->io_regs = ccp->io_map + ccp->vdata->offset; ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48)); if (ret) {