Bug 112221

Summary: Cannot enable sriov on graphics adapter with PCIE type of PCI_EXP_TYPE_LEG_END
Product: Drivers Reporter: Kelly (kelly.zytaruk)
Component: PCIAssignee: drivers_pci (drivers_pci)
Status: NEW ---    
Severity: blocking CC: bjorn, kelly.zytaruk, szg00000
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: all Linux versions between 3.4.9 and 4.5.0-rc2 Subsystem:
Regression: No Bisected commit-id:
Attachments: This log shows the error returned when trying to enable sriov. A test module was used to make the call to enable sriov.
Patch that removes the PCIE_TYPE check from sriov_init()
dmesg log after applying the patch and enabling sriov.
lspci before enabling sriov
lspci after enabling sriov
lspci details

Description Kelly 2016-02-09 14:11:22 UTC
Created attachment 203181 [details]
This log shows the error returned when trying to enable sriov.  A test module was used to make the call to enable sriov.

sriov_init() in file iov.c fails with errcode -ENODEV when trying to initialize sriov on a pcie device with type PCI_EXP_TYPE_LEG_END.

Discussed the limitation with Bjorn Helgass and others in discussion http://lkml.kernel.org/r/CY1PR12MB026259439AA9689B7326F4B5FED20@CY1PR12MB0262.namprd12.prod.outlook.com
and initial discussions at 
http://lkml.kernel.org/r/B756807489D6244883AC0B799A6EEC15EAB2E8@storexdag02.amd.com


sriov_init() specifically checks for PCI_EXP_TYPE_RC_END and PCI_EXP_TYPE_ENDPOINT and rejects all other types.

After several discussions is was recommended by Bjorn to remove the check completely rather than just add the LEG_END type.
Comment 1 Kelly 2016-02-09 14:27:05 UTC
Created attachment 203191 [details]
Patch that removes the PCIE_TYPE check from sriov_init()

As per discussions, no reason for including the check for PCIE_TYPE could be determined, therefore instead of adding a new case to check for PCI_EXP_TYPE_LEG_END the check is removed completely.
Comment 2 Kelly 2016-02-09 14:29:53 UTC
Created attachment 203201 [details]
dmesg log after applying the patch and enabling sriov.

sriov is enabled by a test module.  Device at 1:0.0 is an sriov capable device. The test module enables sriov with 4 VFs and creates devices 2:0.0, 2:0.1, 2:0.1 and 2:0.3.
Comment 3 Kelly 2016-02-09 14:36:10 UTC
Created attachment 203211 [details]
lspci before enabling sriov

lspci shows only the PF device on the bus
Comment 4 Kelly 2016-02-09 14:37:39 UTC
Created attachment 203221 [details]
lspci after enabling sriov

lspci shows the VF devices on the bus after enabling sriov
Comment 5 Kelly 2016-02-09 14:40:15 UTC
Created attachment 203231 [details]
lspci details

lspci showing sriov config space and the sriov details of the PF