Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3690574rdh; Thu, 28 Sep 2023 22:13:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGUSJ0dh8ZVm7Y09W7qn6vOCjxakCB8BnGKuLdxyuLPgo7FaO8+MM/So7A8YlREAGNmfQAn X-Received: by 2002:a05:6808:28f:b0:3ae:1d7:9c9 with SMTP id z15-20020a056808028f00b003ae01d709c9mr3172572oic.50.1695964431701; Thu, 28 Sep 2023 22:13:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695964431; cv=none; d=google.com; s=arc-20160816; b=vCtHfPTCEZi+GK3/IXT7CPXjYxCfx0bezbkzwQq/2QKmBuh6VxpRYtjCqfcG8ixcLP HIRVGXaEqUyoED34H81slaTkwmT+uJ7cwHZnqaFQnMGWy/zqlh0tnNyMdyLh0VcuuvsS iZ2OIkaTJvjotie3uypeu0glmEbXA5DB/OUoyd0cW09YJbLF+hS98jPwrYdsyL4LNh4/ s34Z0z15cFveQ+LhWIFyUIQCgf1ezOCVfaIr3I7rZ7kbdGFg7nsgdi1JbMY0PpLYKrSu 8XSNitt0tYVqYddZ9xWkitlo6pcFQwvyUknz7u365Qw3+LBUZyP3anrviiLmfsn+SEby BYLg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=n8RPDuko3qlkz+UgK/tpbIH2DJ3LBHkN68qFBLWLsdI=; fh=6Rf9bqzdi9P/pDPF62zWRIRAu1QnmwcBTFlgEdO870w=; b=QN6WzVIy9iqrK0iGF6+/D/fwJFb3lPj1cZ3BtSBzsS1WRTmuHdhWnoeHbumJhE2R8N qQT3n0HlNZ8Sk3SH7J+u43GcWQXsAJ1eiBVau82hNkomZJ3Gr+NEQq/FbajflfX9iH+E VPfdQ0TbxxNhc4/UxB4aPutEPGXeXQQcbsS9kqtsfHciM9PA2O9OjdlKEJJ4Xh0R/UJ4 abmDddqH14uS/iTQNFV1MxMfGwXx73Xg0oRNoR6BsY2CYuCeL4H75qGcFpmXPXii1pRR gJTJ4PZ5i4hNYxKOWWrtjh5R2zv82xcInCZTtO5qlaryy0zhu7S+UMq8NSF0mg86OUnL toWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g91zwaHC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id f24-20020a63e318000000b00578a2da998asi20399725pgh.304.2023.09.28.22.13.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 22:13:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g91zwaHC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 7600C83B0092; Thu, 28 Sep 2023 11:48:24 -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 S229478AbjI1SsU (ORCPT + 99 others); Thu, 28 Sep 2023 14:48:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232215AbjI1SsO (ORCPT ); Thu, 28 Sep 2023 14:48:14 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C604193 for ; Thu, 28 Sep 2023 11:48:11 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-32488a22810so843362f8f.3 for ; Thu, 28 Sep 2023 11:48:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695926890; x=1696531690; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=n8RPDuko3qlkz+UgK/tpbIH2DJ3LBHkN68qFBLWLsdI=; b=g91zwaHCQWa5wnfENvpWAUFkh1oxEpmGWgViMbhSq8FSGShnU/XOs0hSRUPKzez/iU cVgwH/bzzlNN08OqWVVNNbXAtbvoBBXFNJavetvvDnl7p6pVTeMBh8kNa5DRsH5HzOKw RaiUsBLK5l7hHYejpzBRk3sX/uRmP7YcRMMeFYYsUhExSabyuksQeSDa/caIAmrYZU2j ep6OiuHAV1QUfh0/xi013KNW49eujrVoId953IpJGFCt3Ui2rQaPPKn+ibjewExGnvko nz+sivZEniozRHEMwSe9aemkWuMrzPMgzyBrnof74DATusPMInRvbQOOvSdqHef084fW gd1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695926890; x=1696531690; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=n8RPDuko3qlkz+UgK/tpbIH2DJ3LBHkN68qFBLWLsdI=; b=e/rSkv5EU3ESIQ/infulVNRTDEnxldDZ6tOUjc/39BTerKaXQGbWpG7PUUcb5DndO+ 0H8AKfqvuJzHhKjLjILjWGx+uyTJI/h4ktKG5KHyo3VF1R2mhWbIaLWcQMYhCxhEEzKA v2KgHPF40zgZhCayU7KH1D5OaOcUzembyhwq+1MwQffrvrbqdefU52ce8MDZvmRWaFCm nioQrnuH3riNC7eFIP5pa2xbG/3eJ2TJqqlXQMyGrwEVUfP4sPvtx9ETl1BIvlGukC4E T0Fn+8CykxHEjlFjXcXHpPGsI4XTqpxKbC7U/aNJL0PMuqUERGqZxMf+rQPiTUjiphsw lG5Q== X-Gm-Message-State: AOJu0YyhJzNdk78uIYLNb2WM9DpzJzWUxkCnnLe8LCxkDv2nmEFt97NE qMih7JsrC0rOaKbpDeVChUas X-Received: by 2002:a5d:538f:0:b0:319:735c:73e1 with SMTP id d15-20020a5d538f000000b00319735c73e1mr2238282wrv.4.1695926889705; Thu, 28 Sep 2023 11:48:09 -0700 (PDT) Received: from thinkpad (ip1f11e5ef.dynamic.kabel-deutschland.de. [31.17.229.239]) by smtp.gmail.com with ESMTPSA id sd6-20020a170906ce2600b00997e99a662bsm11205205ejb.20.2023.09.28.11.48.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 11:48:09 -0700 (PDT) Date: Thu, 28 Sep 2023 20:48:08 +0200 From: Manivannan Sadhasivam To: Bjorn Helgaas Cc: lpieralisi@kernel.org, kw@linux.com, andersson@kernel.org, konrad.dybcio@linaro.org, bhelgaas@google.com, linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, abel.vesa@linaro.org Subject: Re: [PATCH v3 2/3] PCI: qcom-ep: Make use of PCIE_SPEED2MBS_ENC() macro for encoding link speed Message-ID: <20230928184808.GA12574@thinkpad> References: <20230927154603.172049-2-manivannan.sadhasivam@linaro.org> <20230927175542.GA455424@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230927175542.GA455424@bhelgaas> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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]); Thu, 28 Sep 2023 11:48:24 -0700 (PDT) On Wed, Sep 27, 2023 at 12:55:42PM -0500, Bjorn Helgaas wrote: > On Wed, Sep 27, 2023 at 05:46:02PM +0200, Manivannan Sadhasivam wrote: > > Instead of hardcoding the link speed in MBps, let's make use of the > > existing PCIE_SPEED2MBS_ENC() macro that does the encoding of the > > link speed for us. Also, let's Wrap it with QCOM_PCIE_LINK_SPEED_TO_BW() > > macro to do the conversion to ICC speed. > > In subject, /Make use of/Use/ would make better use of the subject > line. Lots of "uses" there :) > > Above, s/let's//, and also s/make use of/use/. > Ok, I will reword accordingly. > > +#define QCOM_PCIE_LINK_SPEED_TO_BW(speed) \ > > + Mbps_to_icc(PCIE_SPEED2MBS_ENC(pcie_link_speed[speed])) > > It's a shame to have to duplicate this macro in pcie-qcom.c and in > pcie-qcom-ep.c, especially since there's nothing qcom-specific in it. > > Would a macro like this fit in interconnect.h? > Unfortunately, no. This macro is neither interconnect specific nor PCI, but a kind of both used by the driver. So it makes sense to keep it in the driver itself for now. If we happen to create a common header for host and ep drivers in the future, it can be moved to that. > > - ret = icc_set_bw(pcie_ep->icc_mem, 0, MBps_to_icc(PCIE_GEN1_BW_MBPS)); > > + ret = icc_set_bw(pcie_ep->icc_mem, 0, QCOM_PCIE_LINK_SPEED_TO_BW(1)); > > "1" is not very informative here. Maybe PCIE_SPEED_2_5GT? (I didn't > completely verify that this is equivalent.) > No. PCIE_SPEED_2_5GT is defined as 0x14 in pci.h. And I do not want to add a macro for just "1" here. - Mani > Bjorn -- மணிவண்ணன் சதாசிவம்