From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4658FC0650F for ; Thu, 8 Aug 2019 16:10:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1760E21743 for ; Thu, 8 Aug 2019 16:10:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mbDzANDi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1760E21743 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8S9F+fflslJkSoPamewaTvKtdMKj8S22NqiwP/yx4Js=; b=mbDzANDiaJNO5i Mh9YLI1SKBDxwarMzarImL8IUGUonJ2yT/OOh3Y2w65wk+1RXQh0LFJnAGpFugLQNp833DI2rpcr+ 2qJNoNJGrvHtx+KNG9jRP+8b1dEK+4ATR57tkETIzUeFcCdA2rB/0CziNllaheL4IXQfSUA01mmys tr3e0HdwNhGhjK6S+GuH7zpfRaYAqKpeX56h1r2zCX4YZPpUBFsMeteAYINIWVBeBgFsmksX8SV5m 6ipw8+yNcW2Q4Lhy+iEcd+1ufjz5No3+qcJXARLEmlgg8lCdJidlXgy3T5MBAa05L4H0lcRTjqVlM OsgpWlMqcN6qMwE0fhvA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hvkza-0003h8-Cx; Thu, 08 Aug 2019 16:10:18 +0000 Received: from hch by bombadil.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1hvkzX-0003eq-O4; Thu, 08 Aug 2019 16:10:15 +0000 Date: Thu, 8 Aug 2019 09:10:15 -0700 From: Christoph Hellwig To: yvahkhfo.1df7f8c2@hashmail.org Subject: Re: usb zero copy dma handling Message-ID: <20190808161015.GA8470@infradead.org> References: <20190808084636.GB15080@priv-mua.localdomain> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190808084636.GB15080@priv-mua.localdomain> User-Agent: Mutt/1.11.4 (2019-03-13) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: security@kernel.org, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Aug 08, 2019 at 10:46:36AM +0200, yvahkhfo.1df7f8c2@hashmail.org wrote: > --- a/drivers/usb/core/devio.c > +++ b/drivers/usb/core/devio.c > @@ -238,9 +238,14 @@ static int usbdev_mmap(struct file *file, struct vm_area_struct *vma) > usbm->vma_use_count = 1; > INIT_LIST_HEAD(&usbm->memlist); > > +#ifdef CONFIG_X86 > if (remap_pfn_range(vma, vma->vm_start, > virt_to_phys(usbm->mem) >> PAGE_SHIFT, > size, vma->vm_page_prot) < 0) { > +#else /* !CONFIG_X86 */ > + if (dma_mmap_coherent(ps->dev->bus->sysdev, > + vma, mem, dma_handle, size) < 0) { > +#endif /* !CONFIG_X86 */ Doing the dma_mmap_coherent unconditionally is the right thing here. Gavin who is on Cc has been looking into that. Note that you'll also need this patch which I'm going to send to Linus this week before it properly works on x86: http://git.infradead.org/users/hch/dma-mapping.git/commitdiff/197b3e665b82c6027be5c68a143233df7ce5224f _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel