aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vfio/pci/vfio_pci_config.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/vfio/pci/vfio_pci_config.c')
-rw-r--r--drivers/vfio/pci/vfio_pci_config.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
index 83cd1574c810..e50790e91f76 100644
--- a/drivers/vfio/pci/vfio_pci_config.c
+++ b/drivers/vfio/pci/vfio_pci_config.c
@@ -1126,8 +1126,7 @@ static int vfio_ext_cap_len(struct vfio_pci_device *vdev, u16 ecap, u16 epos)
1126 return pcibios_err_to_errno(ret); 1126 return pcibios_err_to_errno(ret);
1127 1127
1128 byte &= PCI_DPA_CAP_SUBSTATE_MASK; 1128 byte &= PCI_DPA_CAP_SUBSTATE_MASK;
1129 byte = round_up(byte + 1, 4); 1129 return PCI_DPA_BASE_SIZEOF + byte + 1;
1130 return PCI_DPA_BASE_SIZEOF + byte;
1131 case PCI_EXT_CAP_ID_TPH: 1130 case PCI_EXT_CAP_ID_TPH:
1132 ret = pci_read_config_dword(pdev, epos + PCI_TPH_CAP, &dword); 1131 ret = pci_read_config_dword(pdev, epos + PCI_TPH_CAP, &dword);
1133 if (ret) 1132 if (ret)
@@ -1136,9 +1135,9 @@ static int vfio_ext_cap_len(struct vfio_pci_device *vdev, u16 ecap, u16 epos)
1136 if ((dword & PCI_TPH_CAP_LOC_MASK) == PCI_TPH_LOC_CAP) { 1135 if ((dword & PCI_TPH_CAP_LOC_MASK) == PCI_TPH_LOC_CAP) {
1137 int sts; 1136 int sts;
1138 1137
1139 sts = byte & PCI_TPH_CAP_ST_MASK; 1138 sts = dword & PCI_TPH_CAP_ST_MASK;
1140 sts >>= PCI_TPH_CAP_ST_SHIFT; 1139 sts >>= PCI_TPH_CAP_ST_SHIFT;
1141 return PCI_TPH_BASE_SIZEOF + round_up(sts * 2, 4); 1140 return PCI_TPH_BASE_SIZEOF + (sts * 2) + 2;
1142 } 1141 }
1143 return PCI_TPH_BASE_SIZEOF; 1142 return PCI_TPH_BASE_SIZEOF;
1144 default: 1143 default: