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.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 6F8BAC4363D for ; Wed, 23 Sep 2020 06:45:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E2C620838 for ; Wed, 23 Sep 2020 06:45:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600843557; bh=c968/uCf9Hc4m2zdFJ08br/c/wIR3JoXxVg14G9kHS8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=1kS9gF/kSkh31EacV8fEe3yExrqgyZb21Rrgt1RDPxpSo8E/H0k0knOwtvQbPjWnE 9lwZUapHV6fzjKPaeKHIhVEEiCj1HFQQLqe9WvHSvmJPRMTnQ07lN/7wZQgdjb/KJZ 1eZs4q0t5gLdbgwJQYUsCkVngpX99V46HizOIHQ8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726550AbgIWGp4 (ORCPT ); Wed, 23 Sep 2020 02:45:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:58370 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726179AbgIWGp4 (ORCPT ); Wed, 23 Sep 2020 02:45:56 -0400 Received: from localhost (unknown [213.57.247.131]) (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 3C15420739; Wed, 23 Sep 2020 06:45:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600843555; bh=c968/uCf9Hc4m2zdFJ08br/c/wIR3JoXxVg14G9kHS8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tyke1hkXbjdCO/I4kWJmpnz4HzGsEbdyDYLtZ0CE0XdCQ4OnjFihMt/a52FkWhSE4 q++xgQLgCeAxiMJEjYkNiQTf/QcRrMikhm/NEVpErFhXzuCugNWYAvVH981wDKAOan vaXNAC4hnW9kGEjB5iWKdqs1dBV+Ct4KTtbd+yYQ= Date: Wed, 23 Sep 2020 09:45:52 +0300 From: Leon Romanovsky To: Christoph Hellwig Cc: Doug Ledford , Jason Gunthorpe , Adit Ranadive , Ariel Elior , Bernard Metzler , Christian Benvenuti , Dennis Dalessandro , Devesh Sharma , Faisal Latif , Gal Pressman , Lijun Ou , linux-rdma@vger.kernel.org, Michal Kalderon , Mike Marciniszyn , Naresh Kumar PBS , Nelson Escobar , Parav Pandit , Parvi Kaustubhi , Potnuri Bharat Teja , Selvin Xavier , Shiraz Saleem , Somnath Kotur , Sriharsha Basavapatna , VMware PV-Drivers , Weihang Li , "Wei Hu(Xavier)" , Yishai Hadas , Zhu Yanjun Subject: Re: [PATCH rdma-next] RDMA: Explicitly pass in the dma_device to ib_register_device Message-ID: <20200923064552.GG1223944@unreal> References: <20200922082745.2149973-1-leon@kernel.org> <20200923053840.GA4809@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200923053840.GA4809@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Wed, Sep 23, 2020 at 06:38:40AM +0100, Christoph Hellwig wrote: > > +static void setup_dma_device(struct ib_device *device, > > + struct device *dma_device) > > { > > + if (!dma_device) { > > /* > > + * If the caller does not provide a DMA capable device then the > > + * IB device will be used. In this case the caller should fully > > + * setup the ibdev for DMA. This usually means using > > + * dma_virt_ops. > > */ > > +#ifdef CONFIG_DMA_OPS > > + if (WARN_ON(!device->dev.dma_ops)) > > + return; > > +#endif > > dma ops are entirely optiona and NULL for the most common case > (direct mapping without an IOMMU). IMHO we don't support such mode (without IOMMU). > > > + if (WARN_ON(!device->dev.dma_parms)) > > + return; > > + > > + dma_device = &device->dev; > > + } else { > > + device->dev.dma_parms = dma_device->dma_parms; > > /* > > + * Auto setup the segment size if a DMA device was passed in. > > + * The PCI core sets the maximum segment size to 64 KB. Increase > > + * this parameter to 2 GB. > > */ > > + dma_set_max_seg_size(dma_device, SZ_2G); > > You can't just inherity DMA properties like this this. Please > fix all code that looks at the seg size to look at the DMA device. > > Btw, where does the magic 2G come from? It comes from patch d10bcf947a3e ("RDMA/umem: Combine contiguous PAGE_SIZE regions in SGEs"), I can't say about all devices, but this is the limit for mlx5, rxe and SIW devices. Thanks