Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong BusID in generated xorg.conf #471

Closed
hnsl opened this issue Jan 27, 2022 · 6 comments
Closed

Wrong BusID in generated xorg.conf #471

hnsl opened this issue Jan 27, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@hnsl
Copy link

hnsl commented Jan 27, 2022

Describe the bug

The xorg config is invalid on my system. To get optimus-manager to work I need to patch pci.py:

        bus_id = "PCI:" + ":".join(
            str(int(field, 16)) for field in re.split("[.:]", bus_id)[1:]
        )

Removing the first part with [1:]

My system looks like this:

 lspci | grep -E "VGA|3D"
0000:00:02.0 VGA compatible controller: Intel Corporation TigerLake-LP GT2 [Iris Xe Graphics] (rev 01)
0000:01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce MX350] (rev a1)
0000:04:00.0 VGA compatible controller: NVIDIA Corporation GA102 [GeForce RTX 3080] (rev a1)

But my xorg.conf NEEDS to have all PCI formats like so:

BusID "PCI:4:0:0"

Note that the initial "0000:" must be dropped, or xorg cannot find the corresponding BusID and will crash. This is true for all PCI devices on my system.

Why this is the case I have no idea. Maybe I'm using NVIDIA KMS instead of regular kernel KMS and they have different BusID format? I don't know.


System info
Please include :

  • Your distribution
    5.15.10-arch1-1
  • Your desktop manager (KDE, GNOME, Cinnamon...), if you have one
    GNOME
  • You display manager (SDDM, GDM, LightDM...), if you have one. If you do not know, you are probably using the one coming with your desktop manager.
    GDM
  • Your laptop model, if you think it could be related to the problem
    ACER Swift 5
  • The version of optimus-manager you are using : latest stable release (optimus-manager), or the latest Git version (optimus-manager-git)
    1.4-3
  • Your custom optimus-manager configuration file at /etc/optimus-manager/optimus-manager.conf, if you made one
    None
@JoshuaCrewe
Copy link

I think I have the same issue on my machine. I didn't get as far a configuring optimus manager yet (I am trying to learn about how it all works before configuring power management) so no config file.

  • 5.16.4-arch1-1
  • No Desktop Manager (BSPWM)
  • No Display manage
  • Dell XPS 15 9510
  • optimus-manager from the AUR built today

When I get optimus-manager to create the xorg config I can't start X. It crashes out as it can't find the BusID. If I manually edit the xorg config it produces, removing the first part of the ID (:0 in my case) then it will start X. I can't get optimus-manager to switch using the CLI (probably for this reason) I have had some success with a kernel parameter.

Happy to debug if needed or provide any more information desired.

@Askannz Askannz added the bug Something isn't working label Mar 24, 2022
@nwildner
Copy link
Collaborator

nwildner commented Nov 15, 2022

Same here on a ASUS TUF DASH F15(2022), which is a laptop rated as "out of the box" for optimus-manager in the Arch Wiki.

I dont know for sure what is the root cause of the Domain colum being added as a default behavior on lspci, if it was an update on pciutils or a BIOS/Firmware on this laptop.

I was unable to start X with Optimus, until I saw some python3 errors on optimus-manager printing a valuable information that the PCI ID was invalid

switch-20221115T113438.log:[2524] ERROR: Nvidia PCI reset failed. Continuing anyways. Error is: Failed to perform PCI reset: Unexpected PCI ID format: 0000:01:00.0

The behavior on Xorg config files was the same as reported by @hnsl and @JoshuaCrewe , and I've managed to create some overrides to FIX that extra zero after the PCI: BusID on Xorg configurations:

[nwildner@sandworm ~]$ grep -r PCI /etc/optimus-manager/xorg/ 
/etc/optimus-manager/xorg/nvidia-mode/nvidia-gpu.conf:BusID "PCI:1:0:0"
/etc/optimus-manager/xorg/nvidia-mode/integrated-gpu.conf:BusID "PCI:0:2:0"
/etc/optimus-manager/xorg/integrated-mode/integrated-gpu.conf:BusID "PCI:0:2:0"
/etc/optimus-manager/xorg/hybrid-mode/nvidia-gpu.conf:BusID "PCI:1:0:0"
/etc/optimus-manager/xorg/hybrid-mode/integrated-gpu.conf:BusID "PCI:0:2:0"

Pretty much I've manually replaced the PCI:0:1:0:0 and PCI:0:0:2:0 from Nvidia and Intel respectivelly which were wrongly generated by Optimus(see more below regarding the Domain ID)

Maybe a solution to this would be to generate this pci data using lspci -m, to avoid breaking compatibility?

[nwildner@sandworm ~]$ lspci -m | grep -i 'RTX\|UHD'
00:02.0 "VGA compatible controller" "Intel Corporation" "Alder Lake-P GT1 [UHD Graphics]" -r0c -p00 "ASUSTeK Computer Inc." "Device 136d"
01:00.0 "VGA compatible controller" "NVIDIA Corporation" "GA104M [GeForce RTX 3070 Mobile / Max-Q]" -ra1 -p00 "ASUSTeK Computer Inc." "Device 136d"
[nwildner@sandworm ~]$ lspci | grep -i 'RTX\|UHD'
0000:00:02.0 VGA compatible controller: Intel Corporation Alder Lake-P GT1 [UHD Graphics] (rev 0c)
0000:01:00.0 VGA compatible controller: NVIDIA Corporation GA104M [GeForce RTX 3070 Mobile / Max-Q] (rev a1)

Since for most motherboards the Domain on PCI is likely zero, that information could be ignored from Xorg configuration files. On my laptop, the only hardware that is in another domain are: CPU pci controller + NVME:

[nwildner@sandworm ~]$ lspci | grep '^10000'
10000:e0:06.0 PCI bridge: Intel Corporation 12th Gen Core Processor PCI Express x4 Controller #0 (rev 02)
10000:e1:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller 980

Another approach would be handling this first column appropriately with the format PCI:bus@domain:device:function (so, 1st and second column of lspci are switched) as explained here:

Setting BUSID in xorg.conf - Answer 2

In this case, Nvidia GPU which is being generated as PCI:0:1:0:0, should be PCI:1@0:0:0 using this format

I'll try later to use that format on my laptop as well and report back here

@Maddin-619
Copy link
Contributor

Same issue on a Dell Precision 3571. Also for me cutting out the domain prefix fixed the issue.

@niscolas
Copy link

Maybe adding an option for the format in the optimus-manager.conf would help in this case

@CyanChanges
Copy link

Same problem

@es20490446e
Copy link
Collaborator

Fixed at #551

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants