Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1740414imu; Thu, 24 Jan 2019 00:44:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN5bXY9UXpSmft9htOjL81o7YjPrOO4VYe91XkrqoeyxG3paw0l72dqGedzjYmO4xcOpeER2 X-Received: by 2002:a17:902:6948:: with SMTP id k8mr5610952plt.2.1548319492749; Thu, 24 Jan 2019 00:44:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548319492; cv=none; d=google.com; s=arc-20160816; b=gAIlgiKqa6PS6QJM1xEEVj90Q/UAnrHLpgUV1WCqih7BaxdBeBNjWc70FqIutJwl5y uvlagIpwmSVNe+ew5UmQRK6w8UIsvVgIdKedm7DgTeDjVvn473+HtjGJmTWRyhVIGDZv 0OSAkPoVjU0nWJQCp4GikmJpuPrya26UxSmNGSl4uB5X9jkp5ZeUQk9hxATIes/hXPin lf7OG6dYaileyvLMENaBkW4OhO7LvJwlkLH7Tmz+skuITUfIq/ITcKqmf0RKRS43AQ7U JOdEfEWEuSklnOTaUHO6q6EKQ8QfZoNuXkWMC6QfOaP90agQMtcx4qU+xyX6ce75pzaA Wykw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=wcC/ahQ5gPh5GGtxDUwG3QmvMzNYe68M+L0cnRtfxnA=; b=SRTJALMjlK+L9X+vcO3mNWa5nXjlghuU5NODaaP+J/IQaOKcK41cr/9sOtVmK9Fr++ 4iUlu9bG2Q/9imglhyOEYbkKZ67SX424be7hxC4+t87qZd/QeOupEnelZVM4PA/YqwRt JaJLi0ERJkwuBmJgWJs43z1mB1CFeKxuzui3KRTITBkUGWT23U8ekaaf4ZU6iwMXGRX0 r7ljRM1moJS0Wyx6LWtG1vfplU/lgXQ7IozxqXulQBz12ohDWeHh/lmZtNx5jG46bg3R q6hTWm39qrUWUsC88AgYpEQ6MQrrnklhzPBDAIsi/swCoK8ZJrM2ZxtLO9ja23mjSouX uAIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=Nr04hESD; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u131si22038180pgc.287.2019.01.24.00.44.37; Thu, 24 Jan 2019 00:44:52 -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=@broadcom.com header.s=google header.b=Nr04hESD; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727617AbfAXInn (ORCPT + 99 others); Thu, 24 Jan 2019 03:43:43 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:33084 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727600AbfAXInn (ORCPT ); Thu, 24 Jan 2019 03:43:43 -0500 Received: by mail-wr1-f68.google.com with SMTP id p7so5543103wru.0 for ; Thu, 24 Jan 2019 00:43:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wcC/ahQ5gPh5GGtxDUwG3QmvMzNYe68M+L0cnRtfxnA=; b=Nr04hESD3WKZRwFKATaiNJz5yZrxXRW94oywd4/jIsFQTiUzIgZplRxM/B4oSzbrNa eBa5F2fFneULcsuNhDo8I0jC69EYWL+AYtzRsa9N4zBiB+VGTvsZivIHWAu808/P4FzP ow24WLWSkrddwFjhCTo1bacoF/xjnEetDdoTI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wcC/ahQ5gPh5GGtxDUwG3QmvMzNYe68M+L0cnRtfxnA=; b=cjDzIW0HmKGcfd58MWxHud06chYCfP4vSg80qtaURV0fVp+J4JSol9k0mjubFqEG6M OVgHsXoQqU8DUDjhz/8FBTUe5Eqk10KzXV9Uo+IctkdyUDlL8yI2dWs4UAKDV0P23RMm EuQobrFrCzqrXOMLwdEX0l8MPHmew5BNha2j5gtrAbaCN0rKynBva4vo5MsxyMFefeP5 LnG06MC+sq7HP1qU2gs+rB9NGbYrW+JCU2+CYnM4B9RRLIiMEhp3ohmQ2YbeITwpmGaF GgEgVSvZg0095wn7SogQL0ii7ISDLROpW2M6AjM6mC4g1AbNSDSeHt1ke2b4h7mNdXMT g0Eg== X-Gm-Message-State: AJcUukdpByfH3AHz5lOEM1Ei8lr4Gb92tb0FSUrjkIEi5QgxOqrcJZ6D lP9O+3aNKmI/O6u7YBYGWbWPHR7L+7rF6HzUvXV3Mw== X-Received: by 2002:adf:e3c8:: with SMTP id k8mr6178425wrm.83.1548319420857; Thu, 24 Jan 2019 00:43:40 -0800 (PST) MIME-Version: 1.0 References: <1547785403-32268-1-git-send-email-srinath.mannam@broadcom.com> <1547785403-32268-3-git-send-email-srinath.mannam@broadcom.com> <20190118150851.GC25249@google.com> In-Reply-To: <20190118150851.GC25249@google.com> From: Srinath Mannam Date: Thu, 24 Jan 2019 14:13:29 +0530 Message-ID: Subject: Re: [PATCH 2/3] PCI: iproc: CRS state check in config request To: Bjorn Helgaas Cc: Lorenzo Pieralisi , Ray Jui , Scott Branden , BCM Kernel Feedback , linux-pci@vger.kernel.org, iommu@lists.linux-foundation.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bjorn, Thanks for review, please see my comments below inline. On Fri, Jan 18, 2019 at 8:38 PM Bjorn Helgaas wrote: > > 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.) will change. Thanks. > > 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. will change. Thanks. > > > 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 > >