From a3f1e5e331f689a5061cb7bacfad456481050c38 Mon Sep 17 00:00:00 2001 From: dexuan Date: Wed, 14 Jun 2017 13:23:40 +0000 Subject: [PATCH] MFC: 319690 r319690 hyperv/pcib: use the device serial number as PCI domain Currently the PCI domain is initialized with the instance GUID in vmbus_pcib_attach(). It turns out the GUID can change across VM reboot, while some users want a persistent value for PCI domain. The solution is that we can change to use the device serial number, which starts with 1 and is unique within a VM. Obtained from: Haiyang Zhang Sponsored by: Microsoft git-svn-id: svn://svn.freebsd.org/base/stable/10@319941 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/dev/hyperv/pcib/vmbus_pcib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/hyperv/pcib/vmbus_pcib.c b/sys/dev/hyperv/pcib/vmbus_pcib.c index 0e8170848..b54c67b70 100644 --- a/sys/dev/hyperv/pcib/vmbus_pcib.c +++ b/sys/dev/hyperv/pcib/vmbus_pcib.c @@ -574,6 +574,8 @@ new_pcichild_device(struct hv_pcibus *hbus, struct pci_func_desc *desc) hpdev->desc = *desc; mtx_lock(&hbus->device_list_lock); + if (TAILQ_EMPTY(&hbus->children)) + hbus->pci_domain = desc->ser & 0xFFFF; TAILQ_INSERT_TAIL(&hbus->children, hpdev, link); mtx_unlock(&hbus->device_list_lock); return (hpdev); -- 2.45.0