summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2014-12-30 09:13:15 -0800
committerAdam Jackson <ajax@redhat.com>2015-06-03 09:05:37 -0400
commit905126c66c45a150932a532de14a4a10595526dc (patch)
treef42cbbb991f5d4748d456e33d5100e9ba560bff6 /hw
parentd8153d1767ccb60a92693c390d12f1f157e24da9 (diff)
xfree86: Fix xf86_check_platform_slot's handling of PCI
If a PCI entity is found, xf86_check_platform_slot performs a device ID check against the xf86_platform_device passed in. However, it just returns immediately without checking the rest of the entities first. This leads to this situation happening: 1. The nvidia driver creates an entity 0 with bus.type == BUS_PCI 2. The intel driver creates entity 1 for its platform device, opening /dev/dri/card0 3. xf86platformProbeDev calls probeSingleDevice on the Intel platform device, which calls doPlatformProbe, which calls xf86_check_platform_slot. 4. xf86_check_platform_slot compares the Intel platform device against the NVIDIA PCI entity. Since they don't have the same device ID, it returns TRUE. 5. doPlatformProbe calls xf86ClaimPlatformSlot, which creates a duplicate entity for the Intel one. Fix this by only returning FALSE if the PCI ID matches, and continuing the loop otherwise. In the scenario above, this allows it to continue on to find the Intel platform device that matches the second entity. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 4ecda362594d771f401de467c2d58c0f552227a8)
Diffstat (limited to 'hw')
-rw-r--r--hw/xfree86/common/xf86platformBus.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 15988b8b1..387b5f1ad 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -153,8 +153,10 @@ xf86_check_platform_slot(const struct xf86_platform_device *pd)
for (i = 0; i < xf86NumEntities; i++) {
const EntityPtr u = xf86Entities[i];
- if (pd->pdev && u->bus.type == BUS_PCI)
- return !MATCH_PCI_DEVICES(pd->pdev, u->bus.id.pci);
+ if (pd->pdev && u->bus.type == BUS_PCI &&
+ MATCH_PCI_DEVICES(pd->pdev, u->bus.id.pci)) {
+ return FALSE;
+ }
if ((u->bus.type == BUS_PLATFORM) && (pd == u->bus.id.plat)) {
return FALSE;
}