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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 B8807C433DB for ; Fri, 19 Feb 2021 16:41:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 584C364DED for ; Fri, 19 Feb 2021 16:41:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 584C364DED Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rowland.harvard.edu Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D394D6E060; Fri, 19 Feb 2021 16:41:21 +0000 (UTC) Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by gabe.freedesktop.org (Postfix) with SMTP id A20F36E060 for ; Fri, 19 Feb 2021 16:41:20 +0000 (UTC) Received: (qmail 1115516 invoked by uid 1000); 19 Feb 2021 11:41:19 -0500 Date: Fri, 19 Feb 2021 11:41:19 -0500 From: Alan Stern To: Christian =?iso-8859-1?Q?K=F6nig?= Subject: Re: [PATCH] drm/prime: Only call dma_map_sgtable() for devices with DMA support Message-ID: <20210219164119.GC1111829@rowland.harvard.edu> References: <20210219134014.7775-1-tzimmermann@suse.de> <02a45c11-fc73-1e5a-3839-30b080950af8@amd.com> <20210219155328.GA1111829@rowland.harvard.edu> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Mathias Nyman , Thomas Zimmermann , airlied@linux.ie, gregkh@linuxfoundation.org, Sebastian Andrzej Siewior , Oliver Neukum , Johan Hovold , Christoph Hellwig , dri-devel@lists.freedesktop.org, "Ahmed S. Darwish" , stable@vger.kernel.org, Thomas Gleixner , Andy Shevchenko Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, Feb 19, 2021 at 04:56:16PM +0100, Christian K=F6nig wrote: > = > = > Am 19.02.21 um 16:53 schrieb Alan Stern: > > On Fri, Feb 19, 2021 at 02:45:54PM +0100, Christian K=F6nig wrote: > > > Well as far as I can see this is a relative clear NAK. > > > = > > > When a device can't do DMA and has no DMA mask then why it is request= ing an > > > sg-table in the first place? > > This may not be important for your discussion, but I'd like to give an > > answer to the question -- at least, for the case of USB. > > = > > A USB device cannot do DMA and has no DMA mask. Nevertheless, if you > > want to send large amounts of bulk data to/from a USB device then using > > an SG table is often a good way to do it. The reason is simple: All > > communication with a USB device has to go through a USB host controller, > > and many (though not all) host controllers _can_ do DMA and _do_ have a > > DMA mask. > > = > > The USB mass-storage and uas drivers in particular make heavy use of > > this mechanism. > = > Yeah, I was assuming something like that would work. > = > But in this case the USB device should give the host controllers device > structure to the dma_buf_attach function so that the sg_table can be fill= ed > in with DMA addresses properly. Indeed. Although in the contexts I'm familiar with, the host controller = device is actually passed to routines like dma_pool_create, = dma_alloc_coherent, dma_map_sg, or dma_map_single. Alan Stern _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel