From: Bjorn Helgaas <bhelgaas@google.com>
To: Ethan Zhao <ethan.zhao@oracle.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iov: initialize NumVFs register to 0 at the end of sriov_init()
Date: Tue, 15 Sep 2015 11:10:16 -0500 [thread overview]
Message-ID: <20150915161016.GB27964@google.com> (raw)
In-Reply-To: <1440150685-6690-1-git-send-email-ethan.zhao@oracle.com>
On Fri, Aug 21, 2015 at 06:51:25PM +0900, Ethan Zhao wrote:
> After commit 4449f079722c ("PCI: Calculate maximum number of buses
> required for VFs"),the initial value of NumVFs register was set to
> non-zero after sriov_init() and no VFs was enabled in device driver.
> this changed the behaviour of kernel exported by lspci and sysfs etc.
> so this patch initialize the NumVFs register to zero after the
> calculation of max_VF_buses was done.
>
> Tested on stable 4.1 and passed building on stable 4.2-rc7
>
> Signed-off-by: Ethan Zhao <ethan.zhao@oracle.com>
> Tested-by: Sriharsha Yadagudde <sriharsha.devdas@oracle.com>
> ---
> drivers/pci/iov.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
> index ee0ebff..6969084 100644
> --- a/drivers/pci/iov.c
> +++ b/drivers/pci/iov.c
> @@ -476,6 +476,7 @@ found:
> dev->is_physfn = 1;
> iov->max_VF_buses = virtfn_max_buses(dev);
>
> + pci_iov_set_numvfs(dev, 0);
I think it would be better to put this in virtfn_max_buses(), where we
clobbered numVFs in the first place. I'd also read the original value and
restore it, e.g.,
pci_read_config_word(dev, iov->pos + PCI_SRIOV_NUM_VF, &numvfs);
for (nr_virtfn = 1; nr_virtfn <= iov->total_VFs; nr_virtfn++) {
...
}
pci_iov_set_numvfs(dev, numvfs);
return max;
I know sriov_init() sets numVFs to zero before it calls virtfn_max_buses(),
but why rely on that extra knowledge?
> return 0;
>
> failed:
> --
> 1.8.3.1
>
next prev parent reply other threads:[~2015-09-15 16:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-21 9:51 [PATCH] iov: initialize NumVFs register to 0 at the end of sriov_init() Ethan Zhao
2015-09-15 16:10 ` Bjorn Helgaas [this message]
2015-09-16 1:01 ` ethan zhao
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=20150915161016.GB27964@google.com \
--to=bhelgaas@google.com \
--cc=ethan.zhao@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.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 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).