<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Drivers fail to configure - device already claimed"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=91748">91748</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Drivers fail to configure - device already claimed
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>xorg
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>git
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>critical
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Driver/intel
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>chris@chris-wilson.co.uk
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>d3ck0r@gmail.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>intel-gfx-bugs@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I recently put together a new system, and have had issues getting X to come up
and be useful.  I'm using Arch linux.

X.Org X Server 1.17.2
Release Date: 2015-06-16
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.1.5-1-ARCH x86_64 
Current Operating System: Linux tower2 4.1.5-1-ARCH #1 SMP PREEMPT Tue Aug 11
15:41:14 CEST 2015 x86_64
Kernel command line: BOOT_IMAGE=/vmlinuz-linux
root=UUID=e126c645-2cb7-421f-8e0a-0f42c36337a7 rw quiet
Build Date: 24 August 2015  01:48:03AM

I was getting 'ErrorF("No devices to configure.  Configuration failed.\n");'
I thought it was xf86-video-intel reporting no devices, but after adding
tracing logging to that found it was returning success.  The issue comes up
later in xf86pciBus.c 

/*
 * Check if the slot requested is free.  If it is already in use, return FALSE.
 */ 
Bool xf86CheckPciSlot(const struct pci_device *d)
...
    for (i = 0; i < xf86NumEntities; i++) {
        const EntityPtr p = xf86Entities[i];
...
#ifdef XSERVER_PLATFORM_BUS
        if ((p->bus.type == BUS_PLATFORM) && (p->bus.id.plat->pdev)) {
            struct pci_device *ud = p->bus.id.plat->pdev;
         if (MATCH_PCI_DEVICES(ud, d))


the MATCH_PCI_DEVICES finds the same device already registered from intel
driver's drv->platformProbe... ( xf86platformProbeDev(drv) ) this was called
earlier when the driver was first loaded, which added the device to
xf86Entities.  So later, when it is in xf86PciAddMatchingDev it fails because
it thinks the device was already claimed; however it is claimed by the driver
itself.

I found that this patch...
<a href="http://cgit.freedesktop.org/xorg/xserver/commit/hw/xfree86/common/xf86pciBus.c?id=cf66471353ac5899383b573a3cfca407e90d501e">http://cgit.freedesktop.org/xorg/xserver/commit/hw/xfree86/common/xf86pciBus.c?id=cf66471353ac5899383b573a3cfca407e90d501e</a>

is the one that added the MATCH_PCI_DEVICES code mentioend above, but that was
in 2012-07-06; so I don't know how any system is managing to function, unless
it's a combination of options passed to ./configure that's causing it


This is the configure command line it uses...

  ./configure --prefix=/usr \
      --enable-ipv6 \
      --enable-dri \
      --enable-dmx \
      --enable-xvfb \
      --enable-xnest \
      --enable-composite \
      --enable-xcsecurity \
      --enable-libunwind \
      --enable-xorg \
      --enable-xephyr \
      --enable-glamor \
      --enable-xwayland \
      --enable-glx-tls \
      --enable-kdrive \
      --enable-kdrive-evdev \
      --enable-kdrive-kbd \
      --enable-kdrive-mouse \
      --enable-config-udev \
      --enable-systemd-logind \
      --enable-suid-wrapper \
      --disable-install-setuid \
      --enable-record \
      --disable-xfbdev \
      --disable-xfake \
      --disable-static \
      --libexecdir=/usr/lib/xorg-server \
      --sysconfdir=/etc \
      --localstatedir=/var \
      --with-xkb-path=/usr/share/X11/xkb \
      --with-xkb-output=/var/lib/xkb \
      --with-fontrootdir=/usr/share/fonts \
      --with-sha1=libgcrypt


it does --enable-config-udev which results in (I think) XSERVER_PLATFORM_BUS
being defined.  (it's actually because CONFIG_UDEV_KMS is defined in the
script, but I didn't see an option specifically for udev_kms)


----
I managed to get it to work by commenting out the return FALSE in
xf86CheckPciSlot.  But later had an issue that xf86screens entry didn't have a
PreInit function defined...

/* xf86Configure.c approx line 729 */

/* added check to see if preinit function was defined before calling it,
otherwise it called 0x00000 address */

        if ((*xf86Screens[dev2screen[j]]->PreInit )&&
            (*xf86Screens[dev2screen[j]]->PreInit) (xf86Screens[dev2screen[j]],
                                                    PROBE_DETECT) &&
            ConfiguredMonitor) {
            monitor_ptr = configureDDCMonitorSection(j);
        }
        else {
            monitor_ptr = configureMonitorSection(j);
        }


--------
After the first (hack) and the second fix was able to get Xorg :0 to start from
a ssh terminal, but not from a console terminal.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>