Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp201027rdb; Sat, 30 Sep 2023 00:38:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEwRS5X0E3MitWhwu57Oa77xbJRq5EDx5WyR8lSssqu/dJiuoktWq4UyhiY8rzVC7p2G35a X-Received: by 2002:a05:6871:54b:b0:1d0:c320:b65e with SMTP id t11-20020a056871054b00b001d0c320b65emr7266600oal.23.1696059527308; Sat, 30 Sep 2023 00:38:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696059527; cv=none; d=google.com; s=arc-20160816; b=Rz/rT4TgSkCgEB641oby5MjjvT8VaB+Em7zmemeBK+P9Byi8ZFhQo4tokclLNX/Orw Jru3QSmkaRGDCurwrTgs0oketr56icttM7YvKsI5VX6+JEOjf1GZoEJijRf+iSfye5aD VTvJn5JrTxVbZyH1FrT9nkrVA00ht38+v+IT47TeHVDMR/xwT0X4eHraxEgCZFChfSCv +suo/XXHagUv1MJyAm9bcYZH2KLxRycJo0kU/63wON42lipI48I31iEB6kgKO3IOdxFP Fqzqwg2pFArj1mTwhSm3ZdDPeqOBnKGOQkdBb0ZhzyZtRYiP38NLVXp4rhb4TOQIIUaq kEeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dV1oXpFvhWtVnes6w/4efDuB5oDa+ue2DJWnYcz/xT8=; fh=BquFFW8WOPNEKaFGJkVyDNDi9HVYC0yNxQYnU2Nd9Zc=; b=IyB31ZbDnLcf6fDGVZEsFalY6ql8bRzF+nJq8evrCsqACi6FOyYwHiotjWPAQmaIGs +xN7DSPmoDTIWhwvtkk4CQOZ8PzqlyAEwoX+nsXJRodH5lFmnnshPa+6tPrQkF0cpXkx jaeOkxM0eL7LBr7puCtZOpwdeftbBPW2S3ikQfZTgScJhwc7XPJzCs3g/7sUpQypX/ps AUWrCr1nfcxPrnDVsXHxf62lX3v0I/t1WnjcYT+jdCIk+/9cCJWSKRZfefokKLsE96p1 stljvZHblyFyvvw4MGh6HRryEVOvWGOcuLqTGs4BBUWlkO265qVufNNnd7QpLp73rh4L 50Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="I/eB9Ij7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id o15-20020a656a4f000000b00565eedb1cf8si25868665pgu.825.2023.09.30.00.38.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 00:38:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="I/eB9Ij7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 359A2823CC76; Sat, 30 Sep 2023 00:36:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234121AbjI3Hgl (ORCPT + 99 others); Sat, 30 Sep 2023 03:36:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229578AbjI3Hgk (ORCPT ); Sat, 30 Sep 2023 03:36:40 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48306FA; Sat, 30 Sep 2023 00:36:38 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0279AC433C7; Sat, 30 Sep 2023 07:36:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696059397; bh=u+Q2YBbAuaGWTrcSYtmRkLm1uMagIDTTzw8E5LMr6DA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=I/eB9Ij7lq/cTWTCAvkOVWa0S/19CAD++XnB9YNCmV0jmYiYJB9y+IweeBFa8hOs5 cniVGLlJnSeTSM82T8xaLthgsjQNikQAkcfKT74c+ut06MZ03ZT9O6Ic11BchgzoQv A28kLMY7Oc6yhkL/RMA9NLG99+/+55fVouNtP2v6RwKTRVdXGFd3JIrv1iFmA5jx/M 2l6Pk8pEo0bcDVn4NkTMX9s2qWYRzcuRN+CSCLfhHqjOeFydIvXRmGSma0+kjbfcCb H8/QcRJnz2m+5pQkCwaEond8SLbLL/QLVItHFNxwq15peUwzwNMICuenN2taFpjWrb cw32fmVbfos7Q== Date: Sat, 30 Sep 2023 10:36:33 +0300 From: Leon Romanovsky To: Niklas Schnelle Cc: Saeed Mahameed , Jason Gunthorpe , Matthew Rosato , Joerg Roedel , Robin Murphy , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shay Drory , Moshe Shemesh , Heiko Carstens , Alexander Gordeev , linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net v2] net/mlx5: fix calling mlx5_cmd_init() before DMA mask is set Message-ID: <20230930073633.GC1296942@unreal> References: <20230929-mlx5_init_fix-v2-1-51ed2094c9d8@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230929-mlx5_init_fix-v2-1-51ed2094c9d8@linux.ibm.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sat, 30 Sep 2023 00:36:58 -0700 (PDT) On Fri, Sep 29, 2023 at 02:15:49PM +0200, Niklas Schnelle wrote: > Since commit 06cd555f73ca ("net/mlx5: split mlx5_cmd_init() to probe and > reload routines") mlx5_cmd_init() is called in mlx5_mdev_init() which is > called in probe_one() before mlx5_pci_init(). This is a problem because > mlx5_pci_init() is where the DMA and coherent mask is set but > mlx5_cmd_init() already does a dma_alloc_coherent(). Thus a DMA > allocation is done during probe before the correct mask is set. This > causes probe to fail initialization of the cmdif SW structs on s390x > after that is converted to the common dma-iommu code. This is because on > s390x DMA addresses below 4 GiB are reserved on current machines and > unlike the old s390x specific DMA API implementation common code > enforces DMA masks. > > Fix this by moving set_dma_caps() out of mlx5_pci_init() and into > probe_one() before mlx5_mdev_init(). To match the overall naming scheme > rename it to mlx5_dma_init(). > > Link: https://lore.kernel.org/linux-iommu/cfc9e9128ed5571d2e36421e347301057662a09e.camel@linux.ibm.com/ > Fixes: 06cd555f73ca ("net/mlx5: split mlx5_cmd_init() to probe and reload routines") > Signed-off-by: Niklas Schnelle > --- > Note: I ran into this while testing the linked series for converting > s390x to use dma-iommu. The existing s390x specific DMA API > implementation doesn't respect DMA masks and is thus not affected > despite of course also only supporting DMA addresses above 4 GiB. > --- > Changes in v2: > - Instead of moving the whole mlx5_pci_init() only move the > set_dma_caps() call so as to keep pci_enable_device() after the FW > command interface initialization (Leon) > - Link to v1: https://lore.kernel.org/r/20230928-mlx5_init_fix-v1-1-79749d45ce60@linux.ibm.com > --- > drivers/net/ethernet/mellanox/mlx5/core/main.c | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > Thanks, Reviewed-by: Leon Romanovsky