From patchwork Fri Jan 20 21:04:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9529497 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 C9C4F60113 for ; Fri, 20 Jan 2017 21:22:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE2D2286CD for ; Fri, 20 Jan 2017 21:22:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2FB4286D4; Fri, 20 Jan 2017 21:22:05 +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 21AC0286CD for ; Fri, 20 Jan 2017 21:22:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752419AbdATVWC (ORCPT ); Fri, 20 Jan 2017 16:22:02 -0500 Received: from mail-cys01nam02on0078.outbound.protection.outlook.com ([104.47.37.78]:3335 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752484AbdATVVh (ORCPT ); Fri, 20 Jan 2017 16:21:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=RgcGEXoJoEufQZ5946XxLemQJbsqRexjvRyN2WsFn1Y=; b=G7ITXOv6FSjXk5HeyBhueCLCblXQIwZlZDL0aeSjvxQyRbe0IC/i0bqcyK7uwXcqNfNeBcajR1T1GXNZshAdcPLF7yKS1S8RRLwKPPt8IU4tnpRSUfMviG1qg0A06MJnFoQ6IX9a2t7L96B7BUfTkF2yzb5+CJKPBaLI2SkS+bk= Received: from BY1PR0201CA0038.namprd02.prod.outlook.com (10.160.191.176) by CY1PR02MB1413.namprd02.prod.outlook.com (10.161.171.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13; Fri, 20 Jan 2017 21:04:46 +0000 Received: from BY2FFO11FD041.protection.gbl (2a01:111:f400:7c0c::172) by BY1PR0201CA0038.outlook.office365.com (2a01:111:e400:4814::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13 via Frontend Transport; Fri, 20 Jan 2017 21:04:45 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.21 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.21; helo=milsmgep15.sandisk.com; Received: from milsmgep15.sandisk.com (63.163.107.21) by BY2FFO11FD041.mail.protection.outlook.com (10.1.14.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.803.8 via Frontend Transport; Fri, 20 Jan 2017 21:04:45 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 56.B8.65426.CA872885; Fri, 20 Jan 2017 12:53:00 -0800 (PST) Received: from milsmgip11.sandisk.com (10.177.9.6) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Fri, 20 Jan 2017 13:04:40 -0800 X-AuditID: 0ac94369-b62949800001ff92-23-588278acf7f8 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 29.33.16817.86B72885; Fri, 20 Jan 2017 13:04:40 -0800 (PST) From: Bart Van Assche To: Doug Ledford CC: , Bart Van Assche , Christian Borntraeger , Joerg Roedel , Andy Lutomirski , "Michael S . Tsirkin" Subject: [PATCH v3 07/37] lib/dma-virt: Add dma_virt_ops Date: Fri, 20 Jan 2017 13:04:07 -0800 Message-ID: <20170120210437.26389-8-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170120210437.26389-1-bart.vanassche@sandisk.com> References: <20170120210437.26389-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRmVeSWpSXmKPExsXCddJ5ke6aiqYIg+87RCymr9jOYvHy/AdW i8mn5jJZPDvUy2JxftdaVov/v16xOrB5HHx0iM1j06pONo/3+66yeWw+Xe3xeZNcAGsUl01K ak5mWWqRvl0CV8aDr0YFf2QrPu5rYGlgXCDRxcjBISFgIrH2gF8XIxeHkMBSJont/86yQzjb GCX+z53LCFPU2aAIEd/MKLH02RmmLkZODjYBI4lv72eygNgiAmoSm14tAmtmFnjPKPH08ylm kISwgIXEvN4TzCCDWARUJVb/YAMJ8wrYS6xYPxtsjoSAvMSutousIDangIPEp8t9jCC2EFDN 8ctPwWZKCMxjlVg9fQ1Us6DEyZlPwBYzC0hIHHzxghmiQV3i5JL5TBMYhWYhKZuFpGwBI9Mq RrHczJzi3PTUAkNTveLEvJTM4my95PzcTYyQkM/cwXj3ifchRgEORiUeXoWApggh1sSy4src Q4wSHMxKIryvK4FCvCmJlVWpRfnxRaU5qcWHGKU5WJTEed3ufQkTEkhPLEnNTk0tSC2CyTJx cEo1MF636iuJZH5//sfU5o87lZibU9pymefL5t2Ypuz1Zo3ji6MZQjf3OslmmM+PNf2ybaV9 QsGt04X6i6YsO++R317Y8W7SYtXo6FUPNm81T5m1aMKjdxu++NVJVt9Uv79j7WrZuykvK7+b Kgq+mdj9sOfyhBnl5efFo64IrRHcms6rqWP55GTA1K1KLMUZiYZazEXFiQAXP9CAdQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIJMWRmVeSWpSXmKPExsXCtZEjRTejuinCoHO/gsXBn22MFtNXbGex eHn+A6vF5FNzmSyeHeplsTi/ay2rxf9fr1gd2D0OPjrE5rFpVSebx/t9V9k8pq05z+Sx+XS1 x+dNcgFsUVw2Kak5mWWpRfp2CVwZD74aFfyRrfi4r4GlgXGBRBcjB4eEgIlEZ4NiFyMXh5DA RkaJf9vvsXQxcnKwCRhJfHs/E8wWEVCT2PRqETuIzSzwkVFi0YcwEFtYwEJiXu8JZpA5LAKq Eqt/sIGEeQXsJT72rgIrlxCQl9jVdpEVxOYUcJD4dLmPEcQWAqo5fvkp+wRG7gWMDKsYxXIz c4pz0zMLDA31ihPzUjKLs/WS83M3MYIDhTNyB+PTieaHGJk4OKUaGKMabrpNzOE5/7a1YPaN PVqi8T+Wi9okyXxWPxjfr5fx6OOq9vMv61xnOAklbncx5/vJMWNOzkHGDXtMDzpImK5+ss9P trx6znyua/VPA7Y4XOSY7RS9e4VsbrjpP6PsL6yxjreNpCqvf8id9bl62qIlG1Smpi46umft PkUH64W/lRfzH8lOZlJiKc5INNRiLipOBAACj1IgxAEAAA== MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(39840400002)(39410400002)(39450400003)(39860400002)(39850400002)(2980300002)(438002)(189002)(199003)(36756003)(2950100002)(81156014)(6916009)(48376002)(92566002)(68736007)(4326007)(626004)(47776003)(2270400002)(2906002)(33646002)(110136003)(8676002)(50466002)(1076002)(50226002)(69596002)(8936002)(106466001)(97736004)(53936002)(6666003)(81166006)(50986999)(76176999)(38730400001)(189998001)(356003)(305945005)(5003940100001)(5660300001)(86362001)(54906002)(77096006); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR02MB1413; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD041; 1:EsTuzIokzJmnBjHRcTlJLlBceZkyLGty73QkRiNen71Rg7dNc3OsljBnUTMl6cuNHpEnWs64exk7HM8y3lNlLs4DuY0wAUC09Vpp1pSbESSGEWQqpJGhvWJtSKHzV74HFERd981mD5soguXBcl8lX9Vknu0odgt5Bdi94ps1cm5ba8aIIN1wU8AJSDWPbBifCWvDYUtcx4ewhvtzc3HccmHBdm9cDDOIyTtxjG7wVfg4FMnvxD4NVNauFtF3J/3ZgXJEOhl1c/98E7oONwpjlZT1TEfSsSFlF2GXK8wrkP2C5hUsc67H3okRY0LR7z9ZFHz0A2jpEGcdbwhtIdH7WCCGXIOqRuZSiAiJAr53PzC7893jhDP68OCPrhm/ior8c/QPjlP0Ii0iala3T2SBSkYQE/W+RPYuyh3+IeEUxLbCa9V7Y+Qm+IHHWjxUW1yC9srQEGb4p6BVsphFfQPgvKK4qRYhb43eE/junULr3jzR9j6nOGZeztrEQASeKLhe X-MS-Office365-Filtering-Correlation-Id: 0ab2592e-2f97-4564-01e1-08d44177f635 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002); SRVR:CY1PR02MB1413; X-Microsoft-Exchange-Diagnostics: 1; CY1PR02MB1413; 3:rLHwM5EgHoXkNNpA5npRreDgMONTI0zBxIqjtuqAPMN2vGgBIuWPPpGzL2+cnb4W423msAL7CkQ2SQiFlJjzcBVbKOxGVXjxHJt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3hpF30s/sT6Y6EttipSrgXx4lgRvUZ8YNblKdIA=; 20:pND47U7tBsrZJVGTxC4o8q2qx86ND7km2ogEi2TG6CcQEr0Ugrfmt1STEXWkxYle1l6PiquUnpmjQ9uvQpWg3NY89VosnZY5yPnpy9sy1qf+dSJbj6/66UO4S6Lc8ZeO4dtb4/qiBOg1lrnzUdoHao99YLtcbJC7lwpzUmfpMrMXPQSEVC9TazRI5qoOIxe6QDzVhzeOMOXM8QwTqRUcigUxDNU6C71+AHQrKxCUi9+InT+uFJ9pt8rwzjn4Tibkyat3+0xWzT2yAArAUEU0vUY46FA3e4FjcQfBl3ydHKlEkZAerg4mOaZQIHqL2Dae1YIRD2T3ZG+0H3hd96j6g3pYlDr9RhhxPE8obeTkyiienkaZozRW1ZzOZgvnM6l6wmvD8VYp8bgHBxrqFH+SEnRaI9cBrD9hSgUDGs1521UYQMhprROSQEZONv6S+TglQNsN19AnVXJ4+ZoDg7vW+InnxyAYW23s4MKv6UXYOKRvWhwZVq43jkfCUWKAsivA X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(190383065149520)(104084551191319)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(13016025)(13018025)(10201501046)(3002001)(6055026)(6041248)(20161123560025)(20161123564025)(20161123562025)(20161123555025)(6072148); SRVR:CY1PR02MB1413; BCL:0; PCL:0; RULEID:; SRVR:CY1PR02MB1413; X-Microsoft-Exchange-Diagnostics: 1; CY1PR02MB1413; 4:FYyWpF8XWEiS0XWIOfRVckORTgVdLvWSlM/pn/jCQsFoLraMCx8/usTsJ+veWbC3WRHcNTJPjOmvQFIUT5vcGDZ9P59gLfV8SBWIdBUFlAKJiuXNvb8UCAO/csvyF79pGG1qj93hpbvJMbqe6k6MxHc7Z8Q7Ti6OdsU1FVxizAkHNb2EuDhYd+N5FvmnWL3B4tiVI/+y1Pf+3NwQ82B5/Jg3Nkolc76d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XAQ1BhCBu3vVAgTU/nVsct9uERd8ggw6sJxjZkGERF5+XQUx6UtS+RCjmkrrrBqEERmYMICwij3WCLTdGowheMZmHP5vg1IrmTif1qUQLYo1TsYAlN47gbEGUN7lN6rgRe2UjUb3A== X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2017 21:04:45.3041 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.21]; Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR02MB1413 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Several RDMA drivers (hfi1, qib and rxe) expect that ib_sge.addr is a virtual address. Provide DMA mapping operations that are suitable for these drivers. Signed-off-by: Bart Van Assche Cc: Christian Borntraeger Cc: Joerg Roedel Cc: Andy Lutomirski Cc: Michael S. Tsirkin --- include/linux/dma-mapping.h | 1 + lib/Kconfig | 5 ++++ lib/Makefile | 1 + lib/dma-virt.c | 72 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 lib/dma-virt.c diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index ab8710888ddf..426c43d4fdbf 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -128,6 +128,7 @@ struct dma_map_ops { }; extern const struct dma_map_ops dma_noop_ops; +extern const struct dma_map_ops dma_virt_ops; #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) diff --git a/lib/Kconfig b/lib/Kconfig index b6baf0609e8b..97af23b26f33 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -400,6 +400,11 @@ config DMA_NOOP_OPS depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT) default n +config DMA_VIRT_OPS + bool + depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT) + default n + config CHECK_SIGNATURE bool diff --git a/lib/Makefile b/lib/Makefile index ada06d5652e8..b97e9a814854 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -27,6 +27,7 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \ lib-$(CONFIG_MMU) += ioremap.o lib-$(CONFIG_SMP) += cpumask.o lib-$(CONFIG_DMA_NOOP_OPS) += dma-noop.o +lib-$(CONFIG_DMA_VIRT_OPS) += dma-virt.o lib-y += kobject.o klist.o obj-y += lockref.o diff --git a/lib/dma-virt.c b/lib/dma-virt.c new file mode 100644 index 000000000000..dcd4df1f7174 --- /dev/null +++ b/lib/dma-virt.c @@ -0,0 +1,72 @@ +/* + * lib/dma-virt.c + * + * DMA operations that map to virtual addresses without flushing memory. + */ +#include +#include +#include +#include + +static void *dma_virt_alloc(struct device *dev, size_t size, + dma_addr_t *dma_handle, gfp_t gfp, + unsigned long attrs) +{ + void *ret; + + ret = (void *)__get_free_pages(gfp, get_order(size)); + if (ret) + *dma_handle = (uintptr_t)ret; + return ret; +} + +static void dma_virt_free(struct device *dev, size_t size, + void *cpu_addr, dma_addr_t dma_addr, + unsigned long attrs) +{ + free_pages((unsigned long)cpu_addr, get_order(size)); +} + +static dma_addr_t dma_virt_map_page(struct device *dev, struct page *page, + unsigned long offset, size_t size, + enum dma_data_direction dir, + unsigned long attrs) +{ + return (uintptr_t)(page_address(page) + offset); +} + +static int dma_virt_map_sg(struct device *dev, struct scatterlist *sgl, + int nents, enum dma_data_direction dir, + unsigned long attrs) +{ + int i; + struct scatterlist *sg; + + for_each_sg(sgl, sg, nents, i) { + BUG_ON(!sg_page(sg)); + sg_dma_address(sg) = (uintptr_t)sg_virt(sg); + sg_dma_len(sg) = sg->length; + } + + return nents; +} + +static int dma_virt_mapping_error(struct device *dev, dma_addr_t dma_addr) +{ + return false; +} + +static int dma_virt_supported(struct device *dev, u64 mask) +{ + return true; +} + +const struct dma_map_ops dma_virt_ops = { + .alloc = dma_virt_alloc, + .free = dma_virt_free, + .map_page = dma_virt_map_page, + .map_sg = dma_virt_map_sg, + .mapping_error = dma_virt_mapping_error, + .dma_supported = dma_virt_supported, +}; +EXPORT_SYMBOL(dma_virt_ops);