Skip to content

intel: do not require PCI enable count to be exactly 1 - #554

Merged
Syllo merged 1 commit into
masterfrom
fix/intel-pci-enable-cnt
Nov 12, 2026
Merged

Syllo merged 1 commit into
masterfrom
fix/intel-pci-enable-cnt

Conversation

@Syllo

@Syllo Syllo commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Summary

Intel GPUs are discarded during enumeration when /sys/bus/pci/devices/<pci>/enable is not exactly "1":

if (nvtop_device_get_sysattr_value(parent, "enable", &enabled) < 0 || strcmp(enabled, "1"))
  return;

That attribute is not a boolean. It exposes pci_dev.enable_cnt, the number of times pci_enable_device() has been called:

  • drivers/pci/pci-sysfs.c: enable_show() emits atomic_read(&pdev->enable_cnt).
  • drivers/pci/pci.c: pci_enable_device_flags() does atomic_inc_return(&dev->enable_cnt).
  • include/linux/pci.h: pci_is_enabled() is enable_cnt > 0.

Integrated GPUs commonly have a count greater than one. On the affected Meteor Lake-P machine it is 3, so nvtop never registers the GPU and prints No GPU to monitor.

The value is also not a stable indicator of usability: xe_pci_runtime_suspend() and xe_pci_suspend() call pci_disable_device() for D3cold while the driver remains bound, so the count can be zero for a perfectly functional, idle GPU.

After the existing Intel vendor and i915/xe driver checks, the bound driver is the reliable signal: both drivers enable the device during probe (i915_driver_probe() calls pci_enable_device(), xe_pci_probe() calls pcim_enable_device()), and probe failure prevents binding. This removes the redundant and fragile enable check.

Testing

  • Built with -DINTEL_SUPPORT=ON.
  • All 27 existing tests pass.
  • nvtop -s still works normally on the non-Intel GPU of the development machine.
  • Cannot test on affected Intel hardware directly; the reporter confirmed the one-line variant fixes detection on their Meteor Lake-P system.

Fixes #553
See also #465, #498 (not confirmed to share this root cause).

`/sys/bus/pci/devices/.../enable` exposes pci_dev.enable_cnt, the number of
times pci_enable_device() has been called, not a boolean. Integrated GPUs
commonly have a count greater than one (e.g. Meteor Lake-P reports 3), so
requiring the string "1" caused nvtop to discard a working GPU during
enumeration.

The count is not a reliable proxy for usability either: xe drops it during
D3cold runtime suspend while keeping the driver bound, so a device that is
currently disabled may still be perfectly functional. Rely on the bound
i915/xe driver instead.

Fixes: #553
See also: #465, #498
@Syllo
Syllo merged commit 406d614 into master Nov 12, 2026
8 checks passed
@Syllo
Syllo deleted the fix/intel-pci-enable-cnt branch November 12, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Intel GPU not detected when PCI enable (enable_cnt) is not exactly "1"

1 participant