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
MFC after:	1 day
Sponsored by:	Microsoft
This commit is contained in:
dexuan 2017-06-08 12:11:30 +00:00
parent d6c83afa53
commit dfcaf984ee

View File

@ -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);