vmspawn: Always enable CXL on supported architectures

Drop the --cxl= option and unconditionally enable cxl=on the QEMU
machine type whenever the host architecture supports it (x86_64 and
aarch64). The flag was only added for testing parity with mkosi's CXL=
setting and there is no reason to leave it as an opt-in toggle: with no
pxb-cxl device or cxl-fmw window attached, enabling it on the machine
only reserves a small MMIO region and emits an empty CEDT, so the cost
is negligible while removing one knob users would otherwise have to
flip explicitly to exercise the CXL code paths in QEMU.
This commit is contained in:
Daan De Meyer
2026-04-07 12:47:31 +02:00
committed by Daan De Meyer
parent 54a0317f97
commit e4f535fdca
3 changed files with 2 additions and 27 deletions
-12
View File
@@ -187,18 +187,6 @@
<xi:include href="version-info.xml" xpointer="v255"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--cxl=<replaceable>BOOL</replaceable></option></term>
<listitem><para>Controls whether to enable CXL (Compute Express Link) support in the virtual
machine. CXL is a high-speed interconnect standard that allows CPUs to access memory attached to
devices such as accelerators and memory expanders, enabling flexible memory pooling and expansion
beyond what is physically installed on the motherboard. Only supported on x86_64 and aarch64
architectures.</para>
<xi:include href="version-info.xml" xpointer="v261"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--vsock=<replaceable>BOOL</replaceable></option></term>
+1 -1
View File
@@ -31,7 +31,7 @@ _systemd_vmspawn() {
local -A OPTS=(
[STANDALONE]='-h --help --version -q --quiet --no-pager -n --network-tap --network-user-mode --user --system -x --ephemeral'
[PATH]='-D --directory -i --image --linux --initrd --extra-drive --forward-journal --efi-nvram-template'
[BOOL]='--kvm --cxl --vsock --tpm --discard-disk --pass-ssh-key'
[BOOL]='--kvm --vsock --tpm --discard-disk --pass-ssh-key'
[TRISTATE]='--register --secure-boot'
[FIRMWARE]='--firmware'
[FIRMWARE_FEATURES]='--firmware-features'
+1 -14
View File
@@ -133,7 +133,6 @@ static uint64_t arg_ram = UINT64_C(2) * U64_GB;
static uint64_t arg_ram_max = 0;
static unsigned arg_ram_slots = 0;
static int arg_kvm = -1;
static bool arg_cxl = false;
static int arg_vsock = -1;
static unsigned arg_vsock_cid = VMADDR_CID_ANY;
static int arg_tpm = -1;
@@ -236,7 +235,6 @@ static int help(void) {
" Configure guest's RAM size (and max/slots for\n"
" hotplug)\n"
" --kvm=BOOL Enable use of KVM\n"
" --cxl=BOOL Enable use of CXL\n"
" --vsock=BOOL Override autodetection of VSOCK support\n"
" --vsock-cid=CID Specify the CID to use for the guest's VSOCK support\n"
" --tpm=BOOL Enable use of a virtual TPM\n"
@@ -382,7 +380,6 @@ static int parse_argv(int argc, char *argv[]) {
ARG_CPUS,
ARG_RAM,
ARG_KVM,
ARG_CXL,
ARG_VSOCK,
ARG_VSOCK_CID,
ARG_TPM,
@@ -441,7 +438,6 @@ static int parse_argv(int argc, char *argv[]) {
{ "ram", required_argument, NULL, ARG_RAM },
{ "qemu-mem", required_argument, NULL, ARG_RAM }, /* Compat alias */
{ "kvm", required_argument, NULL, ARG_KVM },
{ "cxl", required_argument, NULL, ARG_CXL },
{ "qemu-kvm", required_argument, NULL, ARG_KVM }, /* Compat alias */
{ "vsock", required_argument, NULL, ARG_VSOCK },
{ "qemu-vsock", required_argument, NULL, ARG_VSOCK }, /* Compat alias */
@@ -573,15 +569,6 @@ static int parse_argv(int argc, char *argv[]) {
return r;
break;
case ARG_CXL:
r = parse_boolean_argument("--cxl=", optarg, &arg_cxl);
if (r < 0)
return r;
if (arg_cxl && !ARCHITECTURE_SUPPORTS_CXL)
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
"CXL not supported on %s.", architecture_to_string(native_architecture()));
break;
case ARG_VSOCK:
r = parse_tristate_argument_with_auto("--vsock=", optarg, &arg_vsock);
if (r < 0)
@@ -2371,7 +2358,7 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) {
return r;
}
if (arg_cxl) {
if (ARCHITECTURE_SUPPORTS_CXL) {
r = qemu_config_key(config_file, "cxl", "on");
if (r < 0)
return r;