diff mbox series

[disco:linux-azure] PCI: hv: Use bytes 4 and 5 from instance ID as the PCI domain numbers

Message ID 20191016202831.7258-3-marcelo.cerri@canonical.com
State New
Headers show
Series [disco:linux-azure] PCI: hv: Use bytes 4 and 5 from instance ID as the PCI domain numbers | expand

Commit Message

Marcelo Henrique Cerri Oct. 16, 2019, 8:28 p.m. UTC
From: Haiyang Zhang <haiyangz@microsoft.com>

BugLink: https://bugs.launchpad.net/bugs/1847139

As recommended by Azure host team, the bytes 4, 5 have more uniqueness
(info entropy) than bytes 8, 9 so use them as the PCI domain numbers.

On older hosts, bytes 4, 5 can also be used -- no backward compatibility
issues are introduced and the chance of collision is greatly reduced.

In the rare cases of collision, the driver code detects and finds
another number that is not in use.

Suggested-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit f73f8a504e27959576a2f4d85182202561e426f2)
[marcelo.cerri@canonical.com: adjustments due to the context difference]
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
---
 drivers/pci/controller/pci-hyperv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index 3bd94149b9d2..36b3c85f6574 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -2559,8 +2559,8 @@  static int hv_pci_probe(struct hv_device *hdev,
 	 * between domains derived from these instance IDs in the same
 	 * VM.
 	 */
-	hbus->sysdata.domain = hdev->dev_instance.b[9] |
-			       hdev->dev_instance.b[8] << 8;
+	hbus->sysdata.domain = hdev->dev_instance.b[4] |
+			       hdev->dev_instance.b[5] << 8;
 
 	hbus->hdev = hdev;
 	refcount_set(&hbus->remove_lock, 1);