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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADBFECCA47B for ; Fri, 10 Jun 2022 11:13:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347021AbiFJLN2 (ORCPT ); Fri, 10 Jun 2022 07:13:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344921AbiFJLNX (ORCPT ); Fri, 10 Jun 2022 07:13:23 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D7BF6A072; Fri, 10 Jun 2022 04:13:21 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 981211F90C; Fri, 10 Jun 2022 11:13:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1654859600; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/vV5Xf0ef+WyjXiLyhxJA2he6Uf47qY/Qj0qVvZZMgk=; b=wlyOj3oX3QjDyNmXGs7r429SwLfKZ75TKAvUaK225+3JrOaVktk7+o0CxCFu4NL+SpHupV f1+7dXbNuBdQYgO0a8X7ZHqu0ayDgAuT/BgXzjbj4Yy+1xvQGRakQp6rzJ04wVQssv7dzt nSN24K52PT69jhdHWSa23ump7mnrBPs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1654859600; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/vV5Xf0ef+WyjXiLyhxJA2he6Uf47qY/Qj0qVvZZMgk=; b=9JuLsgYQGkCfSIKIC8yWEWYu6JrZgNRJsMZPB8QuX6y0FWjuxQmRkSt6V9Qf9T0nk/VM6C UpAKbj+bEyU5bNBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3832113941; Fri, 10 Jun 2022 11:13:20 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id QjrxDFAno2IYEAAAMHmgww (envelope-from ); Fri, 10 Jun 2022 11:13:20 +0000 Date: Fri, 10 Jun 2022 13:13:19 +0200 Message-ID: <87h74sn54g.wl-tiwai@suse.de> From: Takashi Iwai To: Greg Kroah-Hartman Cc: Laurent Pinchart , Takashi Iwai , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [PATCH] media: uvcvideo: Fix spurious DMA max segment size warnings In-Reply-To: References: <20220609082246.13182-1-tiwai@suse.de> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On Fri, 10 Jun 2022 10:57:40 +0200, Greg Kroah-Hartman wrote: > > On Thu, Jun 09, 2022 at 12:18:30PM +0300, Laurent Pinchart wrote: > > Hi Takashi, > > > > (CC'ing Greg and the linux-usb mailing list) > > > > Thank you for the patch. > > > > On Thu, Jun 09, 2022 at 10:22:46AM +0200, Takashi Iwai wrote: > > > As default, the DMA max segment size is set to 64k, and uvcvideo may > > > overflow that size easily, resulting in a warning like: > > > > > > DMA-API: xhci_hcd 0000:00:14.0: mapping sg segment longer than device claims to support [len=98304] [max=65536] > > > > > > Explicitly set up the DMA max segment size for avoiding spurious kernel > > > warnings. > > > > > > Signed-off-by: Takashi Iwai > > > --- > > > drivers/media/usb/uvc/uvc_video.c | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c > > > index 1b4cc934109e..25aa6e6a6906 100644 > > > --- a/drivers/media/usb/uvc/uvc_video.c > > > +++ b/drivers/media/usb/uvc/uvc_video.c > > > @@ -2160,6 +2160,8 @@ int uvc_video_init(struct uvc_streaming *stream) > > > for_each_uvc_urb(uvc_urb, stream) > > > INIT_WORK(&uvc_urb->work, uvc_video_copy_data_work); > > > > > > + dma_set_max_seg_size(uvc_stream_to_dmadev(stream), UINT_MAX); > > > + > > > > uvc_stream_to_dmadev() returns the pointer to the HCD's struct device, > > which is shared between all drivers on the bus. Is it really fine for a > > USB device driver to change the maximum segment size of the HCD device > > directly ? > > Ick, no! That feels wrong, it should only change things for that one > specific device, not all devices on that bus. Hrm, indeed, that points to the HCD. This made me wonder, though, whether the current usage of dma_*sgtable() with that device is OK or not. The warning came from that code path, after all... Takashi