Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3241901imu; Fri, 18 Jan 2019 07:11:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN52CBJwymReI0+ckGOqHZAI1Y82R6YjsSnYGJ1UJqHLLoHtMZqhss/DXnex+d6qs7RbN0LF X-Received: by 2002:a62:2c81:: with SMTP id s123mr19557740pfs.174.1547824289058; Fri, 18 Jan 2019 07:11:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547824289; cv=none; d=google.com; s=arc-20160816; b=L5nlIt6NN6QI7VpFBJuOroDG3uk+fueLRjuVDMvWZWwqIuAYt15g0i848mXO49cTwD D7QsnT+jSc3VbgEkBKfJeJFdNjLYRNU2oWv5/JCVMoKKyOt/yw0Y40/VGWiGn7SaQR6d e9yeKzGGVV1mEkJOsuGxO0AO4weciRmhTGca6Q7e+MISfEs96gSZQlgXWxchldeK2f25 VlJzbUl5o4oznk5ruCM4ssFSIcQv/1pfM6/EfQzpMHmuPnVAM+mesKrdxEZQDWyhSaxQ Tfn5+ewV6rOh0Xg+fBA2xTNFqLKkeVaBgaGUZ526Jp0z4MVqJ76cIO/frv1KNfadrVRc vgvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=c0QKL1dr4IkA+RCL6hCmv2O7CkI2DUmTHirV7HjMo0Y=; b=J96AeBfG0xzSCFz3waGUUGUujPaUVrs8LTm84LztVZ0hZ5UkS9luOS+Acj8r///XLD lmBWvB+5+vTlxoBf3RvFgjEizvQewRkrPmOWZ0mTusxCu+6qY2snETJcj+WUGTH6oAFQ M68zfzvu8D30l8Jhn/cle5xugx3ds6FxOMxiS9XLHg2Ju7JAkOBqZiR7VKBHbMTNkIFX zQx4qLpnqMvY/A6UcT52j8/BGEFbS4vxWiyGx1aSLhmrPLxmM3jrKzQmHTgRpA4MftgB p4q7L5dWreXZKUHpj3QIxv/W4qX4seo080Ehy+M/tWW50OFpJZ01CPVv39oUPLuUBwTy qBHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IwWs0V0y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h13si4278852pgs.17.2019.01.18.07.11.09; Fri, 18 Jan 2019 07:11:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IwWs0V0y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727695AbfARPIy (ORCPT + 99 others); Fri, 18 Jan 2019 10:08:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:43292 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727448AbfARPIy (ORCPT ); Fri, 18 Jan 2019 10:08:54 -0500 Received: from localhost (173-25-171-118.client.mchsi.com [173.25.171.118]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E34D72086D; Fri, 18 Jan 2019 15:08:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547824133; bh=J8FVti6KX9L9nCKC12RtTaUicjqqz/AebZH1a0x+yVM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IwWs0V0ycObrqzGti/FiFDmYU5GKY477r2Y7uUHUiZ5bb1izLgAzJ8iRXBGj+wOZQ 2jYsKsQEeWUq7XXu3EmxweL4EPz+SQ90D7weo9f/tDwzUONtfwjrKxJyNmky5HJKqm HGnM8Corr7KXk+MKCFg5oIBvW5owIipaj+ITb+mY= Date: Fri, 18 Jan 2019 09:08:51 -0600 From: Bjorn Helgaas To: Srinath Mannam Cc: Lorenzo Pieralisi , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, linux-pci@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] PCI: iproc: CRS state check in config request Message-ID: <20190118150851.GC25249@google.com> References: <1547785403-32268-1-git-send-email-srinath.mannam@broadcom.com> <1547785403-32268-3-git-send-email-srinath.mannam@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1547785403-32268-3-git-send-email-srinath.mannam@broadcom.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 18, 2019 at 09:53:22AM +0530, Srinath Mannam wrote: > In the current implementation, config read of 0xffff0001 data > is assumed as CRS completion. but sometimes 0xffff0001 can be > a valid data. > IPROC PCIe RC has a register to show config request status flags > like SC, UR, CRS and CA. > So that extra check is added in the code to confirm the CRS > state using this register before reissue config request. s/. but/. But/ (Sentences start with a capital letter.) Please wrap this text correctly. If it's a single paragraph, wrap it so the lines are filled. It *looks* like it's intended to be separate paragraphs; they should be separated by blank lines. > Signed-off-by: Srinath Mannam > Reviewed-by: Ray Jui > --- > drivers/pci/controller/pcie-iproc.c | 23 +++++++++++++++++++++-- > 1 file changed, 21 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c > index 13ce80f..ee89d56 100644 > --- a/drivers/pci/controller/pcie-iproc.c > +++ b/drivers/pci/controller/pcie-iproc.c > @@ -63,6 +63,10 @@ > #define APB_ERR_EN_SHIFT 0 > #define APB_ERR_EN BIT(APB_ERR_EN_SHIFT) > > +#define CFG_RD_SUCCESS 0 > +#define CFG_RD_UR 1 > +#define CFG_RD_CRS 2 > +#define CFG_RD_CA 3 > #define CFG_RETRY_STATUS 0xffff0001 > #define CFG_RETRY_STATUS_TIMEOUT_US 500000 /* 500 milliseconds */ > > @@ -300,6 +304,9 @@ enum iproc_pcie_reg { > IPROC_PCIE_IARR4, > IPROC_PCIE_IMAP4, > > + /* config read status */ > + IPROC_PCIE_CFG_RD_STATUS, > + > /* link status */ > IPROC_PCIE_LINK_STATUS, > > @@ -370,6 +377,7 @@ static const u16 iproc_pcie_reg_paxb_v2[] = { > [IPROC_PCIE_IMAP3] = 0xe08, > [IPROC_PCIE_IARR4] = 0xe68, > [IPROC_PCIE_IMAP4] = 0xe70, > + [IPROC_PCIE_CFG_RD_STATUS] = 0xee0, > [IPROC_PCIE_LINK_STATUS] = 0xf0c, > [IPROC_PCIE_APB_ERR_EN] = 0xf40, > [IPROC_PCIE_ORDERING_CFG] = 0x2000, > @@ -501,10 +509,12 @@ static void __iomem *iproc_pcie_map_ep_cfg_reg(struct iproc_pcie *pcie, > return (pcie->base + offset); > } > > -static unsigned int iproc_pcie_cfg_retry(void __iomem *cfg_data_p) > +static unsigned int iproc_pcie_cfg_retry(struct iproc_pcie *pcie, > + void __iomem *cfg_data_p) > { > int timeout = CFG_RETRY_STATUS_TIMEOUT_US; > unsigned int data; > + u32 status; > > /* > * As per PCIe spec r3.1, sec 2.3.2, CRS Software Visibility only > @@ -525,6 +535,15 @@ static unsigned int iproc_pcie_cfg_retry(void __iomem *cfg_data_p) > */ > data = readl(cfg_data_p); > while (data == CFG_RETRY_STATUS && timeout--) { > + /* > + * CRS state is set in CFG_RD status register > + * This will handle the case where CFG_RETRY_STATUS is > + * valid config data. > + */ > + status = iproc_pcie_read_reg(pcie, IPROC_PCIE_CFG_RD_STATUS); > + if (status != CFG_RD_CRS) > + return data; > + > udelay(1); > data = readl(cfg_data_p); > } > @@ -603,7 +622,7 @@ static int iproc_pcie_config_read(struct pci_bus *bus, unsigned int devfn, > if (!cfg_data_p) > return PCIBIOS_DEVICE_NOT_FOUND; > > - data = iproc_pcie_cfg_retry(cfg_data_p); > + data = iproc_pcie_cfg_retry(pcie, cfg_data_p); > > *val = data; > if (size <= 2) > -- > 2.7.4 >