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=-8.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 B6DF0C433DB for ; Tue, 2 Mar 2021 09:56:24 +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 463A164F0A for ; Tue, 2 Mar 2021 09:56:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 463A164F0A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org 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 691FA89F47; Tue, 2 Mar 2021 09:56:23 +0000 (UTC) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id A726B89F47 for ; Tue, 2 Mar 2021 09:56:22 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id EBA8764E56; Tue, 2 Mar 2021 09:56:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614678980; bh=bG3XD02DL4MaCW2XI6leEjvU1W3wPrk7Lzd9ASOAZvU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gE5a2K0/Ko05cgGWq2RR9ypqqxknulsWNKb1MLRxvN+hrzShatu8xOAwBwgsS53rG AWg0XvjGWV9Nem+Ic7WCw91l9mUafFFhnoW4ro82ENO6sy8Pi/Zd+3s4lfO7Xo4vVY g7uVObNi/MindPLHLebzrIVSiCLxLy9O9D/9S6Z4= Date: Tue, 2 Mar 2021 10:56:17 +0100 From: Greg KH To: Thomas Zimmermann Subject: Re: [PATCH v6] drm: Use USB controller's DMA mask when importing dmabufs Message-ID: References: <20210301093127.11028-1-tzimmermann@suse.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210301093127.11028-1-tzimmermann@suse.de> 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: Pavel Machek , airlied@linux.ie, Daniel Vetter , Christoph Hellwig , hdegoede@redhat.com, stern@rowland.harvard.edu, dri-devel@lists.freedesktop.org, stable@vger.kernel.org, sean@poorly.run, christian.koenig@amd.com 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 Mon, Mar 01, 2021 at 10:31:27AM +0100, Thomas Zimmermann wrote: > USB devices cannot perform DMA and hence have no dma_mask set in their > device structure. Therefore importing dmabuf into a USB-based driver > fails, which breaks joining and mirroring of display in X11. > = > For USB devices, pick the associated USB controller as attachment device. > This allows the DRM import helpers to perform the DMA setup. If the DMA > controller does not support DMA transfers, we're out of luck and cannot > import. Our current USB-based DRM drivers don't use DMA, so the actual > DMA device is not important. > = > Drivers should use DRM_GEM_SHMEM_DROVER_OPS_USB to initialize their > instance of struct drm_driver. > = > Tested by joining/mirroring displays of udl and radeon un der Gnome/X11. > = > v6: > * implement workaround in DRM drivers and hold reference to > DMA device while USB device is in use > * remove dev_is_usb() (Greg) > * collapse USB helper into usb_intf_get_dma_device() (Alan) > * integrate Daniel's TODO statement (Daniel) > * fix typos (Greg) > v5: > * provide a helper for USB interfaces (Alan) > * add FIXME item to documentation and TODO list (Daniel) > v4: > * implement workaround with USB helper functions (Greg) > * use struct usb_device->bus->sysdev as DMA device (Takashi) > v3: > * drop gem_create_object > * use DMA mask of USB controller, if any (Daniel, Christian, Noralf) > v2: > * move fix to importer side (Christian, Daniel) > * update SHMEM and CMA helpers for new PRIME callbacks > = > Signed-off-by: Thomas Zimmermann > Fixes: 6eb0233ec2d0 ("usb: don't inherity DMA properties for USB devices") > Tested-by: Pavel Machek > Acked-by: Christian K=F6nig > Acked-by: Daniel Vetter > Cc: Christoph Hellwig > Cc: Greg Kroah-Hartman > Cc: # v5.10+ > Signed-off-by: Thomas Zimmermann Reviewed-by: Greg Kroah-Hartman _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel 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=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 2C326C433DB for ; Wed, 3 Mar 2021 00:19:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E0E5464FA9 for ; Wed, 3 Mar 2021 00:19:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234719AbhCCAIj (ORCPT ); Tue, 2 Mar 2021 19:08:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:51466 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1577844AbhCBJ5B (ORCPT ); Tue, 2 Mar 2021 04:57:01 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id EBA8764E56; Tue, 2 Mar 2021 09:56:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614678980; bh=bG3XD02DL4MaCW2XI6leEjvU1W3wPrk7Lzd9ASOAZvU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gE5a2K0/Ko05cgGWq2RR9ypqqxknulsWNKb1MLRxvN+hrzShatu8xOAwBwgsS53rG AWg0XvjGWV9Nem+Ic7WCw91l9mUafFFhnoW4ro82ENO6sy8Pi/Zd+3s4lfO7Xo4vVY g7uVObNi/MindPLHLebzrIVSiCLxLy9O9D/9S6Z4= Date: Tue, 2 Mar 2021 10:56:17 +0100 From: Greg KH To: Thomas Zimmermann Cc: daniel@ffwll.ch, airlied@linux.ie, maarten.lankhorst@linux.intel.com, mripard@kernel.org, sumit.semwal@linaro.org, christian.koenig@amd.com, hdegoede@redhat.com, sean@poorly.run, noralf@tronnes.org, stern@rowland.harvard.edu, dri-devel@lists.freedesktop.org, Pavel Machek , Daniel Vetter , Christoph Hellwig , stable@vger.kernel.org Subject: Re: [PATCH v6] drm: Use USB controller's DMA mask when importing dmabufs Message-ID: References: <20210301093127.11028-1-tzimmermann@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210301093127.11028-1-tzimmermann@suse.de> Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Mon, Mar 01, 2021 at 10:31:27AM +0100, Thomas Zimmermann wrote: > USB devices cannot perform DMA and hence have no dma_mask set in their > device structure. Therefore importing dmabuf into a USB-based driver > fails, which breaks joining and mirroring of display in X11. > > For USB devices, pick the associated USB controller as attachment device. > This allows the DRM import helpers to perform the DMA setup. If the DMA > controller does not support DMA transfers, we're out of luck and cannot > import. Our current USB-based DRM drivers don't use DMA, so the actual > DMA device is not important. > > Drivers should use DRM_GEM_SHMEM_DROVER_OPS_USB to initialize their > instance of struct drm_driver. > > Tested by joining/mirroring displays of udl and radeon un der Gnome/X11. > > v6: > * implement workaround in DRM drivers and hold reference to > DMA device while USB device is in use > * remove dev_is_usb() (Greg) > * collapse USB helper into usb_intf_get_dma_device() (Alan) > * integrate Daniel's TODO statement (Daniel) > * fix typos (Greg) > v5: > * provide a helper for USB interfaces (Alan) > * add FIXME item to documentation and TODO list (Daniel) > v4: > * implement workaround with USB helper functions (Greg) > * use struct usb_device->bus->sysdev as DMA device (Takashi) > v3: > * drop gem_create_object > * use DMA mask of USB controller, if any (Daniel, Christian, Noralf) > v2: > * move fix to importer side (Christian, Daniel) > * update SHMEM and CMA helpers for new PRIME callbacks > > Signed-off-by: Thomas Zimmermann > Fixes: 6eb0233ec2d0 ("usb: don't inherity DMA properties for USB devices") > Tested-by: Pavel Machek > Acked-by: Christian König > Acked-by: Daniel Vetter > Cc: Christoph Hellwig > Cc: Greg Kroah-Hartman > Cc: # v5.10+ > Signed-off-by: Thomas Zimmermann Reviewed-by: Greg Kroah-Hartman