linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Gavin Shan <gwshan@linux.vnet.ibm.com>
To: Gavin Shan <gwshan@linux.vnet.ibm.com>
Cc: linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	bhelgaas@google.com, benh@au1.ibm.com, benh@kernel.crashing.org,
	mpe@ellerman.id.au, clsoto@us.ibm.com
Subject: Re: [PATCH v2 1/2] pci: Call pcibios_sriov_enable() before IOV BARs are enabled
Date: Tue, 11 Oct 2016 16:33:53 +1100	[thread overview]
Message-ID: <20161011053353.GA5123@gwshan> (raw)
In-Reply-To: <1475192870-7763-1-git-send-email-gwshan@linux.vnet.ibm.com>

On Fri, Sep 30, 2016 at 09:47:49AM +1000, Gavin Shan wrote:
>In current implementation, pcibios_sriov_enable() is used by PPC
>PowerNV platform only. In PowerNV specific pcibios_sriov_enable(),
>PF's IOV BARs might be updated (shifted) by pci_update_resource().
>It means the IOV BARs aren't ready for decoding incoming memory
>address until pcibios_sriov_enable() returns.
>
>This calls pcibios_sriov_enable() earlier before the IOV BARs are
>enabled. As the result, the IOV BARs have been configured correctly
>when they are enabled.
>
>Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
>Tested-by: Carol Soto <clsoto@us.ibm.com>

Bjorn, is there any chance to put those two patches to 4.9? :)

Thanks,
Gavin

>---
> drivers/pci/iov.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
>diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
>index 2194b44..f1343f0 100644
>--- a/drivers/pci/iov.c
>+++ b/drivers/pci/iov.c
>@@ -303,13 +303,6 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
> 			return rc;
> 	}
>
>-	pci_iov_set_numvfs(dev, nr_virtfn);
>-	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);
>-	msleep(100);
>-	pci_cfg_access_unlock(dev);
>-
> 	iov->initial_VFs = initial;
> 	if (nr_virtfn < initial)
> 		initial = nr_virtfn;
>@@ -320,6 +313,13 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
> 		goto err_pcibios;
> 	}
>
>+	pci_iov_set_numvfs(dev, nr_virtfn);
>+	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);
>+	msleep(100);
>+	pci_cfg_access_unlock(dev);
>+
> 	for (i = 0; i < initial; i++) {
> 		rc = pci_iov_add_virtfn(dev, i, 0);
> 		if (rc)
>-- 
>2.1.0
>

  parent reply	other threads:[~2016-10-11  5:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-29 23:47 [PATCH v2 1/2] pci: Call pcibios_sriov_enable() before IOV BARs are enabled Gavin Shan
2016-09-29 23:47 ` [PATCH v2 2/2] PCI: Don't disable PF's memory decoding when enabling SRIOV Gavin Shan
2016-10-21 16:50   ` Bjorn Helgaas
2016-10-23 23:28     ` Gavin Shan
2016-10-24 14:03       ` Bjorn Helgaas
2016-10-25  1:47         ` Gavin Shan
2016-10-25  3:51           ` Bjorn Helgaas
2016-10-26  1:02             ` Gavin Shan
2016-10-11  5:33 ` Gavin Shan [this message]
2016-10-21 20:23 ` [PATCH v2 1/2] pci: Call pcibios_sriov_enable() before IOV BARs are enabled 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=20161011053353.GA5123@gwshan \
    --to=gwshan@linux.vnet.ibm.com \
    --cc=benh@au1.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=clsoto@us.ibm.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).