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

PCI domains other than 0000 or 4-digit break qubesd #8143

Closed
docelic opened this issue Apr 15, 2023 · 3 comments
Closed

PCI domains other than 0000 or 4-digit break qubesd #8143

docelic opened this issue Apr 15, 2023 · 3 comments
Labels
affects-4.1 This issue affects Qubes OS 4.1. affects-4.2 This issue affects Qubes OS 4.2. C: core diagnosed Technical diagnosis has been performed (see issue comments). hardware support P: default Priority: default. Default priority for new issues, to be replaced given sufficient information.
Milestone

Comments

@docelic
Copy link

docelic commented Apr 15, 2023

Qubes OS release

Qubes-4.1.2

Brief summary

If a host machine has PCI devices in a PCI domain that is not "0000" or 4-digit (such as domain "10000"), it breaks qubesd.

In turn this makes all qubes fail to start, the Devices tab in Settings of all qubes becomes disabled, and commands like qvm-pci fail.

Steps to reproduce

Run Qubes on any hardware with PCI devices in domain other than 0000 or 4-digit.

Expected behavior

Dom0 and qubes to work as usual/expected.

Actual behavior

Dom0 will start, but qubes will be broken:

  1. Qubes won't start (list of running qubes will be empty)
  2. Running qubes manually will not work
  3. Devices tab in Settings of all qubes will be grayed-out
  4. qvm-pci will give a misleading error

More info

For example, on Asus G614J these devices are in domain 10000:

10000:e0:1d.0 System peripheral: Intel Corporation Device 09ab
10000:e0:1d.4 PCI bridge: Intel Corporation Device 7a34 (rev 11)
10000:e1:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd Device a80c

Luckily it seems that all important devices (which might want to be assigned to qubes) are in the default domain. A possible quick workaround for those who want to fix it immediately is to patch a line of Python code in dom0 to ignore other devices, and restart qubesd:

  1. Open https://github.com/QubesOS/qubes-core-admin/blob/master/qubes/ext/pci.py#L186. On the installed system this file will be something like /usr/lib/python3.8/site-packages/qubes/ext/pci.py.
  2. In function on_device_list_pci, above the line yield PCIDevice(...), add this code for example:
            if not libvirt_name.startswith("pci_0000_"):
              continue

Then restart qubesd with service qubesd restart.

More info is in: https://forum.qubes-os.org/t/major-problem-with-qvm-pci-and-devices-in-general/8359/15

@docelic docelic added P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. T: bug labels Apr 15, 2023
@andrewdavidwong andrewdavidwong changed the title Support for PCI domains other than 0000 or 4-digit PCI domains other than 0000 or 4-digit break qubesd Apr 15, 2023
@andrewdavidwong andrewdavidwong added C: core hardware support needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. labels Apr 15, 2023
@andrewdavidwong andrewdavidwong added this to the Release 4.1 updates milestone Apr 15, 2023
@xaki23
Copy link

xaki23 commented Apr 17, 2023

having watched this unfold on the irc side ... not sure what part needs diagnosis.

a) qubes has hardcoded assumption pci domain is 0000 in various places.
b) as of intel gen 11 (?) this seems no longer safe to assume.
c) ignoring all not-0000 domains seems safe for the two samples known so far.
d) adding support for multiple pci domains would probably be better longterm.

@andrewdavidwong andrewdavidwong added diagnosed Technical diagnosis has been performed (see issue comments). and removed needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. labels Apr 17, 2023
@andrewdavidwong andrewdavidwong added the affects-4.1 This issue affects Qubes OS 4.1. label Aug 8, 2023
@andrewdavidwong andrewdavidwong removed this from the Release 4.1 updates milestone Aug 13, 2023
@Kenny606
Copy link

I've been playing around with RC1 in VMWare however this is my first 4.2 install on this bare metal laptop (which was running 4.1.2).
I can confirm this issue has carried through to R4.2 RC2 as well. The suggested adjustment to pci.py was still successful on RC2 just replace 3.8 with 3.11 in the path.

The 3 devices on the 0001 pci domain on my 12th Gen i7 Dell were also just 3 baseboard components you wouldn't be passing through to anything anyway.
I remember I had the same issue when I loaded 4.1 on this machine last year and made the same change.
I believe I experienced it initially on my XPS after loading 4.1 which is also a 12th Gen.

@marmarek
Copy link
Member

Fixed in QubesOS/qubes-core-admin#560

@andrewdavidwong andrewdavidwong added this to the Release 4.2 milestone Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.1 This issue affects Qubes OS 4.1. affects-4.2 This issue affects Qubes OS 4.2. C: core diagnosed Technical diagnosis has been performed (see issue comments). hardware support P: default Priority: default. Default priority for new issues, to be replaced given sufficient information.
Projects
None yet
Development

No branches or pull requests

5 participants