RE: [PATCH v1 0/3] PCI: Configure PCIe MPS settings

2017-02-24 Thread Dexuan Cui
> From: Bjorn Helgaas
> ...
> My question wasn't so much whether pci-hyperv.c *needs* to set MPS; I
> don't expect a guest to need to or even be able to configure things
> like that.

I agree.

> My question is whether it would do any harm if we did eventually do
> MPS configuration in the generic pci_scan_child_bus() path.  If/when
> we do that, the Hyper-V guest will attempt to do MPS configuration.  I
> think this would be a no-op.

Yes. It's a no-op, as I explained in my previous mail.

>  And I think it would also be a no-op if
> we made pci-hyperv.c call pcie_bus_configure_settings() today.

Yes, I can confirm it's a no-op too.

> I'm really just looking for confirmation of that.  If it is true that
> these are no-ops, I would consider adding a pci-hyperv.c call to
> pcie_bus_configure_settings() simply to make it conform to the pattern
> that "everything that calls pci_scan_child_bus() should also call
> pcie_bus_configure_settings()".

Please help to add that. Thanks!
 
> If every caller of pci_scan_child_bus() also calls
> pcie_bus_configure_settings(), it will make it easier in the future to
> fold pcie_bus_configure_settings() into pci_scan_child_bus().
> 
> Bjorn

Thanks! I see.

Thanks,
-- Dexuan
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v1 0/3] PCI: Configure PCIe MPS settings

2017-02-24 Thread Bjorn Helgaas
On Fri, Feb 24, 2017 at 11:16:03AM +, Dexuan Cui wrote:
> > From: devel [mailto:driverdev-devel..@...] On Behalf Of Bjorn Helgaas
> > Sent: Saturday, February 11, 2017 06:00
> > ...
> > On Wed, Feb 08, 2017 at 04:49:22PM -0600, Bjorn Helgaas wrote:
> > > The PCI core doesn't configure the PCIe MPS settings by itself.  Each
> > > host bridge driver has to call pcie_bus_configure_settings() to make
> > > this happen.
> > >
> > > Jon fixed this already for pcie-iproc.c.  I propose these similar
> > > patches for other drivers.
> > >
> > > HV guys, I included you because create_root_hv_pci_bus() is one place
> > > that calls pci_scan_child_bus() but does not call
> > > pcie_bus_configure_settings().  I know you probably don't strictly
> > > *need* to configure MPS settings in a paravirtual front-end, but the
> > > PCI core does other device configuration in this path:
> > >
> > >   pci_scan_child_bus
> > > pci_scan_slot
> > >   pci_scan_single_device
> > > pci_device_add
> > >   pci_configure_device
> > >   pci_init_capabilities
> > >
> > > and I would like to eventually migrate the MPS configuration into that
> > > same path.  Since we do this other configuration for HV devices
> > > already, I think pcie_bus_configure_settings() should also work (even
> > > if it ends up not doing anything to real devices).
> > >
> > > It would make that eventual migration easier if all the
> > > pci_scan_child_bus() callers had the same pattern of calling
> > > pcie_bus_configure_settings().
> > >
> > > So would it make sense to make a similar patch for HV?  It looks easy
> > > to add it to create_root_hv_pci_bus(), but I don't know exactly what
> > > to do about pci_devices_present_work().
> 
> (I'm sorry for the really late response. I neglected the thread somehow...)

No problem, I'm kind of bad about that, too.

> Hi Bjorn,
> IMO we don't need to make any change to pci-hyperv.c: when a
> PCIe device is passed through to a guest on Hyper-V, in the guest the
> device only directly appears on a new root bus, and the new root bus
> doesn't have any child bus, and the new root bus itself is actually only
> a logical concept instead of a concrete device (i.e. it doesn't have its
> own BDF at all).
> 
> So, in the path pci_scan_child_bus -> ... -> pci_device_add ->
> pci_configure_device -> pci_configure_mps, we're sure
> pci_upstream_bridge() is NULL, so pci_configure_mps does nothing.
> 
> And since the root bus has no child bus, we don't need to call
> pcie_bus_configure_settings(child).
> 
> Then you may ask how the MPS is set.
> I suppose the para-virtual PCI back-end driver on the host
> should take care of this properly.
> 
> FWIW, after passing through a Mellanox VF to Linux guest, in the
> guest I get this for the device by lspci:
> DevCap: MaxPayload 512 bytes
> DevCtl: MaxPayload 128 bytes, MaxReadReq 128 bytes

My question wasn't so much whether pci-hyperv.c *needs* to set MPS; I
don't expect a guest to need to or even be able to configure things
like that.

My question is whether it would do any harm if we did eventually do
MPS configuration in the generic pci_scan_child_bus() path.  If/when
we do that, the Hyper-V guest will attempt to do MPS configuration.  I
think this would be a no-op.  And I think it would also be a no-op if
we made pci-hyperv.c call pcie_bus_configure_settings() today.

I'm really just looking for confirmation of that.  If it is true that
these are no-ops, I would consider adding a pci-hyperv.c call to
pcie_bus_configure_settings() simply to make it conform to the pattern
that "everything that calls pci_scan_child_bus() should also call
pcie_bus_configure_settings()".

If every caller of pci_scan_child_bus() also calls
pcie_bus_configure_settings(), it will make it easier in the future to
fold pcie_bus_configure_settings() into pci_scan_child_bus().

Bjorn
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v1 0/3] PCI: Configure PCIe MPS settings

