sriov capability enumeration returns false.

From: alan hopes
Date: Thu Jun 02 2016 - 02:59:30 EST


Hi,

I am working on a simple graphics driver that just enumerates SRIOV
capability of PCI graphics controller.
During the init phase of the driver i.e. when the driver loads, I find
the PCI device based on my vendor ID and device ID, and then I check
if pDev->sriov and and I get the value false even though I can see the
SRIOV capability set using lspci.

Code for checking SRIOV capability:
pdev = get device based on device ID and vendor ID.
if (pDev->sriov)
return false.

Output of lspci correctly reporting SRIOV capability at offset 0x330.

"
Capabilities: [330 v1] Single Root I/O Virtualization (SR-IOV)
IOVCap: Migration-, Interrupt Message Number: 000
IOVCtl: Enable- Migration- Interrupt- MSE- ARIHierarchy+
IOVSta: Migration-
Initial VFs: 16, Total VFs: 16, Number of VFs: 0,
Function Dependency Link: 00
VF offset: 256, stride: 1, Device ID: xxxx
Supported Page Size: 00000553, System Page Size: 00000001
Region 0: Memory at 0000021ee0000000 (64-bit, prefetchable)
Region 2: Memory at 0000021ff0000000 (64-bit, prefetchable)
Region 5: Memory at 98c00000 (32-bit, non-prefetchable)
VF Migration: offset: 00000000, BIR: 0
"

I can see, using lspci, that card has been setup properly with SRIOV
enabled. But then why my driver is not able to see this value. I think
I am missing something, Please can you suggest what I am doing wrong
here..

Thanks
Alan