[+cc Arnd, powerpc folks]
On Wed, Sep 12, 2018 at 02:34:09PM +0200, Sebastian Ott wrote:
Hello Bjorn,
On s390 we currently handle SRIOV within firmware. Which means
that the PF is under firmware control and not visible to operating
systems. SRIOV enablement happens within firmware and VFs are
passed through to logical partitions.
I'm working on a new mode were the PF is under operating system
control (including SRIOV enablement). However we still need
firmware support to access the VFs. The way this is supposed
to work is that when firmware traps the SRIOV enablement it
will present machine checks to the logical partition that
triggered the SRIOV enablement and provide the VFs via hotplug
events.
The problem I'm faced with is that the VF detection code in
sriov_enable leads to unusable functions in s390.
We're moving away from the weak function implementation style. Can
you take a look at Arnd's work here, which uses pci_host_bridge
callbacks instead?
https://lkml.kernel.org/r/20180817102645.3839621-1-arnd@arndb.de
I cc'd some powerpc folks because they also have a fair amount of
arch-specific SR-IOV code that might one day move in this direction.
Sebastian Ott (2):
pci: provide pcibios_sriov_add_vfs
s390/pci: handle function enumeration after sriov enablement
arch/s390/pci/pci.c | 11 +++++++++++
drivers/pci/iov.c | 43 +++++++++++++++++++++++++++++++------------
include/linux/pci.h | 2 ++
3 files changed, 44 insertions(+), 12 deletions(-)
--
2.13.4
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2018-09-12 16:31:12
On Wed, 2018-09-12 at 08:02 -0500, Bjorn Helgaas wrote:
[+cc Arnd, powerpc folks]
[+Oliver]
On Wed, Sep 12, 2018 at 02:34:09PM +0200, Sebastian Ott wrote:
quoted
Hello Bjorn,
On s390 we currently handle SRIOV within firmware. Which means
that the PF is under firmware control and not visible to operating
systems. SRIOV enablement happens within firmware and VFs are
passed through to logical partitions.
I'm working on a new mode were the PF is under operating system
control (including SRIOV enablement). However we still need
firmware support to access the VFs. The way this is supposed
to work is that when firmware traps the SRIOV enablement it
will present machine checks to the logical partition that
triggered the SRIOV enablement and provide the VFs via hotplug
events.
The problem I'm faced with is that the VF detection code in
sriov_enable leads to unusable functions in s390.
We're moving away from the weak function implementation style. Can
you take a look at Arnd's work here, which uses pci_host_bridge
callbacks instead?
https://lkml.kernel.org/r/20180817102645.3839621-1-arnd@arndb.de
I cc'd some powerpc folks because they also have a fair amount of
arch-specific SR-IOV code that might one day move in this direction.
quoted
Sebastian Ott (2):
pci: provide pcibios_sriov_add_vfs
s390/pci: handle function enumeration after sriov enablement
arch/s390/pci/pci.c | 11 +++++++++++
drivers/pci/iov.c | 43 +++++++++++++++++++++++++++++++------------
include/linux/pci.h | 2 ++
3 files changed, 44 insertions(+), 12 deletions(-)
--
2.13.4
From: Sebastian Ott <hidden> Date: 2018-09-13 12:41:34
On Wed, 12 Sep 2018, Bjorn Helgaas wrote:
[+cc Arnd, powerpc folks]
On Wed, Sep 12, 2018 at 02:34:09PM +0200, Sebastian Ott wrote:
quoted
Hello Bjorn,
On s390 we currently handle SRIOV within firmware. Which means
that the PF is under firmware control and not visible to operating
systems. SRIOV enablement happens within firmware and VFs are
passed through to logical partitions.
I'm working on a new mode were the PF is under operating system
control (including SRIOV enablement). However we still need
firmware support to access the VFs. The way this is supposed
to work is that when firmware traps the SRIOV enablement it
will present machine checks to the logical partition that
triggered the SRIOV enablement and provide the VFs via hotplug
events.
The problem I'm faced with is that the VF detection code in
sriov_enable leads to unusable functions in s390.
We're moving away from the weak function implementation style. Can
you take a look at Arnd's work here, which uses pci_host_bridge
callbacks instead?
https://lkml.kernel.org/r/20180817102645.3839621-1-arnd@arndb.de
I cc'd some powerpc folks because they also have a fair amount of
arch-specific SR-IOV code that might one day move in this direction.
Rebased to Arnd's pci-probe-rework branch.
Sebastian Ott (2):
pci: provide add_vfs/del_vfs callbacks
s390/pci: handle function enumeration after sriov enablement
arch/s390/pci/pci.c | 11 +++++++++++
drivers/pci/iov.c | 51 +++++++++++++++++++++++++++++++++++++++------------
include/linux/pci.h | 2 ++
3 files changed, 52 insertions(+), 12 deletions(-)
--
2.13.4
From: Sebastian Ott <hidden> Date: 2018-09-13 12:41:36
Provide callbacks that can be used by PCI host bridge implementations
to override the behavior of the generic vf detection and device
creation code.
Signed-off-by: Sebastian Ott <redacted>
---
drivers/pci/iov.c | 51 +++++++++++++++++++++++++++++++++++++++------------
include/linux/pci.h | 2 ++
2 files changed, 41 insertions(+), 12 deletions(-)
From: Sebastian Ott <hidden> Date: 2018-09-13 12:41:36
Implement add_vfs|del_vfs callbacks as empty functions. VF
creation will be triggered by the hotplug code.
Signed-off-by: Sebastian Ott <redacted>
---
arch/s390/pci/pci.c | 11 +++++++++++
1 file changed, 11 insertions(+)
From: Sebastian Ott <hidden> Date: 2018-10-10 13:01:13
Hello Bjorn,
On Wed, 12 Sep 2018, Bjorn Helgaas wrote:
On Wed, Sep 12, 2018 at 02:34:09PM +0200, Sebastian Ott wrote:
quoted
On s390 we currently handle SRIOV within firmware. Which means
that the PF is under firmware control and not visible to operating
systems. SRIOV enablement happens within firmware and VFs are
passed through to logical partitions.
I'm working on a new mode were the PF is under operating system
control (including SRIOV enablement). However we still need
firmware support to access the VFs. The way this is supposed
to work is that when firmware traps the SRIOV enablement it
will present machine checks to the logical partition that
triggered the SRIOV enablement and provide the VFs via hotplug
events.
The problem I'm faced with is that the VF detection code in
sriov_enable leads to unusable functions in s390.
What's the status of Arnd's patches - will they go upstream in the next
couple of versions? What about my patches that I rebased on Arnd's branch
will they be considered?
Regards,
Sebastian
On Wed, Oct 10, 2018 at 02:55:07PM +0200, Sebastian Ott wrote:
Hello Bjorn,
On Wed, 12 Sep 2018, Bjorn Helgaas wrote:
quoted
On Wed, Sep 12, 2018 at 02:34:09PM +0200, Sebastian Ott wrote:
quoted
On s390 we currently handle SRIOV within firmware. Which means
that the PF is under firmware control and not visible to operating
systems. SRIOV enablement happens within firmware and VFs are
passed through to logical partitions.
I'm working on a new mode were the PF is under operating system
control (including SRIOV enablement). However we still need
firmware support to access the VFs. The way this is supposed
to work is that when firmware traps the SRIOV enablement it
will present machine checks to the logical partition that
triggered the SRIOV enablement and provide the VFs via hotplug
events.
The problem I'm faced with is that the VF detection code in
sriov_enable leads to unusable functions in s390.
From: Sebastian Ott <hidden> Date: 2018-12-05 13:47:38
Hello Bjorn,
On Wed, 10 Oct 2018, Bjorn Helgaas wrote:
On Wed, Oct 10, 2018 at 02:55:07PM +0200, Sebastian Ott wrote:
quoted
On Wed, 12 Sep 2018, Bjorn Helgaas wrote:
quoted
On Wed, Sep 12, 2018 at 02:34:09PM +0200, Sebastian Ott wrote:
quoted
On s390 we currently handle SRIOV within firmware. Which means
that the PF is under firmware control and not visible to operating
systems. SRIOV enablement happens within firmware and VFs are
passed through to logical partitions.
I'm working on a new mode were the PF is under operating system
control (including SRIOV enablement). However we still need
firmware support to access the VFs. The way this is supposed
to work is that when firmware traps the SRIOV enablement it
will present machine checks to the logical partition that
triggered the SRIOV enablement and provide the VFs via hotplug
events.
The problem I'm faced with is that the VF detection code in
sriov_enable leads to unusable functions in s390.
It appears like these patches are not in-line for the next merge window.
Would it be possible to go with my original patches (using __weak
functions)? (This would also make life easier with regards to backports)
I can post patches to convert this to use function pointers once Arnd's
patches make it to the kernel.
Regards,
Sebastian
On Wed, Dec 05, 2018 at 02:45:14PM +0100, Sebastian Ott wrote:
Hello Bjorn,
On Wed, 10 Oct 2018, Bjorn Helgaas wrote:
quoted
On Wed, Oct 10, 2018 at 02:55:07PM +0200, Sebastian Ott wrote:
quoted
On Wed, 12 Sep 2018, Bjorn Helgaas wrote:
quoted
On Wed, Sep 12, 2018 at 02:34:09PM +0200, Sebastian Ott wrote:
quoted
On s390 we currently handle SRIOV within firmware. Which means
that the PF is under firmware control and not visible to operating
systems. SRIOV enablement happens within firmware and VFs are
passed through to logical partitions.
I'm working on a new mode were the PF is under operating system
control (including SRIOV enablement). However we still need
firmware support to access the VFs. The way this is supposed
to work is that when firmware traps the SRIOV enablement it
will present machine checks to the logical partition that
triggered the SRIOV enablement and provide the VFs via hotplug
events.
The problem I'm faced with is that the VF detection code in
sriov_enable leads to unusable functions in s390.
It appears like these patches are not in-line for the next merge window.
Would it be possible to go with my original patches (using __weak
functions)? (This would also make life easier with regards to backports)
I can post patches to convert this to use function pointers once Arnd's
patches make it to the kernel.
Yeah, sorry, I think we should just go with your original approach.
Can you repost those patches with minor changelog updates so
"git log --online" on the files looks consistent. Also, capitalize
"PCI", "VF", etc, consistently when used in English text.
Bjorn
From: Sebastian Ott <hidden> Date: 2018-12-13 17:56:40
Move VF detection and device creation code to weak functions
such that architectures can provide a different implementation.
Signed-off-by: Sebastian Ott <redacted>
---
drivers/pci/iov.c | 43 +++++++++++++++++++++++++++++++------------
include/linux/pci.h | 2 ++
2 files changed, 33 insertions(+), 12 deletions(-)
From: Sebastian Ott <hidden> Date: 2018-12-13 17:58:54
Implement pcibios_sriov_{add|del}_vfs as empty functions. VF
creation will be triggered by the hotplug code.
Signed-off-by: Sebastian Ott <redacted>
---
arch/s390/pci/pci.c | 11 +++++++++++
1 file changed, 11 insertions(+)
From: Christoph Hellwig <hch@infradead.org> Date: 2018-12-14 13:21:07
On Fri, Dec 14, 2018 at 05:12:45AM -0800, Christoph Hellwig wrote:
On Thu, Dec 13, 2018 at 06:54:28PM +0100, Sebastian Ott wrote:
quoted
Implement pcibios_sriov_{add|del}_vfs as empty functions. VF
creation will be triggered by the hotplug code.
And instead of having the arch suplply a no-op arch override I
think it would be better to have the config option just stub it
out in common code.
Or in fact maybe even a runtime flag in struct pci_dev. Who knows
if all future s390 PCIe busses will have exactly the same behavior
or if we eventually get the standards compliant behvior back?
From: Sebastian Ott <hidden> Date: 2018-12-17 17:32:39
On Fri, 14 Dec 2018, Christoph Hellwig wrote:
On Fri, Dec 14, 2018 at 05:12:45AM -0800, Christoph Hellwig wrote:
quoted
On Thu, Dec 13, 2018 at 06:54:28PM +0100, Sebastian Ott wrote:
quoted
Implement pcibios_sriov_{add|del}_vfs as empty functions. VF
creation will be triggered by the hotplug code.
And instead of having the arch suplply a no-op arch override I
think it would be better to have the config option just stub it
out in common code.
Or in fact maybe even a runtime flag in struct pci_dev. Who knows
if all future s390 PCIe busses will have exactly the same behavior
or if we eventually get the standards compliant behvior back?
No, I literally meant a flag to skip the work. Think about it: there
is a standard way to probe VFs, which comes from what is defined in the
PCIe spec itself. It just turns out s390 for some weird reason decides
to already let the VFs show up basically like PFs. There really should
be no reason to branch out into per-arch code here as there really
isn't much to do on a per-arch level. More just a quirk for the
firmware is buggy and already reports the VFs to us, so skip the
probing.
From: Sebastian Ott <hidden> Date: 2018-12-18 10:23:13
Provide a flag to skip scanning for new VFs after SRIOV enablement.
This can be set by implementations for which the VFs are already
reported by other means.
Signed-off-by: Sebastian Ott <redacted>
---
drivers/pci/iov.c | 48 ++++++++++++++++++++++++++++++++++++------------
include/linux/pci.h | 1 +
2 files changed, 37 insertions(+), 12 deletions(-)
@@ -405,6 +405,7 @@ struct pci_dev {unsignedintnon_compliant_bars:1;/* Broken BARs; ignore them */unsignedintis_probed:1;/* Device probing in progress */unsignedintlink_active_reporting:1;/* Device capable of reporting link active */+unsignedintno_vf_scan:1;/* Don't scan for VF's after VF enablement */pci_dev_flags_tdev_flags;atomic_tenable_cnt;/* pci_enable_device has been called */
From: Sebastian Ott <hidden> Date: 2018-12-18 10:25:09
Set the flag to skip scanning for VFs after SRIOV enablement.
VF creation will be triggered by the hotplug code.
Signed-off-by: Sebastian Ott <redacted>
---
arch/s390/pci/pci.c | 3 +++
1 file changed, 3 insertions(+)
From: Christoph Hellwig <hch@infradead.org> Date: 2018-12-19 07:55:23
On Tue, Dec 18, 2018 at 11:16:49AM +0100, Sebastian Ott wrote:
Provide a flag to skip scanning for new VFs after SRIOV enablement.
This can be set by implementations for which the VFs are already
reported by other means.
Signed-off-by: Sebastian Ott <redacted>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
From: Christoph Hellwig <hch@infradead.org> Date: 2018-12-19 07:58:02
On Tue, Dec 18, 2018 at 11:16:50AM +0100, Sebastian Ott wrote:
Set the flag to skip scanning for VFs after SRIOV enablement.
VF creation will be triggered by the hotplug code.
Signed-off-by: Sebastian Ott <redacted>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
Hi Sebastian,
On Tue, Dec 18, 2018 at 11:16:49AM +0100, Sebastian Ott wrote:
quoted hunk
Provide a flag to skip scanning for new VFs after SRIOV enablement.
This can be set by implementations for which the VFs are already
reported by other means.
Signed-off-by: Sebastian Ott <redacted>
---
drivers/pci/iov.c | 48 ++++++++++++++++++++++++++++++++++++------------
include/linux/pci.h | 1 +
2 files changed, 37 insertions(+), 12 deletions(-)
@@ -252,6 +252,27 @@ int __weak pcibios_sriov_disable(struct pci_dev *pdev)return0;}+staticintsriov_add_vfs(structpci_dev*dev,u16num_vfs)+{+unsignedinti;+intrc;++if(dev->no_vf_scan)+return0;++for(i=0;i<num_vfs;i++){+rc=pci_iov_add_virtfn(dev,i);+if(rc)+gotofailed;+}+return0;+failed:+while(i--)+pci_iov_remove_virtfn(dev,i);++returnrc;+}
I think the strategy is fine, but can you restructure the patches
like this:
1) Factor out sriov_add_vfs() and sriov_dev_vfs(). This makes no
functional change at all.
2) Add dev->no_vf_scan, set it in the s390 pcibios_add_device(), and
test it in sriov_add_vfs(), and sriov_del_vfs().
I think both pieces will be easier to review that way.
quoted hunk
static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
{
int rc;
@@ -337,21 +358,15 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) msleep(100); pci_cfg_access_unlock(dev);- for (i = 0; i < initial; i++) {- rc = pci_iov_add_virtfn(dev, i);- if (rc)- goto failed;- }+ rc = sriov_add_vfs(dev, initial);+ if (rc)+ goto err_pcibios; kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE); iov->num_VFs = nr_virtfn; return 0;-failed:- while (i--)- pci_iov_remove_virtfn(dev, i);- err_pcibios: iov->ctrl &= ~(PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE); pci_cfg_access_lock(dev);
@@ -368,17 +383,26 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) return rc; }-static void sriov_disable(struct pci_dev *dev)+static void sriov_del_vfs(struct pci_dev *dev) {- int i; struct pci_sriov *iov = dev->sriov;+ int i;- if (!iov->num_VFs)+ if (dev->no_vf_scan) return; for (i = 0; i < iov->num_VFs; i++) pci_iov_remove_virtfn(dev, i);+}++static void sriov_disable(struct pci_dev *dev)+{+ struct pci_sriov *iov = dev->sriov;++ if (!iov->num_VFs)+ return;+ sriov_del_vfs(dev); iov->ctrl &= ~(PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE); pci_cfg_access_lock(dev); pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl);
@@ -405,6 +405,7 @@ struct pci_dev {unsignedintnon_compliant_bars:1;/* Broken BARs; ignore them */unsignedintis_probed:1;/* Device probing in progress */unsignedintlink_active_reporting:1;/* Device capable of reporting link active */+unsignedintno_vf_scan:1;/* Don't scan for VF's after VF enablement */pci_dev_flags_tdev_flags;atomic_tenable_cnt;/* pci_enable_device has been called */
From: Sebastian Ott <hidden> Date: 2018-12-21 14:16:46
Provide sriov_add_vfs as a wrapper to scan for VFs that cleans up
after itself. This is just a code simplification. No functional change.
Signed-off-by: Sebastian Ott <redacted>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
drivers/pci/iov.c | 44 +++++++++++++++++++++++++++++++-------------
1 file changed, 31 insertions(+), 13 deletions(-)
From: Sebastian Ott <hidden> Date: 2018-12-21 14:18:46
Provide a flag to skip scanning for new VFs after SRIOV enablement.
This can be set by implementations for which the VFs are already
reported by other means.
Signed-off-by: Sebastian Ott <redacted>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
drivers/pci/iov.c | 6 ++++++
include/linux/pci.h | 1 +
2 files changed, 7 insertions(+)
@@ -405,6 +405,7 @@ struct pci_dev {unsignedintnon_compliant_bars:1;/* Broken BARs; ignore them */unsignedintis_probed:1;/* Device probing in progress */unsignedintlink_active_reporting:1;/* Device capable of reporting link active */+unsignedintno_vf_scan:1;/* Don't scan for VFs after IOV enablement */pci_dev_flags_tdev_flags;atomic_tenable_cnt;/* pci_enable_device has been called */
From: Sebastian Ott <hidden> Date: 2018-12-21 14:20:48
Set the flag to skip scanning for VFs after SRIOV enablement.
VF creation will be triggered by the hotplug code.
Signed-off-by: Sebastian Ott <redacted>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
arch/s390/pci/pci.c | 3 +++
1 file changed, 3 insertions(+)
From: Sebastian Ott <hidden> Date: 2018-12-21 14:22:47
Hello Bjorn,
On Thu, 20 Dec 2018, Bjorn Helgaas wrote:
I think the strategy is fine, but can you restructure the patches
like this:
1) Factor out sriov_add_vfs() and sriov_dev_vfs(). This makes no
functional change at all.
2) Add dev->no_vf_scan, set it in the s390 pcibios_add_device(), and
test it in sriov_add_vfs(), and sriov_del_vfs().
I think both pieces will be easier to review that way.
Done. I took the liberty to add Christoph's R-b to the first two patches
since it's just a split of the patch he gave the R-b to.
Thanks!
Sebastian
On Fri, Dec 21, 2018 at 03:19:49PM +0100, Sebastian Ott wrote:
Hello Bjorn,
On Thu, 20 Dec 2018, Bjorn Helgaas wrote:
quoted
I think the strategy is fine, but can you restructure the patches
like this:
1) Factor out sriov_add_vfs() and sriov_dev_vfs(). This makes no
functional change at all.
2) Add dev->no_vf_scan, set it in the s390 pcibios_add_device(), and
test it in sriov_add_vfs(), and sriov_del_vfs().
I think both pieces will be easier to review that way.
Done. I took the liberty to add Christoph's R-b to the first two patches
since it's just a split of the patch he gave the R-b to.
Thanks.
It's really way too late to do this, but they're pretty trivial, and
I've been out longer than expected for vacation and illness, so I applied
these to pci/virtualization for v4.21.
Bjorn