2017-02-24 Thread Dexuan Cui
> From: devel [mailto:driverdev-devel..@...] On Behalf Of Bjorn Helgaas
> Sent: Saturday, February 11, 2017 06:00
> ...
> On Wed, Feb 08, 2017 at 04:49:22PM -0600, Bjorn Helgaas wrote:
> > The PCI core doesn't configure the PCIe MPS settings by itself.  Each
> > host bridge driver has to call pcie_bus_configure_settings() to make
> > this happen.
> >
> > Jon fixed this already for pcie-iproc.c.  I propose these similar
> > patches for other drivers.
> >
> > HV guys, I included you because create_root_hv_pci_bus() is one place
> > that calls pci_scan_child_bus() but does not call
> > pcie_bus_configure_settings().  I know you probably don't strictly
> > *need* to configure MPS settings in a paravirtual front-end, but the
> > PCI core does other device configuration in this path:
> >
> >   pci_scan_child_bus
> > pci_scan_slot
> >   pci_scan_single_device
> > pci_device_add
> >   pci_configure_device
> >   pci_init_capabilities
> >
> > and I would like to eventually migrate the MPS configuration into that
> > same path.  Since we do this other configuration for HV devices
> > already, I think pcie_bus_configure_settings() should also work (even
> > if it ends up not doing anything to real devices).
> >
> > It would make that eventual migration easier if all the
> > pci_scan_child_bus() callers had the same pattern of calling
> > pcie_bus_configure_settings().
> >
> > So would it make sense to make a similar patch for HV?  It looks easy
> > to add it to create_root_hv_pci_bus(), but I don't know exactly what
> > to do about pci_devices_present_work().

(I'm sorry for the really late response. I neglected the thread somehow...)

Hi Bjorn,
IMO we don't need to make any change to pci-hyperv.c: when a
PCIe device is passed through to a guest on Hyper-V, in the guest the
device only directly appears on a new root bus, and the new root bus
doesn't have any child bus, and the new root bus itself is actually only
a logical concept instead of a concrete device (i.e. it doesn't have its
own BDF at all).

So, in the path pci_scan_child_bus -> ... -> pci_device_add ->
pci_configure_device -> pci_configure_mps, we're sure
pci_upstream_bridge() is NULL, so pci_configure_mps does nothing.

And since the root bus has no child bus, we don't need to call
pcie_bus_configure_settings(child).

Then you may ask how the MPS is set.
I suppose the para-virtual PCI back-end driver on the host
should take care of this properly.

FWIW, after passing through a Mellanox VF to Linux guest, in the
guest I get this for the device by lspci:
DevCap: MaxPayload 512 bytes
DevCtl: MaxPayload 128 bytes, MaxReadReq 128 bytes

Thanks
-- Dexuan
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v1 0/3] PCI: Configure PCIe MPS settings

2017-02-10 Thread Bjorn Helgaas
On Wed, Feb 08, 2017 at 04:49:22PM -0600, Bjorn Helgaas wrote:
> [Some of you will get this twice because Gmail and I aren't getting along
> today; sorry]
> 
> The PCI core doesn't configure the PCIe MPS settings by itself.  Each
> host bridge driver has to call pcie_bus_configure_settings() to make
> this happen.
> 
> Jon fixed this already for pcie-iproc.c.  I propose these similar
> patches for other drivers.
> 
> HV guys, I included you because create_root_hv_pci_bus() is one place
> that calls pci_scan_child_bus() but does not call
> pcie_bus_configure_settings().  I know you probably don't strictly
> *need* to configure MPS settings in a paravirtual front-end, but the
> PCI core does other device configuration in this path:
> 
>   pci_scan_child_bus
> pci_scan_slot
>   pci_scan_single_device
> pci_device_add
>   pci_configure_device
>   pci_init_capabilities
> 
> and I would like to eventually migrate the MPS configuration into that
> same path.  Since we do this other configuration for HV devices
> already, I think pcie_bus_configure_settings() should also work (even
> if it ends up not doing anything to real devices).
> 
> It would make that eventual migration easier if all the
> pci_scan_child_bus() callers had the same pattern of calling
> pcie_bus_configure_settings().
> 
> So would it make sense to make a similar patch for HV?  It looks easy
> to add it to create_root_hv_pci_bus(), but I don't know exactly what
> to do about pci_devices_present_work().
> 
> ---
> 
> Bjorn Helgaas (3):
>   PCI: xilinx: Configure PCIe MPS settings
>   PCI: versatile: Configure PCIe MPS settings
>   PCI: xgene: Configure PCIe MPS settings
> 
> 
>  drivers/pci/host/pci-versatile.c |4 +++-
>  drivers/pci/host/pci-xgene.c |4 +++-
>  drivers/pci/host/pcie-xilinx.c   |4 +++-
>  3 files changed, 9 insertions(+), 3 deletions(-)

I applied these to pci/host-xilinx, pci/host-versatile, and
pci/host-xgene, respectively, for v4.11.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v1 0/3] PCI: Configure PCIe MPS settings

2017-02-08 Thread KY Srinivasan


> -Original Message-
> From: Bjorn Helgaas [mailto:helg...@kernel.org]
> Sent: Wednesday, February 8, 2017 2:49 PM
> To: linux-...@vger.kernel.org
> Cc: Rob Herring ; Haiyang Zhang
> ; Michal Simek ; Jon
> Mason ; Ray Jui ;
> Sören Brinkmann ;
> de...@linuxdriverproject.org; KY Srinivasan ; linux-
> arm-ker...@lists.infradead.org; Tanmay Inamdar 
> Subject: [PATCH v1 0/3] PCI: Configure PCIe MPS settings
> 
> [Some of you will get this twice because Gmail and I aren't getting along
> today; sorry]
> 
> The PCI core doesn't configure the PCIe MPS settings by itself.  Each
> host bridge driver has to call pcie_bus_configure_settings() to make
> this happen.
> 
> Jon fixed this already for pcie-iproc.c.  I propose these similar
> patches for other drivers.
> 
> HV guys, I included you because create_root_hv_pci_bus() is one place
> that calls pci_scan_child_bus() but does not call
> pcie_bus_configure_settings().  I know you probably don't strictly
> *need* to configure MPS settings in a paravirtual front-end, but the
> PCI core does other device configuration in this path:
> 
>   pci_scan_child_bus
> pci_scan_slot
>   pci_scan_single_device
> pci_device_add
>   pci_configure_device
>   pci_init_capabilities
> 
> and I would like to eventually migrate the MPS configuration into that
> same path.  Since we do this other configuration for HV devices
> already, I think pcie_bus_configure_settings() should also work (even
> if it ends up not doing anything to real devices).
> 
> It would make that eventual migration easier if all the
> pci_scan_child_bus() callers had the same pattern of calling
> pcie_bus_configure_settings().
> 
> So would it make sense to make a similar patch for HV?  It looks easy
> to add it to create_root_hv_pci_bus(), but I don't know exactly what
> to do about pci_devices_present_work().

