Commit aa2cba51 authored by Yijing Wang's avatar Yijing Wang Committed by Alex Williamson

PCI/VFIO: use pcie_flags_reg instead of access PCI-E Capabilities Register

Currently, we use pcie_flags_reg to cache PCI-E Capabilities Register,
because PCI-E Capabilities Register bits are almost read-only. This patch
use pcie_caps_reg() instead of another access PCI-E Capabilities Register.
Signed-off-by: default avatarYijing Wang <wangyijing@huawei.com>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent a7d1ea1c
...@@ -1037,13 +1037,9 @@ static int vfio_cap_len(struct vfio_pci_device *vdev, u8 cap, u8 pos) ...@@ -1037,13 +1037,9 @@ static int vfio_cap_len(struct vfio_pci_device *vdev, u8 cap, u8 pos)
return byte; return byte;
case PCI_CAP_ID_EXP: case PCI_CAP_ID_EXP:
/* length based on version */ /* length based on version */
ret = pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, &word);
if (ret)
return pcibios_err_to_errno(ret);
vdev->extended_caps = true; vdev->extended_caps = true;
if ((word & PCI_EXP_FLAGS_VERS) == 1) if ((pcie_caps_reg(pdev) & PCI_EXP_FLAGS_VERS) == 1)
return PCI_CAP_EXP_ENDPOINT_SIZEOF_V1; return PCI_CAP_EXP_ENDPOINT_SIZEOF_V1;
else else
return PCI_CAP_EXP_ENDPOINT_SIZEOF_V2; return PCI_CAP_EXP_ENDPOINT_SIZEOF_V2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment