All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sinan Kaya <okaya@codeaurora.org>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, Timur Tabi <timur@codeaurora.org>,
	linux-kernel@vger.kernel.org,
	Alex Williamson <alex.williamson@redhat.com>,
	linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v11 2/4] PCI: Factor out pci_bus_wait_crs()
Date: Mon, 21 Aug 2017 16:32:26 -0400	[thread overview]
Message-ID: <967910e7-e64d-2fa4-10b8-ca0400d7ed2f@codeaurora.org> (raw)
In-Reply-To: <20170821202338.GD28977@bhelgaas-glaptop.roam.corp.google.com>

On 8/21/2017 4:23 PM, Bjorn Helgaas wrote:
> On Mon, Aug 21, 2017 at 03:37:06PM -0400, Sinan Kaya wrote:
>> On 8/21/2017 3:18 PM, Bjorn Helgaas wrote:
>> ...
>> if (pci_bus_crs_pending(id))
>> 	return pci_bus_wait_crs(dev->bus, dev->devfn, &id, 60000);
>>
>>> I think that makes sense.  We'd want to check for CRS SV being
>>> enabled, e.g., maybe read PCI_EXP_RTCTL_CRSSVE back in
>>> pci_enable_crs() and cache it somewhere.  Maybe a crs_sv_enabled bit
>>> in the root port's pci_dev, and check it with something like what
>>> pcie_root_rcb_set() does?
>>>
>>
>> You can observe CRS under the following conditions
>>
>> 1. root port <-> endpoint 
>> 2. bridge <-> endpoint 
>> 3. root port<->bridge
>>
>> I was relying on the fact that we are reading 0x001 as an indication that
>> this device detected CRS. Maybe, this is too indirect.
>>
>> If we also want to capture the capability, I think the right thing is to
>> check the parent capability.
>>
>> bool pci_bus_crs_vis_supported(struct pci_dev *bridge)
>> {
>> 	if (device type(bridge) == root port)
>> 		return read(root_crs_register_reg);
>>
>> 	if (device type(bridge) == switch)
>> 		return read(switch_crs_register);
> 
> I don't understand this part.  AFAIK, CRS SV is only a feature of root
> ports.  The capability and enable bits are in the Root Capabilities
> and Root Control registers.
> 

No question about it.

> It's certainly true that a device below a switch can respond with a
> CRS completion, but the switch is not the requester, and my
> understanding is that it would not take any action on the completion
> other than passing it upstream.
> 

I saw some bridge references in the spec for CRS. I was going to do
some research for it. You answered my question. I was curious how this
would impact the behavior.

"Bridge Configuration Retry Enable – When Set, this bit enables PCI Express
to PCI/PCI-X bridges to return Configuration Request Retry Status (CRS) in
response to Configuration Requests that target devices below the bridge. 
Refer to the PCI Express to PCI/PCI-X Bridge Specification, Revision 1.0 for
further details."

-- 
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

WARNING: multiple messages have this Message-ID (diff)
From: okaya@codeaurora.org (Sinan Kaya)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v11 2/4] PCI: Factor out pci_bus_wait_crs()
Date: Mon, 21 Aug 2017 16:32:26 -0400	[thread overview]
Message-ID: <967910e7-e64d-2fa4-10b8-ca0400d7ed2f@codeaurora.org> (raw)
In-Reply-To: <20170821202338.GD28977@bhelgaas-glaptop.roam.corp.google.com>

On 8/21/2017 4:23 PM, Bjorn Helgaas wrote:
> On Mon, Aug 21, 2017 at 03:37:06PM -0400, Sinan Kaya wrote:
>> On 8/21/2017 3:18 PM, Bjorn Helgaas wrote:
>> ...
>> if (pci_bus_crs_pending(id))
>> 	return pci_bus_wait_crs(dev->bus, dev->devfn, &id, 60000);
>>
>>> I think that makes sense.  We'd want to check for CRS SV being
>>> enabled, e.g., maybe read PCI_EXP_RTCTL_CRSSVE back in
>>> pci_enable_crs() and cache it somewhere.  Maybe a crs_sv_enabled bit
>>> in the root port's pci_dev, and check it with something like what
>>> pcie_root_rcb_set() does?
>>>
>>
>> You can observe CRS under the following conditions
>>
>> 1. root port <-> endpoint 
>> 2. bridge <-> endpoint 
>> 3. root port<->bridge
>>
>> I was relying on the fact that we are reading 0x001 as an indication that
>> this device detected CRS. Maybe, this is too indirect.
>>
>> If we also want to capture the capability, I think the right thing is to
>> check the parent capability.
>>
>> bool pci_bus_crs_vis_supported(struct pci_dev *bridge)
>> {
>> 	if (device type(bridge) == root port)
>> 		return read(root_crs_register_reg);
>>
>> 	if (device type(bridge) == switch)
>> 		return read(switch_crs_register);
> 
> I don't understand this part.  AFAIK, CRS SV is only a feature of root
> ports.  The capability and enable bits are in the Root Capabilities
> and Root Control registers.
> 

No question about it.

> It's certainly true that a device below a switch can respond with a
> CRS completion, but the switch is not the requester, and my
> understanding is that it would not take any action on the completion
> other than passing it upstream.
> 

I saw some bridge references in the spec for CRS. I was going to do
some research for it. You answered my question. I was curious how this
would impact the behavior.

"Bridge Configuration Retry Enable ? When Set, this bit enables PCI Express
to PCI/PCI-X bridges to return Configuration Request Retry Status (CRS) in
response to Configuration Requests that target devices below the bridge. 
Refer to the PCI Express to PCI/PCI-X Bridge Specification, Revision 1.0 for
further details."

-- 
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

  reply	other threads:[~2017-08-21 20:32 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-18 21:31 [PATCH v11 0/4] PCI: Use CRS Software Visibility to wait for device to become ready Bjorn Helgaas
2017-08-18 21:31 ` Bjorn Helgaas
2017-08-18 21:31 ` Bjorn Helgaas
2017-08-18 21:32 ` [PATCH v11 1/4] PCI: Don't ignore valid response before CRS timeout Bjorn Helgaas
2017-08-18 21:32   ` Bjorn Helgaas
2017-08-18 21:32   ` Bjorn Helgaas
2017-08-21 14:02   ` Sinan Kaya
2017-08-21 14:02     ` Sinan Kaya
2017-08-21 14:02     ` Sinan Kaya
2017-08-21 17:44     ` Bjorn Helgaas
2017-08-21 17:44       ` Bjorn Helgaas
2017-08-21 17:44       ` Bjorn Helgaas
2017-08-18 21:32 ` [PATCH v11 2/4] PCI: Factor out pci_bus_wait_crs() Bjorn Helgaas
2017-08-18 21:32   ` Bjorn Helgaas
2017-08-18 21:32   ` Bjorn Helgaas
2017-08-21 13:53   ` Sinan Kaya
2017-08-21 13:53     ` Sinan Kaya
2017-08-21 13:53     ` Sinan Kaya
2017-08-21 19:18     ` Bjorn Helgaas
2017-08-21 19:18       ` Bjorn Helgaas
2017-08-21 19:18       ` Bjorn Helgaas
2017-08-21 19:37       ` Sinan Kaya
2017-08-21 19:37         ` Sinan Kaya
2017-08-21 20:23         ` Bjorn Helgaas
2017-08-21 20:23           ` Bjorn Helgaas
2017-08-21 20:23           ` Bjorn Helgaas
2017-08-21 20:32           ` Sinan Kaya [this message]
2017-08-21 20:32             ` Sinan Kaya
2017-08-21 21:09             ` Bjorn Helgaas
2017-08-21 21:09               ` Bjorn Helgaas
2017-08-21 21:09               ` Bjorn Helgaas
2017-08-23  4:40         ` Sinan Kaya
2017-08-23  4:40           ` Sinan Kaya
2017-08-18 21:32 ` [PATCH v11 3/4] PCI: Handle CRS ("device not ready") returned by device after FLR Bjorn Helgaas
2017-08-18 21:32   ` Bjorn Helgaas
2017-08-18 21:32   ` Bjorn Helgaas
2017-08-18 21:32 ` [PATCH v11 4/4] PCI: Warn periodically while waiting for device to become ready Bjorn Helgaas
2017-08-18 21:32   ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=967910e7-e64d-2fa4-10b8-ca0400d7ed2f@codeaurora.org \
    --to=okaya@codeaurora.org \
    --cc=alex.williamson@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=helgaas@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=timur@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.