Skip to content

Xen support might require some patches from QubesOS for better workstation compatibility. #340544

@CertainLach

Description

@CertainLach

Describe the bug

Upstream Xen might have compatibility issues with many hardware configurations, as it is primarily intended for enterprise servers, not for workstations/laptops, where NixOS is more popular.

Steps To Reproduce

  1. Enable Xen on workstation/laptop hardware.
  2. Notice that xen power management doesn't work correctly/xen doesn't boot because of some incompatibility.

Expected behavior

As far as I'm aware, the only distribution which explicitly provides support for Xen on workstations is QubesOS.
Wonder if we might want to have some kernel/hypervisor patches from QubesOS to be packaged.

I had an issue with E820 page conflict, which is resolved in QubesOS kernel (There is also a PR with better patch to consider, I am using it: QubesOS/qubes-linux-kernel#992)

(Upstream has also other workaround, but this PR is the "correct" fix for the issue)
There is also xen pm patches, which might be useful to some users, if we want to have user experience in NixOS Xen to be closer to QubesOS (everything works out of the box on consumer hardware)

  boot.kernelPatches = let
    e820 = id: name: hash: {
      inherit name;
      patch = pkgs.fetchpatch {
        inherit hash;
        url = "https://raw.githubusercontent.com/QubesOS/qubes-linux-kernel/8c92891869f38016372e89706c4e00e83d1f092d/${id}-xen-${name}.patch";
      };
    };
  in [
    (e820 "0001" "use-correct-end-address-of-kernel-for-conflict-c" "sha256-q0ntLxlrVNQi6YyeqCPppEfGosPRCbeWcKMBfijYPK0=")
    (e820 "0002" "introduce-generic-helper-checking-for-memory-map" "sha256-PG9a6KOWDbH3Q+n7Ak+3qIaD2XUpnUFsBho73LIUvrk=")
    (e820 "0003" "move-checks-for-e820-conflicts-further-up" "sha256-Mm9jTWSXbwPjHCcz9nWLnWnzEcOkM1lU5TOxXZkmqrU=")
    (e820 "0004" "move-max_pfn-in-xen_memory_setup-out-of-function" "sha256-g8slHt7oTU7bChxJiKrYjLSc6vyRjl05hO2hHW1qin4=")
    (e820 "0005" "tolerate-ACPI-NVS-memory-overlapping-with-Xen-al" "sha256-ZilEj4Eh57M7VWN6xS8gOWArghgSqXTllMXFYr8L2kA=")
  ];

Notify maintainers

@SigmaSquadron


Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

Labels

0.kind: bugSomething is broken6.topic: xen-projectIssues and PRs related to the Xen Project Hypervisor.9.needs: package (new)This needs a new package to be added

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions