Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1021142ybe; Wed, 4 Sep 2019 11:15:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHPiuGaFIgFr7I4y4AMmttKnXD9xmThZ0Y7Na0PD9cjflgQsMRAxVxjIOpUhhpTkM3kuEh X-Received: by 2002:a63:5920:: with SMTP id n32mr34919914pgb.352.1567620934900; Wed, 04 Sep 2019 11:15:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567620934; cv=none; d=google.com; s=arc-20160816; b=Y5BJEjoiCBRW6TDjCdVj2byvZP/yq0q6GUCYLFQKoO1Coa/eato4n8mRfzOKaW2SoV flhP6YwnZ75xzabjpo/pHKjqYXzt80BokREuwJSxGwLzJi0whWekEipRlt2isTFWjsvx eyZ0X3xSHk141E1yUyeGZUakyAZygCy3rykczWHUEEu13M3khpbV4cn+lCrlvU9XN+mi RxBF2hqemGhejxf96rSJMtDN9/nLLb2cAuRRSMR4loIOgVE8HXLgYmO3VAy7tf75N8Fc ZGoWDz4qkcjVEF5NPNtZxyXXRTwh5Jf844AbQhuKYiHW/isS0aYrOovdA1w6fAnYkrtg SH8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8uzfFpBewqmg4E+NAYD8HYudgZxfZfonaDzr48yHasY=; b=sBiKhMQathT/rAUmGLXlJknUkR2QGpXD1y56oJReZZ00L17QvPGFi/HrIsZenUYKIy mVH7duZQESRwMEDDyNLCWnmyU0NSyvZITDAn7NWU4CiYRtq8XLJAIBOjRiVm3UMP7hxg v83RKNkig37jGOmbSfiX9Cu2H4gQOhKK/Y3GsW+FU3Ovie2sW5TuO5R/eA9Gx5kmwefD 94BO2RUCUisLqo5qtMkeZ2yWPfm19THOl4bgy4QDJy+hDomqzjpFs72ASCvzND6aSMJ4 FEW/E329YF3fqTi/WroOycJGYAN6hSOGX6Mldh+Np3Nh1E1a2lXboCxrQByeOs3RIoKk a1aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BgtmedK5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y12si22294835pfo.30.2019.09.04.11.15.19; Wed, 04 Sep 2019 11:15:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BgtmedK5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390375AbfIDSN4 (ORCPT + 99 others); Wed, 4 Sep 2019 14:13:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:58838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390146AbfIDSNy (ORCPT ); Wed, 4 Sep 2019 14:13:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A72C8206BA; Wed, 4 Sep 2019 18:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620833; bh=lrCFZBgs7taAitb//K8nDjMil3QsaNgZqYnMNkSRP94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BgtmedK53JzJLQgmypoDy+AFI6MTim1xoIxhDrSxhB1mBzyQGJ+0jutqApXfaidAn cSnpQJll97QlbZ5/NMV62kMYs3m8UIxI5Qo+zvkNw3Bw9aiaqNxVtqDMTROPYqbVHf HSSZ547pqzC21PXufYVPuEqGuWbYezfPmkh3hdXY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lyude Paul , Chris Wilson , Jani Nikula Subject: [PATCH 5.2 113/143] drm/i915: Call dma_set_max_seg_size() in i915_driver_hw_probe() Date: Wed, 4 Sep 2019 19:54:16 +0200 Message-Id: <20190904175318.818342280@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175314.206239922@linuxfoundation.org> References: <20190904175314.206239922@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lyude Paul commit 32f0a982650b123bdab36865617d3e03ebcacf3b upstream. Currently, we don't call dma_set_max_seg_size() for i915 because we intentionally do not limit the segment length that the device supports. However, this results in a warning being emitted if we try to map anything larger than SZ_64K on a kernel with CONFIG_DMA_API_DEBUG_SG enabled: [ 7.751926] DMA-API: i915 0000:00:02.0: mapping sg segment longer than device claims to support [len=98304] [max=65536] [ 7.751934] WARNING: CPU: 5 PID: 474 at kernel/dma/debug.c:1220 debug_dma_map_sg+0x20f/0x340 This was originally brought up on https://bugs.freedesktop.org/show_bug.cgi?id=108517 , and the consensus there was it wasn't really useful to set a limit (and that dma-debug isn't really all that useful for i915 in the first place). Unfortunately though, CONFIG_DMA_API_DEBUG_SG is enabled in the debug configs for various distro kernels. Since a WARN_ON() will disable automatic problem reporting (and cause any CI with said option enabled to start complaining), we really should just fix the problem. Note that as me and Chris Wilson discussed, the other solution for this would be to make DMA-API not make such assumptions when a driver hasn't explicitly set a maximum segment size. But, taking a look at the commit which originally introduced this behavior, commit 78c47830a5cb ("dma-debug: check scatterlist segments"), there is an explicit mention of this assumption and how it applies to devices with no segment size: Conversely, devices which are less limited than the rather conservative defaults, or indeed have no limitations at all (e.g. GPUs with their own internal MMU), should be encouraged to set appropriate dma_parms, as they may get more efficient DMA mapping performance out of it. So unless there's any concerns (I'm open to discussion!), let's just follow suite and call dma_set_max_seg_size() with UINT_MAX as our limit to silence any warnings. Changes since v3: * Drop patch for enabling CONFIG_DMA_API_DEBUG_SG in CI. It looks like just turning it on causes the kernel to spit out bogus WARN_ONs() during some igt tests which would otherwise require teaching igt to disable the various DMA-API debugging options causing this. This is too much work to be worth it, since DMA-API debugging is useless for us. So, we'll just settle with this single patch to squelch WARN_ONs() during driver load for users that have CONFIG_DMA_API_DEBUG_SG turned on for some reason. * Move dma_set_max_seg_size() call into i915_driver_hw_probe() - Chris Wilson Signed-off-by: Lyude Paul Reviewed-by: Chris Wilson Cc: # v4.18+ Link: https://patchwork.freedesktop.org/patch/msgid/20190823205251.14298-1-lyude@redhat.com (cherry picked from commit acd674af95d3f627062007429b9c195c6b32361d) Signed-off-by: Jani Nikula Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/i915_drv.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -1569,6 +1569,12 @@ static int i915_driver_init_hw(struct dr pci_set_master(pdev); + /* + * We don't have a max segment size, so set it to the max so sg's + * debugging layer doesn't complain + */ + dma_set_max_seg_size(&pdev->dev, UINT_MAX); + /* overlay on gen2 is broken and can't address above 1G */ if (IS_GEN(dev_priv, 2)) { ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(30));