summaryrefslogtreecommitdiff
path: root/hw/xfree86/common
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2016-09-07 15:08:06 +0200
committerAdam Jackson <ajax@redhat.com>2016-09-28 14:53:39 -0400
commitca8d88e50310a0d440a127c22a0a383cc149f408 (patch)
tree4973c9530e027325be7f32c70ecdc8953f25329c /hw/xfree86/common
parent44968da376c880e096225f149f78673aa4c6e5e0 (diff)
xfree86: recognize primary BUS_PCI device in xf86IsPrimaryPlatform()
The new platform bus code and the old PCI bus code overlap. Platform bus can handle any type of device, including PCI devices, whereas the PCI code can only handle PCI devices. Some drivers only support the old style PCI-probe methods, but the primary device detection code is server based, not driver based; so we might end up with a primary device which only has a PCI bus-capable driver, but was detected as primary by the platform code, or the other way around. (The above paragraph was shamelessly stolen from Hans de Goede, and customized.) The latter case applies to QEMU's virtio-gpu-pci device: it is detected as a BUS_PCI primary device, but we actually probe it first (with the modesetting driver) through xf86platformProbeDev(). The xf86IsPrimaryPlatform() function doesn't recognize the device as primary (it bails out as soon as it sees BUS_PCI); instead, we add the device as a secondary graphics card under "autoAddGPU". In turn, the success of this automatic probing-as-GPU prevents xf86CallDriverProbe() from proceeding to the PCI probing. The result is that the server exits with no primary devices detected. Commit cf66471353ac ("xfree86: use udev to provide device enumeration for kms devices (v10)") added "cross-bus" matching to xf86IsPrimaryPci(). Port that now to xf86IsPrimaryPlatform(), so that we can probe virtio-gpu-pci as a primary card in platform bus code. Cc: Adam Jackson <ajax@redhat.com> Cc: Dave Airlie <airlied@redhat.com> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Keith Packard <keithp@keithp.com> Cc: Marcin Juszkiewicz <mjuszkiewicz@redhat.com> Signed-off-by: Laszlo Ersek <lersek@redhat.com> Tested-By: Marcin Juszkiewicz <mjuszkiewicz@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'hw/xfree86/common')
-rw-r--r--hw/xfree86/common/xf86platformBus.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 96895a6e1..71f8df1d7 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -114,7 +114,15 @@ xf86_find_platform_device_by_devnum(int major, int minor)
static Bool
xf86IsPrimaryPlatform(struct xf86_platform_device *plat)
{
- return ((primaryBus.type == BUS_PLATFORM) && (plat == primaryBus.id.plat));
+ if (primaryBus.type == BUS_PLATFORM)
+ return plat == primaryBus.id.plat;
+#ifdef XSERVER_LIBPCIACCESS
+ if (primaryBus.type == BUS_PCI)
+ if (plat->pdev)
+ if (MATCH_PCI_DEVICES(primaryBus.id.pci, plat->pdev))
+ return TRUE;
+#endif
+ return FALSE;
}
static void