From patchwork Sat Jul 27 13:57:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yvahknez.7f7d2ff0@hashmail.org X-Patchwork-Id: 11062387 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 46B221398 for ; Sat, 27 Jul 2019 13:58:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34CE7289BE for ; Sat, 27 Jul 2019 13:58:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2797728A4A; Sat, 27 Jul 2019 13:58:23 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 126A9289BE for ; Sat, 27 Jul 2019 13:58:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Message-ID:Subject:To:From:Date:Reply-To:Cc:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=xFURP9SqSG8B9fG55weF6rixRhciPKvE/fEuGVIJvw0=; b=cKOS6YJygAwO2kDosJ5sNUjiLc kV3t2Ro0X1NZvpeD7l8zd5t++hAy8vyVklWQSsYN0+mNS7QIUmKbbXpowa6cxjPINSnORTWeXPKPK nzPMVd97ipmpcAHDEfFDIu7w1jvUnfdV7PcBBnzKvHI2NOUvNjRDiTxnFyHHEZnldgdPVxSv84eSH sdxGfR/XkUEUef8FcO/4YAE3FAau/HD8mzuVApN0exjfu6/2uMTQcfyuB//9Wkr+/GUWgZdQy2RDH F6YHY/etjbFcm7YWS2POnfMRi/xLt0GBOII4hEttFdDOeLwVab20dBFR3r8LWx7iR5uKZXGH8X1S2 bFQyNSmw==; 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 1hrNDE-0007jg-Hk; Sat, 27 Jul 2019 13:58:16 +0000 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::10]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hrND8-0007j7-5J for linux-arm-kernel@lists.infradead.org; Sat, 27 Jul 2019 13:58:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1564235882; s=strato-dkim-0002; d=hashmail.org; h=Message-ID:Subject:To:From:Date:X-RZG-CLASS-ID:X-RZG-AUTH:From: Subject:Sender; bh=ZeucrT1dvMfM9OR7MkrskBOBidt/anKxYtgxx+ooKsY=; b=UZKDc9u7FaR6T/uuGgTr8cFvgwZrk8tVKC0Ne7gTFGI6qYYz6Xtfupcmnwm15bnP5d wtibj8eQqYysn7OCiy6QAG3WOKbs5V49gSi0zHzLY6a5T/XWnhKiYltURG6l4B3EPJcW 317q37enR2jUQ6oAfED65Gvi7ylhtrVemJ2G05dM+5xBhThow65bsbN3kpPbaZ8yHyO4 IdzA3YFyi2ta/0j1EBERA1DUUUpEUOO+MBP2hWtgAwoe6nOYhb6ZfiJqA5uvw/XllIcQ 0YGZybEKHreSsaGWPqjmUtUm41Iw2VVLnZghqH2q6ojJTpy9GUrnOblP1RogZcdWj7ss lXew== X-RZG-AUTH: ":O2kGeEG7b/pS1F+/SC3i33Z09cEcHcRBAtqtGgRBDGeSaUqOsX4glAsBpQEeWZB4JIsouA==" X-RZG-CLASS-ID: mo00 Received: from localhost by smtp.strato.de (RZmta 44.24 DYNA|AUTH) with ESMTPSA id f0aa24v6RDw0ri2 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate) for ; Sat, 27 Jul 2019 15:58:00 +0200 (CEST) Date: Sat, 27 Jul 2019 15:57:59 +0200 From: yvahknez.7f7d2ff0@hashmail.org To: linux-arm-kernel@lists.infradead.org Subject: usb zero copy dma handling Message-ID: <20190727135759.GA19217@priv-mua.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.11.3 (2019-02-01) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190727_065811_209293_F51C0A35 X-CRM114-Status: UNSURE ( 7.96 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hello linux-arm. this is a followup to that thread from 2018-11: https://www.spinics.net/lists/arm-kernel/msg685598.html the issue was discussed in more detail than i can claim to fully understand back then, but no fix ever merged. but i would really like to use rtl_433 on a raspi without having to build a custom-patched kernel first. the attached patch is my stripdown/cleanup of a devel-diff provided to me by the original reporter Steve Markgraf. credits to him for the good parts, blame to me for the bad parts. this does not cover the additional case of "PIO-based usb controllers" mainly because i dont understand what that means (or how to handle it) and if its broken right now (as the thread indicates) it might as well stay broken until someone who understands cares enough. could you please get this on track for merging? regards, x23 diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index ffccd40ea67d..0fedf4a97f65 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -240,9 +240,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 */ dec_usb_memory_use_count(usbm, &usbm->vma_use_count); return -EAGAIN; }