Dom0 PCI: fix SR-IOV function dependency link problem
PATCH 1/1 Dom0 PCI: fix SR-IOV function dependency link problem
PCIe Root Complex Integrated Endpoint does not implement ARI, so this kind of endpoint uses 3-bit function number. The function dependency link of the integrated endpoint should be calculated using the device number field in conjunction with the value from function dependency link register.
Normal SR-IOV endpoint always implements ARI and the function dependency link register contains 8-bit function number (i.e. `devfn' from software perspective).
# HG changeset patch
# User Yu Zhao <[email protected]>
# Date 1244007161 -28800
# Node ID 3a959a6975152b741389d2eed1823d55be4f2889 # Parent ec3442c2ed48eb11fcacd3fe31af48932f0a6645
PCI: fix SR-IOV function dependency link problem
PCIe Root Complex Integrated Endpoint does not implement ARI, so this kind of endpoint uses 3-bit function number. The function dependency link of the integrated endpoint should be calculated using the device number field in conjunction with the value from function dependency link register.
Normal SR-IOV endpoint always implements ARI and the function dependency link register contains 8-bit function number (i.e. `devfn' from software perspective).
drivers/pci/iov.c +2 -0
@@ -366,6 +366,8 @@ iov->self = dev;pci_read_config_dword (dev, pos +PCI_SRIOV_CAP , &iov->cap);pci_read_config_byte (dev, pos +PCI_SRIOV_FUNC_LINK , &iov->link); +if (!dev->bus->number)/* Root Complex Integrated Endpoint */ + iov->link =PCI_DEVFN (PCI_SLOT (dev->devfn), iov->link);if (pdev) iov->dev =pci_dev_get (pdev);
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 35 lines · Yu Zhao
PCIe Root Complex Integrated Endpoint does not implement ARI, so this kind of endpoint uses 3-bit function number. The function dependency link of the integrated endpoint should be calculated using the device number field in conjunction with the value from function dependency link register.
Normal SR-IOV endpoint always implements ARI and the function dependency link register contains 8-bit function number (i.e. `devfn' from software perspective).
Signed-off-by Yu Zhao <[email protected]># HG changeset patch
# User Yu Zhao <[email protected]>
# Date 1244007161 -28800
# Node ID3a959a6975152b741389d2eed1823d55be4f2889# Parentec3442c2ed48eb11fcacd3fe31af48932f0a6645
PCI: fix SR-IOV function dependency link problemPCIe Root Complex Integrated Endpoint does not implement ARI, so this kind of endpoint uses 3-bit function number. The function dependency link of the integrated endpoint should be calculated using the device number field in conjunction with the value from function dependency link register.
Normal SR-IOV endpoint always implements ARI and the function dependency link register contains 8-bit function number (i.e. `devfn' from software perspective).
Signed-off-by Yu Zhao <[email protected]>diff -r
ec3442c2ed48-r3a959a697515drivers/pci/iov.c
drivers/pci/iov.c line 373
Quoted 8 lines
drivers/pci/iov.c +2
-0@@ -366,6 +366,8 @@ iov->self = dev;pci_read_config_dword (dev, pos +PCI_SRIOV_CAP , &iov->cap);pci_read_config_byte (dev, pos +PCI_SRIOV_FUNC_LINK , &iov->link); +if (!dev->bus->number)/* Root Complex Integrated Endpoint */ + iov->link =PCI_DEVFN (PCI_SLOT (dev->devfn), iov->link);if (pdev) iov->dev =pci_dev_get (pdev);
Possibly the above check may work.
But pci capability list should be examined. something like
rpcap = pci_find_capability(pdev, PCI_CAP_ID_EXP); if (!rpcap)
pci_read_config_word(pdev, rpcap + PCI_CAP_FLAGS, &cap); if (cap == PCI_EXP_TYPE_RC_END)
...
thanks,
Signature · 1 line
yamahata
Quoted 50 lines · Isaku Yamahata
Quoted 35 lines · Yu Zhao
PCIe Root Complex Integrated Endpoint does not implement ARI, so this kind of endpoint uses 3-bit function number. The function dependency link of the integrated endpoint should be calculated using the device number field in conjunction with the value from function dependency link register.
Normal SR-IOV endpoint always implements ARI and the function dependency link register contains 8-bit function number (i.e. `devfn' from software perspective).
Signed-off-by Yu Zhao <[email protected]># HG changeset patch
# User Yu Zhao <[email protected]>
# Date 1244007161 -28800
# Node ID3a959a6975152b741389d2eed1823d55be4f2889# Parentec3442c2ed48eb11fcacd3fe31af48932f0a6645
PCI: fix SR-IOV function dependency link problemPCIe Root Complex Integrated Endpoint does not implement ARI, so this kind of endpoint uses 3-bit function number. The function dependency link of the integrated endpoint should be calculated using the device number field in conjunction with the value from function dependency link register.
Normal SR-IOV endpoint always implements ARI and the function dependency link register contains 8-bit function number (i.e. `devfn' from software perspective).
Signed-off-by Yu Zhao <[email protected]>diff -r
ec3442c2ed48-r3a959a697515drivers/pci/iov.cdrivers/pci/iov.c line 373
Quoted 8 lines
drivers/pci/iov.c +2
-0@@ -366,6 +366,8 @@ iov->self = dev;pci_read_config_dword (dev, pos +PCI_SRIOV_CAP , &iov->cap);pci_read_config_byte (dev, pos +PCI_SRIOV_FUNC_LINK , &iov->link); +if (!dev->bus->number)/* Root Complex Integrated Endpoint */ + iov->link =PCI_DEVFN (PCI_SLOT (dev->devfn), iov->link);if (pdev) iov->dev =pci_dev_get (pdev);Possibly the above check may work.
But pci capability list should be examined. something like
rpcap =pci_find_capability(pdev, PCI_CAP_ID_EXP); if (!rpcap)
Quoted 2 lines
pci_read_config_word(pdev, rpcap + PCI_CAP_FLAGS, &cap); if (cap == PCI_EXP_TYPE_RC_END)
It will works well since the capability check is already done before doing anything else:
int pci_iov_init(struct pci_dev *dev)
{
int pos;
pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_SRIOV);
if (pos)
return sriov_init(dev, pos);
return -ENODEV;
}Thanks,
Yu