OSDN Git Service

PCI: hv: Detect and fix Hyper-V PCI domain number collision
authorHaiyang Zhang <haiyangz@microsoft.com>
Thu, 15 Aug 2019 17:01:37 +0000 (17:01 +0000)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Wed, 21 Aug 2019 07:15:19 +0000 (08:15 +0100)
commitbe700103efd1050808db1cf00e52c3a2837bf802
tree335df80c063be4cc71b8121c983e89089d3aeefd
parentf58ba5e3f6863ea4486952698898848a6db726c2
PCI: hv: Detect and fix Hyper-V PCI domain number collision

Currently in Azure cloud, for passthrough devices, the host sets the
device instance ID's bytes 8 - 15 to a value derived from the host HWID,
which is the same on all devices in a VM. So, the device instance ID's
bytes 8 and 9 provided by the host are no longer unique. This affects
all Azure hosts since July 2018, and can cause device passthrough to VMs
to fail because the bytes 8 and 9 are used as PCI domain number.
Collision of domain numbers will cause the second device with the same
domain number fail to load.

In the cases of collision, we will detect and find 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>
drivers/pci/controller/pci-hyperv.c