From patchwork Mon Jan 16 11:19:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrii Anisov X-Patchwork-Id: 9518499 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 78C0B60209 for ; Mon, 16 Jan 2017 11:22:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 523AE2836D for ; Mon, 16 Jan 2017 11:22:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 46E0B2845D; Mon, 16 Jan 2017 11:22:30 +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=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B96E42836D for ; Mon, 16 Jan 2017 11:22:29 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cT5KR-00015i-NL; Mon, 16 Jan 2017 11:19:59 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cT5KQ-00015Y-Sd for xen-devel@lists.xenproject.org; Mon, 16 Jan 2017 11:19:59 +0000 Received: from [193.109.254.147] by server-7.bemta-6.messagelabs.com id EF/B2-29440-E5CAC785; Mon, 16 Jan 2017 11:19:58 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRWlGSWpSXmKPExsXiVRvkpBu7pib CoPMsm8X3LZOZHBg9Dn+4whLAGMWamZeUX5HAmnFxpkfBce6Ka/f6GRsY27m6GLk4hARmMkrc WLCBpYuRk4NF4CWLxN0nHiAJCYF+VomTU56DJSQEYiTu3/7JCGGXScy+NpENxBYSUJPYd+g6C 8SkOUwSN28+AUuwCehKXH/1gAnEFhFQkri3ajITSBGzwAFGiYbXnewgCWEBH4nev2+YIFarSs xc8hwszivgLvH78zZmiG1yEjfPdYLZnAIeEn2fuqE2u0v87fvMMoFRYAEjwypGjeLUorLUIl1 DU72kosz0jJLcxMwcXUMDM73c1OLixPTUnMSkYr3k/NxNjMDQYgCCHYzflgUcYpTkYFIS5T2m Ux0hxJeUn1KZkVicEV9UmpNafIhRhoNDSYJXfHVNhJBgUWp6akVaZg4wyGHSEhw8SiK8xiBp3 uKCxNzizHSI1ClGY45TN06/ZOLYtevySyYhlrz8vFQpcd4ZIKUCIKUZpXlwg2DRd4lRVkqYlx HoNCGegtSi3MwSVPlXjOIcjErCvLEgU3gy80rg9r0COoUJ6JTrIF/wFpckIqSkGhhz09kMNST a611fPb7BNeFu5uJiVR3Zpgph9auaRW3fHDMYQlINRZczOpqumM+1Z6eWhL2TBIPKipmtoiwW YRVXrF68+8PMbZ3kI6vOF+blahvam2URvf6gpsVi9iW807+zfL4Qr/6nxHNJ9Yr6HlbTv6t+q m6X+OQQfeiPYIuqxKfyZrkiJZbijERDLeai4kQAtgEYw7kCAAA= X-Env-Sender: andrii.anisov@gmail.com X-Msg-Ref: server-5.tower-27.messagelabs.com!1484565596!76589850!1 X-Originating-IP: [74.125.82.66] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 42732 invoked from network); 16 Jan 2017 11:19:57 -0000 Received: from mail-wm0-f66.google.com (HELO mail-wm0-f66.google.com) (74.125.82.66) by server-5.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 16 Jan 2017 11:19:57 -0000 Received: by mail-wm0-f66.google.com with SMTP id r144so30047892wme.0 for ; Mon, 16 Jan 2017 03:19:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=y/CJlUzmmSoDZxkGxTFzgUNffTLqTOJqzirJxwtWJbk=; b=HSbWKZjp6IMdcNwNGALSTIOc/q06IcLwrenaGyDMgOPAiaguIUijk4nR2tE7fGDGqs DFed5WE7z/4FZSLSUsMNWvRVoFqpObQgsGwa8Bv4LfT0UMbQx83Yqi/dHidjL9Dm4Ntv 94a8/2hQM/VembWT1AQ2pTWzDG9AD9Ad8E58sPHyQDI7G6+T2N+5NBc3lB42VSjT4vqD y/dnADuYvQuS0MGG62JmtcP0zNTqovNXTvkgm45u3iJVYR/7kHpZQ+bZIv5w0h8gFyRm KTDiemJmtZkKfYzh9oStup6kGq8wsqvl0JQN0x3n5BKG6SQg1iF0tMSIahIbcs3wElHs ulpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=y/CJlUzmmSoDZxkGxTFzgUNffTLqTOJqzirJxwtWJbk=; b=a7tP8wjuq4RxRHRoOAADesI3iBAvX6b07y1xtvCkDd5t228DGQoXCN3gWpd7Nt5r2F YpDfLtmz/RW3Ewilz1kU7inTxQnetd0F4f27X9uxo1PFvlTram9qdHfEDx34IODWSIie BwrDf1DE4rNTFQDG+MwZ6lZt+MoivofPknXrmnGuizZ4AnDovnlM1264MGxyfW4xcjFR VJKjTU3Y5vEZefY7njwkFxe/Y0JKOyFyjgWa5FGRCIDNvQA32D/9Ru0VUfU7S027VOuQ fMrZf6dn1ij8+owvz8Vq75bpqwyTt0GoNs9Bdl4pb3aVDoenPqKkxZPQBewYPl1Y6tTz loSQ== X-Gm-Message-State: AIkVDXJdWD08XXGJcKbfarhtHteYPi0y3suOpwt8cW58/h7eDfKskzF2nPvGRyNw1ceTgA== X-Received: by 10.28.45.1 with SMTP id t1mr11063599wmt.53.1484565596656; Mon, 16 Jan 2017 03:19:56 -0800 (PST) Received: from aanisov-work.kyiv.epam.com (ll-54.209.223.85.sovam.net.ua. [85.223.209.54]) by smtp.gmail.com with ESMTPSA id l74sm28195272wmg.2.2017.01.16.03.19.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Jan 2017 03:19:56 -0800 (PST) From: Andrii Anisov To: xen-devel@lists.xenproject.org Date: Mon, 16 Jan 2017 13:19:51 +0200 Message-Id: <1484565592-24897-2-git-send-email-andrii.anisov@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484565592-24897-1-git-send-email-andrii.anisov@gmail.com> References: <1484565592-24897-1-git-send-email-andrii.anisov@gmail.com> Cc: julien.grall@arm.com, sstabellini@kernel.org, andrii_anisov@epam.com, Oleksandr Dmytryshyn , Stefano Stabellini Subject: [Xen-devel] [PATCH v2 1/2] swiotlb-xen: implement xen_swiotlb_dma_mmap callback X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Stefano Stabellini This function creates userspace mapping for the DMA-coherent memory. Signed-off-by: Stefano Stabellini Signed-off-by: Oleksandr Dmytryshyn Signed-off-by: Andrii Anisov --- arch/arm/xen/mm.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c index bd62d94..ff812a2 100644 --- a/arch/arm/xen/mm.c +++ b/arch/arm/xen/mm.c @@ -163,6 +163,19 @@ bool xen_arch_need_swiotlb(struct device *dev, !is_device_dma_coherent(dev)); } +/* + * Create userspace mapping for the DMA-coherent memory. + */ +static int xen_swiotlb_dma_mmap(struct device *dev, struct vm_area_struct *vma, + void *cpu_addr, dma_addr_t dma_addr, size_t size, + unsigned long attrs) +{ + if (__generic_dma_ops(dev)->mmap) + return __generic_dma_ops(dev)->mmap(dev, vma, cpu_addr, dma_addr, size, attrs); + + return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size); +} + int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order, unsigned int address_bits, dma_addr_t *dma_handle) @@ -198,6 +211,7 @@ static struct dma_map_ops xen_swiotlb_dma_ops = { .unmap_page = xen_swiotlb_unmap_page, .dma_supported = xen_swiotlb_dma_supported, .set_dma_mask = xen_swiotlb_set_dma_mask, + .mmap = xen_swiotlb_dma_mmap, }; int __init xen_mm_init(void)