Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1680541lqm; Fri, 3 May 2024 03:19:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW44dgFNIJzPAy8c4fdlq/stFO2QECbRgU7IyYVpuRP4uFV2wZDGXym6WRWg7pOIvvof03gKKxDo3dqjHH2/ZaXbX88O15hZe0eplC6tA== X-Google-Smtp-Source: AGHT+IFWAsIsIJTfSvscq7rZGPznBHKFRkt8ay1TvQbRUO/Wz9/vgobnoSEwk9AvwZRulzopOPf0 X-Received: by 2002:a50:8e4f:0:b0:572:9bd2:9a90 with SMTP id 15-20020a508e4f000000b005729bd29a90mr1259000edx.31.1714731564062; Fri, 03 May 2024 03:19:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714731564; cv=pass; d=google.com; s=arc-20160816; b=KL2tyAJ/YV2Dxx544ZM98vO17JpocpMwXgK4sT98M0kURJRfPZ/NIMK7HMZ4/BdWWJ 1ZXrFiQABT3tMb8iY8iMWQ7BtF5FN86/sst6kwqNaoctxZJP3/JwS4U7FJctFVoporg4 rwVW9juOg3rC5LKF0qIjRqga5eaZs5eRzP8ySJtUOhvaZYtAJR4O1qgsl0loEeHq8S3R TcOZForVV+z6Qz/IvFvnVeSJWBNyd0WX4UwgCuyiUMwl8CV0fjCyHZj9KJy7kdotkaOe mpAaoCJ0yGAOPyASrEBz5uZ5/GHOiMzXwVYhWy+dz/P33XxuRO0yCnbKl2SiRfii2n++ f5gg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:in-reply-to:subject:cc:to:date:from :dkim-signature; bh=rt0sP1XcpbdnFNba1SURSiSjBoNqu1osoIGmUrflZDA=; fh=/O9fc+lbPZB+0ee3lm0DBdXY7TOlM4spomj2AvPA4zY=; b=FMf+kvmNBffeR0gRHs2Y6J3hNh2e2qBojSxHTk+V8C/3vc92N+Ipy9jZqbq2pgpgNm 90VaXAwqn6ubN9fXmfhEIfJlFk5GNo9YoXzpU55SHaWraaWSv1ZtUoT+oxlSi+obdepj TVA5PU9f2oqgTHWm1c/7ZcvpCMp0LdMYuhwMnvTcrJWJgV3nNAC7lVTepo3Ncb+2woqh v5RDIWANVCvouyTyPTX3OhB3u7gP0uEkeeT7Ow7Y0Xqgdz8R6FIaRqyo/0d2B9PCZb1N ZFww9/k2QJP0lk8oZgKcG7zN+85uUa6z2QRzcvRF0SgQXCG911m2yf1ZsBm2qCALDUg4 gq3A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=j+h7jgG7; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-167512-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167512-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id de15-20020a056402308f00b005721b62980bsi1392027edb.241.2024.05.03.03.19.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 03:19:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-167512-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=j+h7jgG7; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-167512-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167512-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9FED41F21D0C for ; Fri, 3 May 2024 10:19:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC1E6152178; Fri, 3 May 2024 10:18:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="j+h7jgG7" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 054401509B2; Fri, 3 May 2024 10:18:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714731529; cv=none; b=Js7zEZUxijuzQuW6quXfOhfmAX/D8gPFHWDc1Ky1+N/2hPE75Y01exUbeqPGqGvNlggpPFFW+ggl0jCg+9rxlyCiRnPXtuFkiuHZ9Wnx/Nzo1nzpOP6rg2pwi/F1FVm3t1aoC1aD5beCwSvmSNecGAKoOwqDE3lC6aUHb8/T5Ao= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714731529; c=relaxed/simple; bh=10Jfz7g2I63T6OjaKjymVfcINKOaZ2J6fHxtq+P/NAM=; h=From:Date:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=aB/syVDSAdxKtU+re2BQnHCv6I7kVTL3C0quAtq74Mz/hSTTWWcHwzHEoP1uZiucAZ8Hw/7z8WQyjJYO7RhcvvMcy9xynSaWhRLJfxc19J/U+QdAWZJZstP+WotI0F7jdWs0Z9Cl+9WFXKNdAQRgZEGxfFwCgzmuaT02KRCg0ek= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=j+h7jgG7; arc=none smtp.client-ip=192.198.163.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714731526; x=1746267526; h=from:date:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=10Jfz7g2I63T6OjaKjymVfcINKOaZ2J6fHxtq+P/NAM=; b=j+h7jgG7i6HgGQNI2Jpz3aiJCo/SDy67Xx2R+VJBeX6/sHeH6e6PPB4r bAL3ZtDeRljDnk2V141NaugnaIjl6JhtoVTXryXJeJv/fJ8dH2zi+Lasw 4vRflK+FsD7j6IAvfLpxo4e1QnTBNUQMtcnt5QPu+jcUvQ8tw3wQzS8ZE r/fQHuQzqOxFLqXu9OkkxC1JCw1qre9jK0OAOTJZH/sRwXLkS1uj43Xbg yDWtqCItYmX/RyY6wWpE4Yl1D5tD3308qpQl3m1sy1YUrffJRxIpbUfId fhL04jDY8Catj2hT68EFwDkVd2pwV6IvZT2SiI510ijgU804jOf5AAKzR w==; X-CSE-ConnectionGUID: VQzpT/yNTMGzlMFEADN4VA== X-CSE-MsgGUID: zjD8uXNySJukRrLe5exepw== X-IronPort-AV: E=McAfee;i="6600,9927,11062"; a="10386639" X-IronPort-AV: E=Sophos;i="6.07,251,1708416000"; d="scan'208";a="10386639" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 May 2024 03:18:45 -0700 X-CSE-ConnectionGUID: fg5BmVqpSRyyi5slzLMDnA== X-CSE-MsgGUID: IEo6vwxzSGqiLHBTgxJ77A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,251,1708416000"; d="scan'208";a="32215585" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.245.247.56]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 May 2024 03:18:42 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Fri, 3 May 2024 13:18:35 +0300 (EEST) To: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= cc: Alex Deucher , amd-gfx@lists.freedesktop.org, Daniel Vetter , David Airlie , Dennis Dalessandro , dri-devel@lists.freedesktop.org, Jason Gunthorpe , Leon Romanovsky , LKML , linux-rdma@vger.kernel.org, "Pan, Xinhui" , =?ISO-8859-15?Q?Christian_K=F6nig?= , Lukas Wunner , Dean Luick Subject: Re: [PATCH 3/3] RDMA/hfi1: Use RMW accessors for changing LNKCTL2 In-Reply-To: <20240215133155.9198-4-ilpo.jarvinen@linux.intel.com> Message-ID: <26be3948-e687-f510-0612-abcac5d919af@linux.intel.com> References: <20240215133155.9198-1-ilpo.jarvinen@linux.intel.com> <20240215133155.9198-4-ilpo.jarvinen@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323328-818284186-1714731515=:1852" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-818284186-1714731515=:1852 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Thu, 15 Feb 2024, Ilpo J=C3=A4rvinen wrote: > Convert open coded RMW accesses for LNKCTL2 to use > pcie_capability_clear_and_set_word() which makes its easier to > understand what the code tries to do. >=20 > LNKCTL2 is not really owned by any driver because it is a collection of > control bits that PCI core might need to touch. RMW accessors already > have support for proper locking for a selected set of registers > (LNKCTL2 is not yet among them but likely will be in the future) to > avoid losing concurrent updates. >=20 > Suggested-by: Lukas Wunner > Signed-off-by: Ilpo J=C3=A4rvinen > Reviewed-by: Dean Luick I found out from Linux RDMA and InfiniBand patchwork that this patch had=20 been silently closed as "Not Applicable". Is there some reason for that? I was sending this change independently out (among 2 similar ones that=20 already got applied) so I wouldn't need to keep carrying it within my PCIe= =20 bandwidth controller series. It seemed useful enough as cleanups to stand= =20 on its own legs w/o requiring it to be part of PCIe bw controller series. Should I resend the patch or do RDMA/IB maintainers prefer it to remain=20 as a part of PCIe BW controller series? --=20 i. > --- > drivers/infiniband/hw/hfi1/pcie.c | 30 ++++++++---------------------- > 1 file changed, 8 insertions(+), 22 deletions(-) >=20 > diff --git a/drivers/infiniband/hw/hfi1/pcie.c b/drivers/infiniband/hw/hf= i1/pcie.c > index 119ec2f1382b..7133964749f8 100644 > --- a/drivers/infiniband/hw/hfi1/pcie.c > +++ b/drivers/infiniband/hw/hfi1/pcie.c > @@ -1207,14 +1207,11 @@ int do_pcie_gen3_transition(struct hfi1_devdata *= dd) > =09=09 (u32)lnkctl2); > =09/* only write to parent if target is not as high as ours */ > =09if ((lnkctl2 & PCI_EXP_LNKCTL2_TLS) < target_vector) { > -=09=09lnkctl2 &=3D ~PCI_EXP_LNKCTL2_TLS; > -=09=09lnkctl2 |=3D target_vector; > -=09=09dd_dev_info(dd, "%s: ..new link control2: 0x%x\n", __func__, > -=09=09=09 (u32)lnkctl2); > -=09=09ret =3D pcie_capability_write_word(parent, > -=09=09=09=09=09=09 PCI_EXP_LNKCTL2, lnkctl2); > +=09=09ret =3D pcie_capability_clear_and_set_word(parent, PCI_EXP_LNKCTL2= , > +=09=09=09=09=09=09=09 PCI_EXP_LNKCTL2_TLS, > +=09=09=09=09=09=09=09 target_vector); > =09=09if (ret) { > -=09=09=09dd_dev_err(dd, "Unable to write to PCI config\n"); > +=09=09=09dd_dev_err(dd, "Unable to change parent PCI target speed\n"); > =09=09=09return_error =3D 1; > =09=09=09goto done; > =09=09} > @@ -1223,22 +1220,11 @@ int do_pcie_gen3_transition(struct hfi1_devdata *= dd) > =09} > =20 > =09dd_dev_info(dd, "%s: setting target link speed\n", __func__); > -=09ret =3D pcie_capability_read_word(dd->pcidev, PCI_EXP_LNKCTL2, &lnkct= l2); > +=09ret =3D pcie_capability_clear_and_set_word(dd->pcidev, PCI_EXP_LNKCTL= 2, > +=09=09=09=09=09=09 PCI_EXP_LNKCTL2_TLS, > +=09=09=09=09=09=09 target_vector); > =09if (ret) { > -=09=09dd_dev_err(dd, "Unable to read from PCI config\n"); > -=09=09return_error =3D 1; > -=09=09goto done; > -=09} > - > -=09dd_dev_info(dd, "%s: ..old link control2: 0x%x\n", __func__, > -=09=09 (u32)lnkctl2); > -=09lnkctl2 &=3D ~PCI_EXP_LNKCTL2_TLS; > -=09lnkctl2 |=3D target_vector; > -=09dd_dev_info(dd, "%s: ..new link control2: 0x%x\n", __func__, > -=09=09 (u32)lnkctl2); > -=09ret =3D pcie_capability_write_word(dd->pcidev, PCI_EXP_LNKCTL2, lnkct= l2); > -=09if (ret) { > -=09=09dd_dev_err(dd, "Unable to write to PCI config\n"); > +=09=09dd_dev_err(dd, "Unable to change device PCI target speed\n"); > =09=09return_error =3D 1; > =09=09goto done; > =09} >=20 --8323328-818284186-1714731515=:1852--