Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2575853rdb; Wed, 4 Oct 2023 05:41:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEUokl/QhaAeIiMW54jgcuL3iPekeVPECNojNnJYMdP7B5r0rqI7E3/bqA1Fesn0iLSCX8j X-Received: by 2002:a17:90b:17d0:b0:276:4d97:7cbb with SMTP id me16-20020a17090b17d000b002764d977cbbmr2061796pjb.17.1696423278564; Wed, 04 Oct 2023 05:41:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696423278; cv=none; d=google.com; s=arc-20160816; b=RvXUkPeDTNwsVjaX0dyg+DKUbcNoQwILuVDkIt1/ZsYMHXTeuqfWF0dB8KDrUqudpu dSnd+TEz6qQ5p5Dp74gkj4NK5F2BZIvDSsYaS+TNzze53AokgVS8SSpecaOuIFjLyQLC qsnX0757V0Qs854lzU9rNoDgG+38AG7xGVeklt2vr8YwRRUlz4aaIOkihN3AojFxENgx O1CKCHbKXB9JqibfKIDqGnCdNFbF93Vi4sDcM21Ii579bB+0bmfMb4teQ3bU0pELgx7D ocIVfMVHb0T97VFDBmyr0VQZd/Ij9VUKGgze6vwzFaDvVRWiwcEMsccnm9CzqhcdIh0f /JXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=jO02TTI3icp5GqFKY5HubwwOJO/kC+XyhSo02aR3Ghw=; fh=YA0gZqYqP2lNWJG1ip1uiwhlBgjP63I02ccPJFI5lQw=; b=qn0cxe4opWaIOl25991z5IcE+QZdBjCP49SLVTor4GMnFQ9a5K5hlGwZpiZtcWKhu6 WJ+4/ILB/UcXtv/jWqDJpgSAZ5BUtrStdZf6o5UrYRgIMxeSUnKmtZBBKvlw1ILVozGp YcQxxMK9y8FiBnDqpP6TfFbxRlGp/JBDorDhsn+uGZBIcmA34HkEB/2HHwuxcQi0ylVa Gk26lLn1K57a8FXP9JU5MjpIUVfTu8sqyAUKabZOeHXrZbNxT3gMQpTTJDYUJrqXHin3 akSmHF3VQRX33epvk9EPqSSRWaEvRb4oxv4YOAHUuXlK4DUgmNbF5S8dcf5Dk1wF4aJv p1UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=JNGqbCvM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id oc1-20020a17090b1c0100b00277517b42dasi1563115pjb.35.2023.10.04.05.41.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 05:41:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=JNGqbCvM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 94FC180D44CA; Wed, 4 Oct 2023 05:41:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242399AbjJDMlR (ORCPT + 99 others); Wed, 4 Oct 2023 08:41:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242348AbjJDMlP (ORCPT ); Wed, 4 Oct 2023 08:41:15 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C78093; Wed, 4 Oct 2023 05:41:12 -0700 (PDT) Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 394Ccfa7024330; Wed, 4 Oct 2023 12:40:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : content-transfer-encoding : mime-version; s=pp1; bh=jO02TTI3icp5GqFKY5HubwwOJO/kC+XyhSo02aR3Ghw=; b=JNGqbCvMZqnn26nJz8qP24+O7T77aViOf+JBwsVfgNP8Dq2dT2X4CYJoBUOmu2WXfpgP yPgk8x+BJZABdTqZN8aE/e0ZKZDWRNqWm00AW/AvSs0kueFHj7q2jUK9A7AYyLwEdAI/ WZaOenAsOToKFCHbUaG1A2qPnIF8opV082la71vA+QUIMQ+YrdGaOetsXDLMZZoDCuOW mc7IFMirnTGRJ3LLB2U4I8XMIMKXQvReDc2qO7Sw77LRvzqLIw/bjKjYPgyZsvnOj9yY gNDqJF2d3PgL8pJk/7gPkRlonf+ibKFFT7X60kvKbQEDSC0xdPpUpvvK54fu9jTJxbyp wA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3th81jga3f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Oct 2023 12:40:55 +0000 Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 394Cd8Lp025844; Wed, 4 Oct 2023 12:40:54 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3th81jga31-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Oct 2023 12:40:54 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 394BQADw006698; Wed, 4 Oct 2023 12:40:53 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3tf07k3x6a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Oct 2023 12:40:53 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 394Ceoso58982678 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 4 Oct 2023 12:40:50 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BFE4D20063; Wed, 4 Oct 2023 12:40:50 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8B8512006E; Wed, 4 Oct 2023 12:40:49 +0000 (GMT) Received: from [9.171.77.142] (unknown [9.171.77.142]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 4 Oct 2023 12:40:49 +0000 (GMT) Message-ID: <1acfaaf12d1d24aa255a4da80882f8e0e98d2046.camel@linux.ibm.com> Subject: Re: [PATCH net v2] net/mlx5: fix calling mlx5_cmd_init() before DMA mask is set From: Niklas Schnelle To: Leon Romanovsky , Joerg Roedel Cc: Saeed Mahameed , Jason Gunthorpe , Matthew Rosato , 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 Date: Wed, 04 Oct 2023 14:40:49 +0200 In-Reply-To: <20230930073633.GC1296942@unreal> References: <20230929-mlx5_init_fix-v2-1-51ed2094c9d8@linux.ibm.com> <20230930073633.GC1296942@unreal> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ytJsdJUWEbLsY5TOFmUdtwCz_osZ52Yj X-Proofpoint-ORIG-GUID: fLe6_epYdhPrIGVqShq5OY1MPF1KtZTV Content-Transfer-Encoding: quoted-printable X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-04_04,2023-10-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 malwarescore=0 impostorscore=0 phishscore=0 suspectscore=0 spamscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310040091 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, 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 (snail.vger.email [0.0.0.0]); Wed, 04 Oct 2023 05:41:17 -0700 (PDT) On Sat, 2023-09-30 at 10:36 +0300, Leon Romanovsky wrote: > 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. > >=20 > > 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(). > >=20 > > Link: https://lore.kernel.org/linux-iommu/cfc9e9128ed5571d2e36421e34730= 1057662a09e.camel@linux.ibm.com/ > > Fixes: 06cd555f73ca ("net/mlx5: split mlx5_cmd_init() to probe and relo= ad 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-797= 49d45ce60@linux.ibm.com > > --- > > drivers/net/ethernet/mellanox/mlx5/core/main.c | 18 +++++++++--------- > > 1 file changed, 9 insertions(+), 9 deletions(-) > >=20 >=20 > Thanks, > Reviewed-by: Leon Romanovsky Thank you for the review. Assuming the mlx5 tree is included in linux- next I think it would be easiest if this goes via that tree thereby unbreaking linux-next for s390. Or do you prefer Joerg to take this via the IOMMU tree or even some other tree? Thanks, Niklas