[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAErSpo5bYwgK618AOgvD=mgbfjcLLGE3CVw1SN3sP3PqRaCk5A@mail.gmail.com>
Date: Tue, 19 Nov 2013 15:24:22 -0700
From: Bjorn Helgaas <bhelgaas@...gle.com>
To: "ethan.zhao" <ethan.kernel@...il.com>
Cc: Yu Zhao <yu.zhao@...el.com>, Yinghai Lu <yinghai@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>
Subject: Re: [PATCH] PCI: Init NumVFs register to zero in sriov_init()
[+cc linux-pci]
On Wed, Nov 6, 2013 at 7:49 AM, ethan.zhao <ethan.kernel@...il.com> wrote:
> 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@...il.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))
I'm not 100% sure we should always disable SR-IOV when we enumerate a
PF, but as long as we do, it seems OK to me to clear NumVFs at the
same time.
We already clear NumVFs at other places where we disable SR-IOV
(sriov_enable() failure path and sriov_disable()).
Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists