Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6790027rwb; Wed, 18 Jan 2023 09:21:47 -0800 (PST) X-Google-Smtp-Source: AMrXdXuvhaIyJ829B4/LwWCGFHP9vGdYFJKJTRM8anD+4ln3HRB6OdEZM3AM9vWas+bmrYOoGUJb X-Received: by 2002:a17:907:20a1:b0:870:23c5:8a81 with SMTP id pw1-20020a17090720a100b0087023c58a81mr8255137ejb.41.1674062507299; Wed, 18 Jan 2023 09:21:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674062507; cv=none; d=google.com; s=arc-20160816; b=CGGUigxqxqOvoTJ1OiPRhnJmuDgnGaW6evQ3uEooeHLqtaseWnkMtxstkiluP4255S uwA2ZZgPhMC/aDfrQcC0e0x05OgScHF99mdTCJKYu6JTBBOm1SieEgWJ1uCnh7wyBKCu PQ3nqAahy107c+S8ksVzv7IvIS6moQEIEnQ8yN5fGWPNpojJHaTccjqaZGGrmYsHvmZ1 MQuGGngbK7z/hgsTTzoGGTPN3fab08yD+ANpc8INqTXlnLGAygBKxldkuoZ3UKCWM5v6 t5FRuqZPxlY9uXAFIxZlOefjU75AGSDTTWJeYxkPg+OpfEPPnnkAouohH4BlIQOiP1BT HeQg== 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 :message-id:subject:cc:to:from:date:dkim-signature; bh=f0mEQl+6d71VtHZwAKzBs3Gv8M3x9H/CZf/XiGLpc4w=; b=LY+HZ6/bAg3hdvriYyfKsPKo158t4ez/lurHiLk4Gkuk3JdCXBu2qw9ngB6Nqt96hi 3XFyr9lF03+0ZEPZFHmEh/I0kakAfhMakH4Kgqj7+Qqdt4QCovjZZkPvwy7RAYP3kahY jEJbijK/DfPazrv4Lgt+oJJIJG2ALmiNFMfYpJDxkQLOVD9mU9ZeHE+1Dlp6kDI6nHs7 5rK9QNK31fonU7TlZBEzfEC2VR3dZBPZWaoAhXUD9KjHCBL2iZon4EsIlNKJIDnutrtC PZ/ehxSgOqZBqU60aHShXaT6YyrABFENUwD6m+gPhM4z33nnVa47PKvPlnrxP1fxu1Z4 n6JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aDzcpyZd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o5-20020a170906974500b008775d7fcb5dsi2609503ejy.46.2023.01.18.09.21.36; Wed, 18 Jan 2023 09:21:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aDzcpyZd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230260AbjARRFC (ORCPT + 45 others); Wed, 18 Jan 2023 12:05:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229499AbjARRFB (ORCPT ); Wed, 18 Jan 2023 12:05:01 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EFFFA5D3; Wed, 18 Jan 2023 09:05:00 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C3266B81DE3; Wed, 18 Jan 2023 17:04:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FEFFC433D2; Wed, 18 Jan 2023 17:04:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674061497; bh=rR4Df/erjWsP9GOk0L3bcywVdAHQZXw0SV5ORmLxzZ0=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=aDzcpyZdaG3x7s6fAheRNzA6NiffEhz4slQEgEBhwtaleCVPKAyDxuN43JBXRKp9v 2//s1Z8HnYz4bKzNnHp+g8a9OFfyWXACYmcFkFkY+R1nHmYz3eLHcmScnrlJovyd7j TwzMooDaHeKyyC7+GuQa63Xq0kE19j9kdcWfnXL+01j0M72DdzNvV4Y+7Cvbwy0gnw i7I6BEC2EMxY3och7sMWC1a/8ZUYiQhmRzpLzbTzYqrN8t+O92Mz4bWpv0JCPiFhnO nIiLxWK9gJLsEvjqT7lXYHRt6/sUERm7oGtVTKLRHnBdOpfkCYoyRIzrrG6vS9YKoI cSO25hKk7dl4A== Date: Wed, 18 Jan 2023 11:04:54 -0600 From: Bjorn Helgaas To: Achal Verma Cc: Tom Joseph , Lorenzo Pieralisi , Rob Herring , Krzysztof Wilczy_ski , Bjorn Helgaas , Vignesh Raghavendra , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Milind Parab , Jian Wang Subject: Re: [PATCH] PCI: cadence: Fix next function value in case of ARI Message-ID: <20230118170454.GA225634@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230118072035.3381993-1-a-verma1@ti.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 On Wed, Jan 18, 2023 at 12:50:35PM +0530, Achal Verma wrote: > From: Jasko-EXT Wojciech > > Next function field in ARI_CAP_AND_CTR field register for last > function should be zero but thats not the case, so this patch > programs the next function field for last function as zero. s/thats/that's/ When you fix the comment formatting, also update the commit log to be imperative style and use the terms from the spec, e.g., Clear the ARI Capability Next Function Number of the last function. ARI_CAP_AND_CTR is a Cadence-specific name (and doesn't seem to appear even in that driver). The commit log should use the PCIe term. See https://chris.beams.io/posts/git-commit/ > Signed-off-by: Jasko-EXT Wojciech > Signed-off-by: Achal Verma > --- > drivers/pci/controller/cadence/pcie-cadence-ep.c | 15 ++++++++++++++- > drivers/pci/controller/cadence/pcie-cadence.h | 6 ++++++ > 2 files changed, 20 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/cadence/pcie-cadence-ep.c b/drivers/pci/controller/cadence/pcie-cadence-ep.c > index b8b655d4047e..6b6904cf0123 100644 > --- a/drivers/pci/controller/cadence/pcie-cadence-ep.c > +++ b/drivers/pci/controller/cadence/pcie-cadence-ep.c > @@ -565,7 +565,8 @@ static int cdns_pcie_ep_start(struct pci_epc *epc) > struct cdns_pcie *pcie = &ep->pcie; > struct device *dev = pcie->dev; > int max_epfs = sizeof(epc->function_num_map) * 8; > - int ret, value, epf; > + int ret, epf, last_fn; > + u32 reg, value; > > /* > * BIT(0) is hardwired to 1, hence function 0 is always enabled > @@ -573,6 +574,18 @@ static int cdns_pcie_ep_start(struct pci_epc *epc) > */ > cdns_pcie_writel(pcie, CDNS_PCIE_LM_EP_FUNC_CFG, epc->function_num_map); > > + /* Setup ARI Next Function Number. > + * This field should point to the next physical Function and 0 for > + * last Function. > + */ > + last_fn = find_last_bit(&epc->function_num_map, BITS_PER_LONG); > + reg = CDNS_PCIE_CORE_PF_I_ARI_CAP_AND_CTRL(last_fn); > + > + // Clear Next Function Number for the last function used. > + value = cdns_pcie_readl(pcie, reg); > + value &= ~CDNS_PCIE_ARI_CAP_NFN_MASK; > + cdns_pcie_writel(pcie, reg, value); > + > if (ep->quirk_disable_flr) { > for (epf = 0; epf < max_epfs; epf++) { > if (!(epc->function_num_map & BIT(epf))) > diff --git a/drivers/pci/controller/cadence/pcie-cadence.h b/drivers/pci/controller/cadence/pcie-cadence.h > index 190786e47df9..68c4c7878111 100644 > --- a/drivers/pci/controller/cadence/pcie-cadence.h > +++ b/drivers/pci/controller/cadence/pcie-cadence.h > @@ -130,6 +130,12 @@ > #define CDNS_PCIE_EP_FUNC_DEV_CAP_OFFSET 0xc0 > #define CDNS_PCIE_EP_FUNC_SRIOV_CAP_OFFSET 0x200 > > +/* > + * Endpoint PF Registers > + */ > +#define CDNS_PCIE_CORE_PF_I_ARI_CAP_AND_CTRL(fn) (0x144 + (fn) * 0x1000) > +#define CDNS_PCIE_ARI_CAP_NFN_MASK GENMASK(15, 8) > + > /* > * Root Port Registers (PCI configuration space for the root port function) > */ > -- > 2.25.1 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel