From: "ethan.zhao" <ethan.kernel@gmail.com>
To: yu.zhao@intel.com, bhelgaas@google.com
Cc: yinghai@kernel.org, linux-kernel@vger.kernel.org,
"ethan.zhao" <ethan.kernel@gmail.com>
Subject: [PATCH] PCI: Init NumVFs register to zero in sriov_init()
Date: Wed, 6 Nov 2013 22:49:13 +0800 [thread overview]
Message-ID: <1383749353-3510-1-git-send-email-ethan.kernel@gmail.com> (raw)
Though no specification about NumVFs register initial value after POST, to void the confusion
lspci output as following before VF was enabled, we should clear the NumVFs value left by BIOS
to zero:
$lspci -vvv -s 03:00.0
Ethernet controller: Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection (rev 01)
~
Capabilities: [160 v1] Single Root I/O Virtualization (SR-IOV)
IOVCap: Migration-, Interrupt Message Number: 000
IOVCtl: Enable+ Migration- Interrupt- MSE+ ARIHierarchy+
IOVSta: Migration-
Initial VFs: 64, Total VFs: 64, Number of VFs: 64, Function Dependency Link: 00
^dazed !
~
Signed-off-by: ethan.zhao <ethan.kernel@gmail.com>
---
drivers/pci/iov.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index de8ffac..a4941ad 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -439,6 +439,8 @@ static int sriov_init(struct pci_dev *dev, int pos)
found:
pci_write_config_word(dev, pos + PCI_SRIOV_CTRL, ctrl);
+ /* VF Enable is cleared, so we could init the NumVFs register to 0 */
+ pci_write_config_word(dev, pos + PCI_SRIOV_NUM_VF, 0);
pci_read_config_word(dev, pos + PCI_SRIOV_VF_OFFSET, &offset);
pci_read_config_word(dev, pos + PCI_SRIOV_VF_STRIDE, &stride);
if (!offset || (total > 1 && !stride))
--
1.8.3.4 (Apple Git-47)
next reply other threads:[~2013-11-06 14:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-06 14:49 ethan.zhao [this message]
2013-11-14 1:57 ` [PATCH] PCI: Init NumVFs register to zero in sriov_init() Ethan Zhao
2013-11-15 6:59 ` Yinghai Lu
2013-11-16 2:09 ` Ethan Zhao
2013-11-19 22:24 ` Bjorn Helgaas
2013-11-20 0:07 ` Bjorn Helgaas
2013-11-20 9:48 ` Ethan Zhao
2013-11-21 2:01 ` Ethan Zhao
2013-11-22 22:20 ` 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=1383749353-3510-1-git-send-email-ethan.kernel@gmail.com \
--to=ethan.kernel@gmail.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=yinghai@kernel.org \
--cc=yu.zhao@intel.com \
/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