Bjorn,

We will take a look.

K. Y
> 
> ---
> 
> Bjorn Helgaas (3):
>   PCI: xilinx: Configure PCIe MPS settings
>   PCI: versatile: Configure PCIe MPS settings
>   PCI: xgene: Configure PCIe MPS settings
> 
> 
>  drivers/pci/host/pci-versatile.c |4 +++-
>  drivers/pci/host/pci-xgene.c |4 +++-
>  drivers/pci/host/pcie-xilinx.c   |4 +++-
>  3 files changed, 9 insertions(+), 3 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v1 0/3] PCI: Configure PCIe MPS settings

2017-02-08 Thread Bjorn Helgaas
[Some of you will get this twice because Gmail and I aren't getting along
today; sorry]

The PCI core doesn't configure the PCIe MPS settings by itself.  Each
host bridge driver has to call pcie_bus_configure_settings() to make
this happen.

Jon fixed this already for pcie-iproc.c.  I propose these similar
patches for other drivers.

HV guys, I included you because create_root_hv_pci_bus() is one place
that calls pci_scan_child_bus() but does not call
pcie_bus_configure_settings().  I know you probably don't strictly
*need* to configure MPS settings in a paravirtual front-end, but the
PCI core does other device configuration in this path:

  pci_scan_child_bus
pci_scan_slot
  pci_scan_single_device
pci_device_add
  pci_configure_device
  pci_init_capabilities

and I would like to eventually migrate the MPS configuration into that
same path.  Since we do this other configuration for HV devices
already, I think pcie_bus_configure_settings() should also work (even
if it ends up not doing anything to real devices).

It would make that eventual migration easier if all the
pci_scan_child_bus() callers had the same pattern of calling
pcie_bus_configure_settings().

So would it make sense to make a similar patch for HV?  It looks easy
to add it to create_root_hv_pci_bus(), but I don't know exactly what
to do about pci_devices_present_work().

---

Bjorn Helgaas (3):
  PCI: xilinx: Configure PCIe MPS settings
  PCI: versatile: Configure PCIe MPS settings
  PCI: xgene: Configure PCIe MPS settings


 drivers/pci/host/pci-versatile.c |4 +++-
 drivers/pci/host/pci-xgene.c |4 +++-
 drivers/pci/host/pcie-xilinx.c   |4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v1 0/3] PCI: Configure PCIe MPS settings

2017-02-08 Thread Bjorn Helgaas
The PCI core doesn't configure the PCIe MPS settings by itself.  Each host
bridge driver has to call pcie_bus_configure_settings() to make this
happen.

Jon fixed this for pcie-iproc.c.  I propose these similar patches for other
drivers.   

HV guys, I included you because create_root_hv_pci_bus() is one place that
calls pci_scan_child_bus() but does not call pcie_bus_configure_settings().
I know you probably don't strictly *need* to configure MPS settings in a
paravirtual front-end, but the PCI core does other device configuration in
this path:

  pci_scan_child_bus
pci_scan_slot
  pci_scan_single_device
pci_device_add
  pci_configure_device
  pci_init_capabilities

and I would like to eventually migrate the MPS configuration into that same
path.  Since we do this other configuration for HV devices already, I think
pcie_bus_configure_settings() should also work (even if it ends up not
doing anything to real devices).

It would make that eventual migration easier if all the
pci_scan_child_bus() callers had the same pattern of calling
pcie_bus_configure_settings().

So would it make sense to make a similar patch for HV?  It looks easy to
add it to create_root_hv_pci_bus(), but I don't know exactly what to do
about pci_devices_present_work().

---

Bjorn Helgaas (3):
  PCI: xilinx: Configure PCIe MPS settings
  PCI: versatile: Configure PCIe MPS settings
  PCI: xgene: Configure PCIe MPS settings


 drivers/pci/host/pci-versatile.c |4 +++-
 drivers/pci/host/pci-xgene.c |4 +++-
 drivers/pci/host/pcie-xilinx.c   |4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel