Modifies the physical address offset parser to use the device-specific features member. No functional changes. Signed-off-by: Jon Derrick <jonathan.derrick@xxxxxxxxx> --- drivers/pci/controller/vmd.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c index b0504ee..71aa002 100644 --- a/drivers/pci/controller/vmd.c +++ b/drivers/pci/controller/vmd.c @@ -493,14 +493,14 @@ static void vmd_phys_to_offset(struct vmd_dev *vmd, u64 phys1, u64 phys2, (phys2 & PCI_BASE_ADDRESS_MEM_MASK); } -static int vmd_get_phys_offsets(struct vmd_dev *vmd, bool native_hint, +static int vmd_get_phys_offsets(struct vmd_dev *vmd, unsigned long features, resource_size_t *offset1, resource_size_t *offset2) { struct pci_dev *dev = vmd->dev; u64 phys1, phys2; - if (native_hint) { + if (features & VMD_FEAT_HAS_MEMBAR_SHADOW) { u32 vmlock; int ret; @@ -519,7 +519,7 @@ static int vmd_get_phys_offsets(struct vmd_dev *vmd, bool native_hint, pci_iounmap(dev, membar2); vmd_phys_to_offset(vmd, phys1, phys2, offset1, offset2); } - } else { + } else if (features & VMD_FEAT_HAS_MEMBAR_SHADOW_VSCAP) { /* Hypervisor-Emulated Vendor-Specific Capability */ int pos = pci_find_capability(dev, PCI_CAP_ID_VNDR); u32 reg, regu; @@ -638,16 +638,12 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) * and child devices. These registers will either return the host value * or 0, depending on an enable bit in the VMD device. */ - if (features & VMD_FEAT_HAS_MEMBAR_SHADOW) { + if (features & VMD_FEAT_HAS_MEMBAR_SHADOW) membar2_offset = MB2_SHADOW_OFFSET + MB2_SHADOW_SIZE; - ret = vmd_get_phys_offsets(vmd, true, &offset[0], &offset[1]); - if (ret) - return ret; - } else if (features & VMD_FEAT_HAS_MEMBAR_SHADOW_VSCAP) { - ret = vmd_get_phys_offsets(vmd, false, &offset[0], &offset[1]); - if (ret) - return ret; - } + + ret = vmd_get_phys_offsets(vmd, features, &offset[0], &offset[1]); + if (ret) + return ret; /* * Certain VMD devices may have a root port configuration option which -- 1.8.3.1