Re: [PATCH v11 2/4] PCI: Factor out pci_bus_wait_crs()

2017-08-22 Thread Sinan Kaya
On 8/21/2017 3:37 PM, Sinan Kaya wrote: > bool pci_bus_crs_pending(struct pci_dev *dev, u32 l) > { > if !pci_bus_crs_vis_supported(dev->parent) > return false; Apparently, I can't do this. By the time, we come to here from vendor id read function, the topology has not been set

Re: [PATCH v11 2/4] PCI: Factor out pci_bus_wait_crs()

2017-08-22 Thread Sinan Kaya
On 8/21/2017 3:37 PM, Sinan Kaya wrote: > bool pci_bus_crs_pending(struct pci_dev *dev, u32 l) > { > if !pci_bus_crs_vis_supported(dev->parent) > return false; Apparently, I can't do this. By the time, we come to here from vendor id read function, the topology has not been set

Re: [PATCH v11 2/4] PCI: Factor out pci_bus_wait_crs()

2017-08-21 Thread Bjorn Helgaas
On Mon, Aug 21, 2017 at 04:32:26PM -0400, Sinan Kaya wrote: > 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

Re: [PATCH v11 2/4] PCI: Factor out pci_bus_wait_crs()

2017-08-21 Thread Bjorn Helgaas
On Mon, Aug 21, 2017 at 04:32:26PM -0400, Sinan Kaya wrote: > 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

Re: [PATCH v11 2/4] PCI: Factor out pci_bus_wait_crs()

2017-08-21 Thread Sinan Kaya
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, , 6); >> >>> I think that makes sense. We'd want

Re: [PATCH v11 2/4] PCI: Factor out pci_bus_wait_crs()

2017-08-21 Thread Sinan Kaya
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, , 6); >> >>> I think that makes sense. We'd want

Re: [PATCH v11 2/4] PCI: Factor out pci_bus_wait_crs()

2017-08-21 Thread Bjorn Helgaas
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, , 6); > > > I think that makes sense. We'd want to check for CRS SV being > > enabled, e.g.,

Re: [PATCH v11 2/4] PCI: Factor out pci_bus_wait_crs()

2017-08-21 Thread Bjorn Helgaas
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, , 6); > > > I think that makes sense. We'd want to check for CRS SV being > > enabled, e.g.,

Re: [PATCH v11 2/4] PCI: Factor out pci_bus_wait_crs()

2017-08-21 Thread Sinan Kaya
On 8/21/2017 3:18 PM, Bjorn Helgaas wrote: >> pci_bus_read_dev_vendor_id() >> { >> ... >> if (pci_bus_crs_visibility_supported()) >> return pci_bus_wait_crs(dev->bus, dev->devfn, , 6); >> >> return true >> } >> >> Similar pattern for pci_flr_wait(). Sorry for the

Re: [PATCH v11 2/4] PCI: Factor out pci_bus_wait_crs()

2017-08-21 Thread Sinan Kaya
On 8/21/2017 3:18 PM, Bjorn Helgaas wrote: >> pci_bus_read_dev_vendor_id() >> { >> ... >> if (pci_bus_crs_visibility_supported()) >> return pci_bus_wait_crs(dev->bus, dev->devfn, , 6); >> >> return true >> } >> >> Similar pattern for pci_flr_wait(). Sorry for the

Re: [PATCH v11 2/4] PCI: Factor out pci_bus_wait_crs()

2017-08-21 Thread Bjorn Helgaas
On Mon, Aug 21, 2017 at 09:53:56AM -0400, Sinan Kaya wrote: > On 8/18/2017 5:32 PM, Bjorn Helgaas wrote: > > + if ((*l & 0x) != 0x0001) > > + return true;/* not a CRS completion */ > > > > This version certainly looks cleaner. However, it breaks pci_flr_wait(). > > If some

Re: [PATCH v11 2/4] PCI: Factor out pci_bus_wait_crs()

2017-08-21 Thread Bjorn Helgaas
On Mon, Aug 21, 2017 at 09:53:56AM -0400, Sinan Kaya wrote: > On 8/18/2017 5:32 PM, Bjorn Helgaas wrote: > > + if ((*l & 0x) != 0x0001) > > + return true;/* not a CRS completion */ > > > > This version certainly looks cleaner. However, it breaks pci_flr_wait(). > > If some

Re: [PATCH v11 2/4] PCI: Factor out pci_bus_wait_crs()

2017-08-21 Thread Sinan Kaya
On 8/18/2017 5:32 PM, Bjorn Helgaas wrote: > + if ((*l & 0x) != 0x0001) > + return true;/* not a CRS completion */ > This version certainly looks cleaner. However, it breaks pci_flr_wait(). If some root port doesn't support CRS and returns 0x, pci_bus_wait_crs()

Re: [PATCH v11 2/4] PCI: Factor out pci_bus_wait_crs()

2017-08-21 Thread Sinan Kaya
On 8/18/2017 5:32 PM, Bjorn Helgaas wrote: > + if ((*l & 0x) != 0x0001) > + return true;/* not a CRS completion */ > This version certainly looks cleaner. However, it breaks pci_flr_wait(). If some root port doesn't support CRS and returns 0x, pci_bus_wait_crs()

[PATCH v11 2/4] PCI: Factor out pci_bus_wait_crs()

2017-08-18 Thread Bjorn Helgaas
From: Sinan Kaya Configuration Request Retry Status (CRS) was previously hidden inside pci_bus_read_dev_vendor_id(). We want to add support for CRS in other situations, such as waiting for a device to become ready after a Function Level Reset. Move CRS handling into

[PATCH v11 2/4] PCI: Factor out pci_bus_wait_crs()

2017-08-18 Thread Bjorn Helgaas
From: Sinan Kaya Configuration Request Retry Status (CRS) was previously hidden inside pci_bus_read_dev_vendor_id(). We want to add support for CRS in other situations, such as waiting for a device to become ready after a Function Level Reset. Move CRS handling into pci_bus_wait_crs() so it