From patchwork Wed Jan 11 00:56:42 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: 9509009 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 085B860761 for ; Wed, 11 Jan 2017 01:00:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7C022849B for ; Wed, 11 Jan 2017 01:00:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D87402856F; Wed, 11 Jan 2017 01:00:20 +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=unavailable 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 480612849B for ; Wed, 11 Jan 2017 01:00:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934624AbdAKA5q (ORCPT ); Tue, 10 Jan 2017 19:57:46 -0500 Received: from mail-sn1nam01on0070.outbound.protection.outlook.com ([104.47.32.70]:55378 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759750AbdAKA45 (ORCPT ); Tue, 10 Jan 2017 19:56:57 -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=nC5FMjUccMISpYmG8Dc31trMEwGWsJv1xZu1nPq7XVA=; b=UDm8MCYoaEfV6KLTEvLCsp9Ayj1x3SNtt5DgYUcJIVIFu4Bi2mZmXEbfOHpPJFfkaY+ftzzC9ltNWs20vx8UBblGT2L+jSIi74AOi0c0Qrf0UBISu6NIBYZS1cHStWV5eQJENtm4mfXzTmGZP2SpDdzpUDLqh6rPmkHe7H1aU6w= Received: from MWHPR02CA0016.namprd02.prod.outlook.com (10.168.209.154) by SN1PR02MB1422.namprd02.prod.outlook.com (10.162.0.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.829.7; Wed, 11 Jan 2017 00:56:55 +0000 Received: from BY2FFO11OLC011.protection.gbl (2a01:111:f400:7c0c::197) by MWHPR02CA0016.outlook.office365.com (2603:10b6:300:4b::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.829.7 via Frontend Transport; Wed, 11 Jan 2017 00:56:54 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.com; 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 BY2FFO11OLC011.mail.protection.outlook.com (10.1.15.22) 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; Wed, 11 Jan 2017 00:56:54 +0000 Received: from MILHUBIP03.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 3F.7A.65426.13085785; Tue, 10 Jan 2017 16:45:37 -0800 (PST) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.319.2; Tue, 10 Jan 2017 16:56:51 -0800 X-AuditID: 0ac94369-b62949800001ff92-af-58758031318f Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 04.14.09762.3D285785; Tue, 10 Jan 2017 16:56:51 -0800 (PST) From: Bart Van Assche To: Doug Ledford CC: , , "Christian Borntraeger" , Joerg Roedel , "Andy Lutomirski" , "Michael S . Tsirkin" Subject: [PATCH 3/9] dma: Add dma_virt_ops Date: Tue, 10 Jan 2017 16:56:42 -0800 Message-ID: <20170111005648.14988-4-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170111005648.14988-1-bart.vanassche@sandisk.com> References: <20170111005648.14988-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRmVeSWpSXmKPExsXCddJ5ka5hQ2mEwcp+fYvpK7azWLw8/4HV YvKpuUwWl3fNYbN4dqiXxeL8rrWsFv9/vWJ1YPc4+OgQm8emVZ1sHu/3XWXz2Hy62uPzJrkA 1igum5TUnMyy1CJ9uwSujP8rJjEV/JeteNbZyNbAOFOii5GTQ0LARKLnzwXmLkYuDiGBpUwS S/YcZ4VwdjBK7F/+iBWmqunQbxYQW0hgM6PEgjfRIDabgJHEt/czweIiAmoSm14tYgdpZha4 zyhx6l0DWLOwgJbE9CvfGUFsFgFViRcdm8AaeAXsJXY8vM8MsUBeYlfbRaB6Dg5OAQeJ5XPs IXbZSzy91Al2kITALFaJ6xdvs0H0CkqcnPkEbA6zgITEwRcvmCEa1CVOLpnPNIFRaBaSsllI yhYwMq1iFMvNzCnOTU8tMDTVK07MS8ksztZLzs/dxAiJgMwdjHefeB9iFOBgVOLhffCiJEKI NbGsuDL3EKMEB7OSCG90XWmEEG9KYmVValF+fFFpTmrxIUZpDhYlcV63e1/ChATSE0tSs1NT C1KLYLJMHJxSDYz6UnmVbxZPu+bgOj+48cu/vmnnlJak8irFM7FPC9E7qclqNv+t1akooyjD niXbSyYqLObIE3mlJ3tWiZfzlknSOZ/ErVzPb0bXXY8KL/mTsWdiW/u2p+mqFZLvZ4Sw9egz PO72n/Hvh+ynpK8GS1d0n4o+tPrE0dN7pvz5tGBbqcusB2u//slWYinOSDTUYi4qTgQADec2 PnwCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrPJMWRmVeSWpSXmKPExsXCtZEjRfdyU2mEwYQ9hhbTV2xnsXh5/gOr xeRTc5ksLu+aw2bx7FAvi8X5XWtZLf7/esXqwO5x8NEhNo9NqzrZPN7vu8rmsfl0tcfnTXIB rFFcNimpOZllqUX6dglcGf9XTGIq+C9b8ayzka2BcaZEFyMnh4SAiUTTod8sXYxcHEICGxkl Pu9ZzAaSYBMwkvj2fiYLiC0ioCax6dUidpAiZoGHjBJP7s1jBkkIC2hJTL/ynRHEZhFQlXjR sQmsgVfAXmJi5xY2iA3yErvaLrJ2MXJwcAo4SCyfYw8SFgIqeXqpk3UCI/cCRoZVjGK5mTnF uemZBYZGesWJeSmZxdl6yfm5mxjBQcIZtYPx+kTzQ4xMHJxSDYzeW3MmMms18hk41RnFC0x8 ZvTIpHHzkYPBH+aFvV7Dd7M8aaPm6clLLm5Sf/f9SOnC999dJB6vYrpiUTYhWq+a16lIau1+ nVO73iXNX7M6fEHljpu37/f+9OjJYua5sqXY4ctxrlXhPQ2OhwL+CKr7XTk2Jcv6HXtKYf2v CXX8wSJXCq99+bpKiaU4I9FQi7moOBEABlGNn8IBAAA= 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)(39410400002)(39850400002)(39860400002)(39450400003)(39840400002)(2980300002)(438002)(199003)(189002)(305945005)(356003)(5003940100001)(110136003)(106466001)(54906002)(50986999)(76176999)(6916009)(69596002)(2950100002)(6666003)(8936002)(5660300001)(81156014)(81166006)(68736007)(50226002)(8676002)(626004)(47776003)(36756003)(33646002)(1076002)(189998001)(77096006)(86362001)(48376002)(38730400001)(2270400002)(50466002)(92566002)(4326007)(97736004)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR02MB1422; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC011; 1:ZPduq/sCiC8Prp9Njygwq3+NyUOyA+W8xkfoRDR5RdleYv/nxJwD9YVv4TEDJVfUnIiXAnUg94KBGqjCOUJmY3tyywa9dLCWu0b2ECNJfA1mblCIFi+EJDLZF3A+Wgjk1JwSLWKrXzd28ft9PESoxf6oGS9JuHLJ7dPFGNHcHQo9S6pkFeykMHAK7xYMDWkBpqPtEgSqywQZQL26m6X3j5zPlYFbyOKltVAvpyRIjptYnm/kkUpaD+ASHu889sdECBE6ggfUNXzsVH9/4CE3m5ukLP+2vPP9kGF1AfRgc6tBEPNBIxKImiP8/uN1FUvizkbhrD+s55VidjhmJ2/yUFh3oiadGj3/LX/mHV1nhrCnH2qw2d8hIs6TEe/p8wNBNO2AfU2GZuoaTMASh93F5ixoXWLadhQnvgOg+Al9kZVOBl+AGpm25IYNh1/IF/Eg9s43sTF/y5OR21F3fdYloQ== X-MS-Office365-Filtering-Correlation-Id: da55a95b-873b-47eb-712a-08d439bcbc70 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002); SRVR:SN1PR02MB1422; X-Microsoft-Exchange-Diagnostics: 1; SN1PR02MB1422; 3:BA4i6sbVZtHcGL///UVB9NCyAyVbrDnjT3tdPxoYBv+CmH+DZbQUSJGHCqvPBUlqPOuRBIfv05tIm72zxC/NWkA+i+xnAR69KV5KloBtsr78Tz6IoneJ56kmkd4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1D2QSo5xGZqgyJXbqhQrysidHkQbQt2xFF8xQb8K7SANAW4IFY7qFVf0aP14Hufn+r18CWOkcWJdbjUXuPq+qdJfrUNdbAWqBnBZBauXRvAjg== X-Microsoft-Exchange-Diagnostics: 1; SN1PR02MB1422; 31:QL2TiBnxrZk/RrUtBB3Y23apg5K4Vzvf6OnAZqGN6w6CyeU4gzacDlLn+REy0xU3x1mxa14RQXdevErNQxS1alpucmDgUZC8MBCdkd8Bu/qdMCnHuvZ4B8auTJBSunPQVXoYdcAHiD82qhZvi2RD+oOcLNn8F1D1cXXY6wzgFRyLKuBe89qIAiJ4Y/VhInhsJBMUofuClnoqpWXrusucM1Ai/GP/p2Ij22J2mWKflqvuet8RBSs3z4QCF0mKTURbgMLf6XCAWiKk9OjgPATvSg==; 20:7CAJuhcE4XCgaB/BB5xhJW4bzpmkn331RSZyFT0TWZQ/wXEeZXQ/uAon1eVGDdVYvy3kCKh/Ld4A5ymncA3M1gxVGsVX+rpUVQO3OC1kgDTU4lXKNK8kgJPm4NN74FzwePwQcWEBdOmS99yxZLpjff6p6uRKJAYNzgG6kjpSw5PHUt8iXSPLAMIndWMstDhXbd3Eu9QuDlxDAwGbdIB7T9c1xBPbLuQX5G3e/70uUN2uVCOpErYyTeZyRKaP6NUmTeQFi9KSUCFjTebHk1gFReyWht5hgbSdyVBj+soqGqf0sUTYoeonR0QUWJ8M4w5Gi6GmOyZbbrWWVkkH5v02ED6oSHCw6S8aVb7hHcKJhAk3jBIYjTO3b5ciE2UF/NhEZS+atGNLE0Ol6ZoVTuCYSb2zkeKYJtXjdgMtjNyutIajD0b93jUxoMx/6Xzts4QD+mdZEIkGlKVuVr5p2dbfAgvuWh1SFmUfOgflt9UX0PDa5b0RhV6yaqA9qpJRht2I 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)(13016025)(13018025)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6072148); SRVR:SN1PR02MB1422; BCL:0; PCL:0; RULEID:; SRVR:SN1PR02MB1422; X-Microsoft-Exchange-Diagnostics: 1; SN1PR02MB1422; 4:oi+Mab+/ail6pjIRUZuRnIY8JA+xYoxX0aj723CI6ZNF9xrBu2e6zKyPTysfefn/Dmb8mrv7O40mna0H/0BlQ5WRJPGAmblErz2ab8oxGzs1bzwMMK2I0tL/UgC93EMC2OKYtZi0wa9ZfCNsrfvYXspU5P6ozTR3VJtxAcJmDMdBzu8G8lIBYoD+elFMZ3H9eRVqmpO1jfll8fj5sFxMKJWajO9kvTbw0zQcpTJyUm3kfcxgnXxwPqRjRiSTf3C7XVBlNuvQoGnlTx4U57jtUsVkL+7RNiNkxHY5QyB683+83CthiZ8JmodpXzEpPIdCXeCUNtKvWmH+bGvlq8f28FLwp5Bu87Aq4pWDBOmavxq+m2Wvti/KyQLA+DXnRKi5Ka3A/3WBz7NgriFwM6qqGJRHIEZJFm0fKLXNnAxrfiDg+AoY67TePhKzu2kMK4DUFpGagKEFeHljVxvCEkg3VgyM7mnEsYxudsumpLDcYVFoFUmWHlu5WjYZmsSKfPaYsNB0KzVuZaO0gLvSbqosWqsb0EaACR3esJzthmq4C0spiCH3zxZ1R27Zqnejs3ruMedZ2DFZ28tMav0w/FyQwomuWdfSyuYnHtLIBvdnaaOrZnaDUxpKMSaRxgr6HJhxWyIbXoJRtqtaPbviJWlLd79E7Qe2Cvpg/RTTrFq91XiL2nZavZG4rfz/nuZTyBH2vxMhrztTDth9to7a2AC/v9WxRNpFJpO8Cmn5Qsg6fAwl4qgy8h01zOv6a5ca9XsM X-Forefront-PRVS: 01842C458A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR02MB1422; 23:lKsgdNlYmi2/mrrZqFYIju5zW46RZw8N/pAECtL0a?= =?us-ascii?Q?2oKJONAcvJ6wwB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XlkHUfUsJvNdxhSzRZWHT76Q67+J+oOeg4czsHc7EyuBr5ZN2BXKJit4hwz6?= =?us-ascii?Q?Am2r7zLK0u0WQNPpCF/MH+F2utG7WvL9OtgFYNriE6reTYXGcr+Dma8JGJ+y?= =?us-ascii?Q?0xsD0RrWmscrsAjy5lCj32Q9HMeVCKMUa2xOcgR66T03yZuIM4EfcbU9iU/I?= =?us-ascii?Q?5URYb4PiRnaHhabBLwvMwpmWEm6O1Ah?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR02MB1422; 6:RKdPnr2gtufNm85rQDKkAREQqZgtjSpx3AeXAHKOimDafS72hOnU1FH7fpHlPDBK4o8HjevKMUsLgA1dU9VpiO1f0uUAThKL1v9RrQoyvgPt6VfLmHTxo9mCYf+N+IKIEdb3SnREHrvi9qvrqT9sgSDVVTPlC5uhytqi8aF3hNicIfv1Dno84nHoQNDb2IkDb2Aijj+AAvLiBR4YCBZ64a74GxTT+SNfiRc30pbcSEy4oxeWq3GemOO6Xg7CLGQdVniazoE79RFUfGwRpf/SEJr/T5plNekWn+56zhJdC8AjPqsEoTbUa7/qkkX9k6/B+zTnt6hol9+uXUynq4VdK74bux+NgY1dYj6AVrGtdG9V0y1BEyLwQrVSU2JpV0wda+zPncdejLsOjy8xLZZjXqsGBdrOMUDkS1ylLpdmE1UiGuODi8aGTMW1rKVNrT3cEIs+Q9euhgKjfPIyMnQ57Q==; 5:eARMeC129ozWa760YVjuDHoDDmBETpMZwmtNZsYHs9xdS57n6eS3ud0uEHG5JbMpmYGbQxytEHgsKpRD93QoKd84X2latk9HMszaNyDY+CwX8cFU3bGz9Yo0EKA0ZXrmYafo0XU7IVXu85LSwgFzBg==; 24:wQCL2rXupiFezj7D9Gpnf8czBBr6exVeTKEhHAWAIqll48mYVyihN20vWMOJ9JF+cGkRK2qU/Jbxi2BofBdkKJwPugY0gAqnibAdNR3RQt4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR02MB1422; 7:uLHGJF64qfITuObxZdMQPXljHkdji1qP7UAqHADAa+Oo7y2T0o4zq+XUSPCQyT3Zr1+3KHcU08KGxR6pMtg3q2HDRa7lGaTKjNzgtQuWdWylyuXarBYdREVKGuWa9ROkhKM/h0X9pLTeWj7b5qo+PsGsyWEW5jwjo/53gRxQHTT82NTQgZOoMDoVDoyz8wNTyzppxCWS0QQ+f9dC3Qy0UhiItzTH5EW9dnvD1nRb6etV6VM/G1oqmYbkqvXZ4UMngJsJLfCPZML0XbHbm0TOGrUw6uO6NIyUHDaPdSk4+LVz3pK8CKcHgDzaryTgJlclqvN0u2kx5s4Wj7sBAcqKOLIz8sgMDcHg42NZRwjYffZBzVJqY7ECnCzWkLFcOIN1FGwgj+l0ZvFBJPYtuM4c6CvP5Wp+4cTMw2H69CWERGhyKftLuZd47ZZzpd4lXDP7pTZJwa3+qyHHp/61LJwesA== X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2017 00:56:54.3579 (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: SN1PR02MB1422 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 need to provide a DMA mapping API but use the CPU to transfer data. 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/Makefile | 1 + lib/dma-noop.c | 2 +- lib/dma-virt.c | 73 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+), 1 deletion(-) 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/Makefile b/lib/Makefile index bc4073a8cd08..2d6c3fcd432c 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_HAS_DMA) += dma-noop.o +lib-$(CONFIG_HAS_DMA) += dma-virt.o lib-y += kobject.o klist.o obj-y += lockref.o diff --git a/lib/dma-noop.c b/lib/dma-noop.c index 65e49dd35b7b..de26c8b68f34 100644 --- a/lib/dma-noop.c +++ b/lib/dma-noop.c @@ -1,7 +1,7 @@ /* * lib/dma-noop.c * - * Simple DMA noop-ops that map 1:1 with memory + * DMA operations that map to physical addresses without flushing memory. */ #include #include diff --git a/lib/dma-virt.c b/lib/dma-virt.c new file mode 100644 index 000000000000..b3573b6ad5b1 --- /dev/null +++ b/lib/dma-virt.c @@ -0,0 +1,73 @@ +/* + * 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);