Bug 91748 - Drivers fail to configure - device already claimed
Summary: Drivers fail to configure - device already claimed
Status: RESOLVED MOVED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/DDX/Xorg (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium critical
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-24 22:04 UTC by d3ck0r
Modified: 2018-12-13 18:29 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
dmesg with drm.debug=0x1e starting Xorg -configure :0 (28.22 KB, application/octet-stream)
2015-08-25 18:52 UTC, d3ck0r
no flags Details
xorg log without -configure (4.90 KB, text/plain)
2015-08-25 23:18 UTC, d3ck0r
no flags Details
Xorg :0 launched from console (11.76 KB, text/plain)
2015-08-25 23:31 UTC, d3ck0r
no flags Details

Description d3ck0r 2015-08-24 22:04:07 UTC
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...
http://cgit.freedesktop.org/xorg/xserver/commit/hw/xfree86/common/xf86pciBus.c?id=cf66471353ac5899383b573a3cfca407e90d501e

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.
Comment 1 Chris Wilson 2015-08-24 22:19:30 UTC
You don't have the kernel i915.ko driver, or at least not with modesetting enabled.
Comment 2 d3ck0r 2015-08-25 03:26:28 UTC
lspci -v indicates

00:02.0 VGA compatible controller: Intel Corporation 4th Generation Core Processor Family Integrated Graphics Controller (rev 06) (prog-if 00 [VGA controller])
        DeviceName:  Onboard IGD
        Subsystem: Intel Corporation 4th Generation Core Processor Family Integrated Graphics Controller
...
        Kernel driver in use: i915
        Kernel modules: i915

and /usr/lib/xorg/modules/drivers contains

[root@tower2 drivers]# ls /usr/lib/xorg/modules/drivers
intel_drv.so  modesetting_drv.so


and Xorg.0.log contains

[131192.742] List of video drivers:
[131192.742]    intel
[131192.742]    modesetting

So; no that's not it.
Comment 3 Chris Wilson 2015-08-25 12:10:54 UTC
cat /sys/module/i915/parameters/modeset
Comment 4 d3ck0r 2015-08-25 14:27:08 UTC
[root@tower2 drivers]# cat /sys/module/i915/parameters/modeset
-1

That was one thing that confused me... but I had tried...

[root@tower2 drivers]# echo 1 > /sys/module/i915/parameters/modeset
bash: /sys/module/i915/parameters/modeset: Permission denied

and that didn't work
Comment 5 Jani Nikula 2015-08-25 16:14:14 UTC
Please attach dmesg with drm.debug=14 module parameter set, all the way from boot, and we'll know more.
Comment 6 d3ck0r 2015-08-25 18:52:44 UTC
Created attachment 117915 [details]
dmesg with drm.debug=0x1e starting Xorg -configure :0

reverted to original, unmodified Xorg

Xorg version shows command line...
attached contains dmesg and Xorg.0.log

[root@tower2 ~]# Xorg -version

X.Org X Server 1.17.2
Release Date: 2015-06-16
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.0.4-2-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 drm.debug=0x1e log_buf_len=4M
Build Date: 17 July 2015  05:38:19PM
Comment 7 d3ck0r 2015-08-25 18:55:20 UTC
The error really is something along the lines of 'you can't claim the PCI slot because you already have claimed the PCI slot'
Comment 8 Chris Wilson 2015-08-25 19:07:58 UTC
[   191.198] (--) PCI:*(0:0:2:0) 8086:041e:8086:041e rev 6, Mem @ 0xf7800000/4194304, 0xe0000000/268435456, I/O @ 0x0000f000/64
[   191.198] List of video drivers:
[   191.198]    intel
[   191.198]    modesetting
..
[   191.203] (II) intel(G0): Using Kernel Mode Setting driver: i915, version 1.6.0 20150327

X has probed the video card, it is even marked as primary, but despite it being the only device on the system, X tries to set it up as a slaved screen.

To workaround that you need to create an xorg.conf, just

Section "Device"
  Identifier "igfx"
  Driver "intel"
EndSection

should suffice, though you may need a BusID "pci:0:0:2" line.
Comment 9 d3ck0r 2015-08-25 23:18:02 UTC
Created attachment 117916 [details]
xorg log without -configure

Adding an xorg.conf with that section has the same results

No devices to configure.  Configuration failed.

I will correct myself, it is when it is checking modesetting that it conflicts with the device "intel", not intel with itself as I thought it was.

--------
I guess using Xorg -configure ignores all configuration directories and -config option... So running without -configure

this is in /etc/X11/xorg.conf.d

[root@tower2 xorg.conf.d]# cat 20-intel.conf 
Section "Device"
  Identifier "igfx"
  Driver "intel"
  BusID "pci:0:0:2"
EndSection

result is 

[ 15583.602] (II) intel(G0): SNA compiled from 2.99.917-381-g5772556
[ 15583.602] (EE) No devices detected.
[ 15583.602] (EE) 
Fatal server error:
[ 15583.602] (EE) no screens found(EE) 
[ 15583.603] (EE) 

where modesetting fails to get added because it is the conflict with the intel card.
Comment 10 d3ck0r 2015-08-25 23:27:42 UTC
> I guess using Xorg -configure ignores all configuration directories and
> -config option... So running without -configure
> 
> this is in /etc/X11/xorg.conf.d
> 
> [root@tower2 xorg.conf.d]# cat 20-intel.conf 
> Section "Device"
>   Identifier "igfx"
>   Driver "intel"
>   BusID "pci:0:0:2"
> EndSection
> 

BusID should have been pci:0:2:0

after getting a /root/xorg.conf.new with bypassed FALSE the subsection "driver" had Driver "modesetting" but pci:0:2:0

This works the same way; can launch it from an SSH terminal (with errors from systemd-logind)

but it doesn't work launched from console.
Comment 11 d3ck0r 2015-08-25 23:31:03 UTC
Created attachment 117917 [details]
Xorg :0 launched from console

(with intel device specified in a config fragment)

On console 1
... doesn't change to a graphic mode.
Comment 12 GitLab Migration User 2018-12-13 18:29:34 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/xserver/issues/170.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.