Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13474166ybl; Sun, 29 Dec 2019 12:46:45 -0800 (PST) X-Google-Smtp-Source: APXvYqxfY2Gid0oGyu+9xxzRgFTSAS4uwpGozWJbu6nTQB668D69shBMvfx/jtXLAUsOsFyu3m7J X-Received: by 2002:a9d:6c99:: with SMTP id c25mr51045390otr.178.1577652405095; Sun, 29 Dec 2019 12:46:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577652405; cv=none; d=google.com; s=arc-20160816; b=xonhKLauUhxwOX4YKs2fsYsYvpfRkZ/Ce68FbrisPMM8YdEWIERIGxQWCQDoXcRJ5j mQ3Xekhh+F139YqYMw8PAJ5MCDkK+//jgCECk8OP2N2evkHI2VyZL/GLJtjYE1/Q9NVB cet4wySppd9rSaTTJa6U2yDtfzwxy5va2eoI9AWyVhXbYCnuRUDpRaWskDGeUyb2wftI Nv70vktrLAdHZdofApekcMPl8rCb/5BEswcN7mPoKDfGC4umFpkesaExbG5I5NCu4Vz3 DORgUig2WXKOnyb3NvVi+WYJMlQGyf7ArAxhXxpSsHRd1s+wlqbjfi6zc6wxNZxC7o2M fG2g== 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=2sxWXsQ6SFS1V9v52RS+VuKmeA8ZS1FshPyn6HJNwuI=; b=NRs51x/z6uA2g9C/ffGiEotY4Z/CNMDItAmwa4AHQGlR4wi3EIsCLZRImDbUiKtx1J TSxGOWlf6Oj9ac6m5E6o23rT6ZpxqfeZDomw2A0zXAzBn0GcMteOzOX8RJrzNjYwHNMn JJQ9WorNZvC734mS9w2FdnirAslSLBPEiiDq0W/9ka+HKTmt+58diTHImXBcW8RAVM63 LsLs2m5P10yE+u5ODtlCNWwirHHDM0wWnswu2ubfQOoOFQRM7sZMOmKG1jarcmI2EKMM rZON/ubW9KwrFvN2Ev4KuWAhUEnydQ+SDYKbBZ6Bf59TbQWNT9NBe99EnnhZYpRAuqUQ VoeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yr1qrbm8; 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 i15si20705203otl.247.2019.12.29.12.46.34; Sun, 29 Dec 2019 12:46:45 -0800 (PST) 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=yr1qrbm8; 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 S1731642AbfL2Rt0 (ORCPT + 99 others); Sun, 29 Dec 2019 12:49:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:33156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731633AbfL2RtY (ORCPT ); Sun, 29 Dec 2019 12:49:24 -0500 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 27A3D206DB; Sun, 29 Dec 2019 17:49:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577641763; bh=uNZl7f5UhB+UsZoV84lUGTHZX/E8YRgp6q45n84cjgM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yr1qrbm8M9kjwnRdJpOZqMm0yiF1b7aXH1BhO06RrY4UFwuGRq1Cvsv00xg7GGAH0 ocn7eTx7edvl7GVoHHknESdb7CZYYjkdJNzPm+ssVjODqyrYRjRuSgzqVOm3PWhQYK szhkcYBdmHt4F0BiTmwhIarEfJYhcFdHjZ8RmSp8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.4 202/434] RDMA/core: Set DMA parameters correctly Date: Sun, 29 Dec 2019 18:24:15 +0100 Message-Id: <20191229172715.246516066@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229172702.393141737@linuxfoundation.org> References: <20191229172702.393141737@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: Bart Van Assche [ Upstream commit c9121262d57b8a3be4f08073546436ba0128ca6a ] The dma_set_max_seg_size() call in setup_dma_device() does not have any effect since device->dev.dma_parms is NULL. Fix this by initializing device->dev.dma_parms first. Link: https://lore.kernel.org/r/20191025225830.257535-5-bvanassche@acm.org Fixes: d10bcf947a3e ("RDMA/umem: Combine contiguous PAGE_SIZE regions in SGEs") Signed-off-by: Bart Van Assche Reviewed-by: Jason Gunthorpe Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/core/device.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 50a92442c4f7..e6327d8f5b79 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -1199,9 +1199,21 @@ static void setup_dma_device(struct ib_device *device) WARN_ON_ONCE(!parent); device->dma_device = parent; } - /* Setup default max segment size for all IB devices */ - dma_set_max_seg_size(device->dma_device, SZ_2G); + if (!device->dev.dma_parms) { + if (parent) { + /* + * The caller did not provide DMA parameters, so + * 'parent' probably represents a PCI device. The PCI + * core sets the maximum segment size to 64 + * KB. Increase this parameter to 2 GB. + */ + device->dev.dma_parms = parent->dma_parms; + dma_set_max_seg_size(device->dma_device, SZ_2G); + } else { + WARN_ON_ONCE(true); + } + } } /* -- 2.20.1