Repository navigation
Conversation
- Add test/shell.d/hw-msi-test.sh with 11 detection tests - Replace lspci with sysfs reads for RTL8125B detection (aligns with PR omacom#11259)
- Add test/shell.d/hw-msi-test.sh with 11 detection tests - Replace lspci with sysfs reads for RTL8125B detection (aligns with PR omacom#11259)
8c89a5f to
f29ffad
Compare
[Medium impact] The changes reach hardware detection and setup across several install and user workflows. The PR should not merge until the hardware tests use the helper path and PCI fixtures, and the path defaults satisfy the repository requirement. FindingsSummaryThis PR moves PCI checks into a shared helper that reads cached sysfs fields.
Reviews (7) · Last reviewed commit: "avoid lspci in favor of sysfs" · Reviewed by Greptile |
173ede1 to
ab7aa26
Compare
|
The sysfs helpers look like the right direction (and avoid the lspci D3cold wake). Two consolidate notes:
|
2583f0c to
6e300ce
Compare
|
This pull request was classified at head Two things for whoever picks it up, checked against the diff: #12076 converts the same BCM43xx, T2, Vulkan and NVIDIA detection to sysfs with its own helpers, so the two overlap and only one approach should land; and the description still lists migrations and tests ( This now waits on the maintainer to decide what it is. |
| source "$OMARCHY_PATH/install/helpers/pci-sysfs.sh" | ||
|
|
||
| nvidia_config="${OMARCHY_NVIDIA_MODPROBE_CONFIG:-/etc/modprobe.d/nvidia.conf}" | ||
|
|
||
| if [[ ! -f $nvidia_config ]] && | ||
| omarchy-cmd-present lspci && | ||
| LC_ALL=C lspci -k | grep -qi 'Kernel driver in use: nouveau'; then | ||
| if [[ ! -f $nvidia_config ]] && omarchy-pci-driver nouveau; then |
There was a problem hiding this comment.
Hardware tests lose their fixtures
nouveau-cursor-test.sh and brcmfmac-supplicant-test.sh still fake lspci, which these scripts no longer call. Neither test supplies OMARCHY_PATH or OMARCHY_PCI_DEVICES_PATH. In a clean environment, sourcing the helper fails. Setting OMARCHY_PATH alone still makes the tests read the host's hardware instead of their fake devices.
Update both tests to supply the helper path and PCI fixtures, including driver links for the cursor test.
| # than lspci, which reads PCI config space and resumes a runtime-suspended | ||
| # dGPU -- on every menu open, since the menu's Hybrid GPU row asks this. | ||
| pci_devices_path="${OMARCHY_PCI_DEVICES_PATH:-/sys/bus/pci/devices}" | ||
| export OMARCHY_PATH="${OMARCHY_PATH:-/usr/share/omarchy}" |
There was a problem hiding this comment.
Path defaults break repository rules
This assignment manually defaults and exports OMARCHY_PATH. The repository explicitly requires commands in bin/ to use the supplied value without defaulting or re-exporting it.
Remove this assignment and the matching ones in bin/omarchy-hw-nvidia and bin/omarchy-install-gaming-gpu-lib32. This repository requirement must be satisfied before merging.
File Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
lspci reads PCI config space, and the kernel resumes a runtime-suspended device to serve that read. On a hybrid laptop the discrete GPU idles in D3cold, so a bare lspci can take over a second waking it — a cost paid at the worst time: during config soaks and per-user setup. Read the vendor, device, and class IDs from cached sysfs fields instead, which never touch config space, via a small shared helper (install/helpers/pci-sysfs.sh). T2 and Broadcom parts match by vendor/device ID; Intel/AMD/Apple Intel-video packages by class prefix plus vendor; the nouveau cursor fix by the bound driver symlink (dropping its lspci-presence guard since sysfs is always there).
|
The head moved to Checked against the diff at this head: This waits on the maintainer to decide what it is, and which of this and #12076 to take. |
Summary
Replace every
lspcicall with reads from/sys/bus/pci/devicesvia a small shared helper (install/helpers/pci-sysfs.sh).lspcireads PCI config space, which forces the kernel to runtime-suspend a device that has entered D3cold — on hybrid laptops this means a barelspcican take over a second waking the discrete GPU. The cached sysfs fields (vendor,device,class, and thedriversymlink) never touch config space, so nothing wakes.Motivation
On hybrid laptops the discrete GPU idles in D3cold, and reading PCI config space forces a resume. This pays the wake penalty during config soaks and per-user setup, at the worst time in the boot/install flow. The vendor, device, class, and bound-driver information is already available from sysfs files the kernel caches — nothing there touches the device.
What changed
New shared helper —
install/helpers/pci-sysfs.sh:omarchy-pci-id <vendor> [device ...]— match by vendor + device IDomarchy-pci-class-vendor <class> <vendor>— match by class prefix + vendoromarchy-pci-class-count <class>— count devices with a given class prefixomarchy-pci-driver <driver>— match by bound driver symlinkAll matchers walk
OMARCHY_PCI_DEVICES_PATH(defaulting to/sys/bus/pci/devices); tests point it at a fixture tree.Hardware detectors migrated (14 files):
bin/omarchy-hw-hybrid-gpu— GPU count viaomarchy-pci-class-count 0x03; also adds atimeoutguard aroundsupergfxctlso a wedged daemon no longer blocks the menubin/omarchy-hw-nvidia(new) — NVIDIA GPU detection viaomarchy-pci-class-vendor 0x03 0x10debin/omarchy-hw-intel-sof(new) — Intel SOF audio DSP detection viaomarchy-pci-class-vendor 0x04 0x8086install/hardware/vulkan.sh,install/hardware/pacman.sh,install/hardware/apple/fix-t2.sh,install/hardware/apple/fix-brcmfmac-supplicant.sh,install/hardware/fix-bcm43xx.sh,install/hardware/fix-yt6801-ethernet-adapter.sh,install/hardware/intel/fix-wifi7-eht.sh,bin/omarchy-install-gaming-gpu-lib32— all migrated to sysfs matchersNouveau cursor fix —
install/user/hardware/fix-nouveau-cursor.shnow usesomarchy-pci-driver nouveauinstead oflspcioutput, and no longer needs a guard that checked whetherlspciwas available (sysfs is always there).Migrations —
migrations/1784401744.sh,migrations/1785944594.sh,migrations/1786391100.shupdated to use the sysfs helpers.Why lspci hurts on hybrid laptops
The kernel exposes PCI config space through
/sys/bus/pci/devices/<slot>/config, and reading that file triggers a runtime resume if the device is suspended in D3cold.lspcireads config space for every PCI device it enumerates. On a hybrid laptop the discrete GPU typically sits in D3cold while the integrated GPU drives the display, so a singlelspcicall can force a >1 second wake — paid at the worst time: during config soaks and per-user setup. Thevendor,device,class, anddriversymlink in sysfs are cached by the kernel and served without waking the device.Files changed
install/helpers/pci-sysfs.shbin/omarchy-hw-hybrid-gpu,bin/omarchy-hw-nvidia(new),bin/omarchy-hw-intel-sof(new),bin/omarchy-install-gaming-gpu-lib32install/hardware/vulkan.sh,install/hardware/pacman.sh,install/hardware/apple/fix-t2.sh,install/hardware/apple/fix-brcmfmac-supplicant.sh,install/hardware/fix-bcm43xx.sh,install/hardware/fix-yt6801-ethernet-adapter.sh,install/hardware/intel/fix-wifi7-eht.shinstall/user/hardware/fix-nouveau-cursor.shmigrations/1784401744.sh,migrations/1785944594.sh,migrations/1786391100.shtest/shell.d/pci-sysfs-test.sh(new),test/shell.d/base-test.sh,test/shell.d/hw-hybrid-gpu-test.sh,test/shell.d/hw-nvidia-test.sh,test/shell.d/brcmfmac-supplicant-test.sh,test/shell.d/nouveau-cursor-test.sh,test/shell.d/t2-hardware-test.shTotal: 24 files, +319 / -97
Testing
./test/shellpassespci-sysfs-test.shexercises all four matchers against fixture treeshw-hybrid-gpu-test,hw-nvidia-test,t2-hardware-test,brcmfmac-supplicant-test,nouveau-cursor-test) updated to use the newwrite_pci_devices/bind_pci_drivertest helpers frombase-test.sh