From nobody Mon Feb 2 07:27:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1768245715; cv=none; d=zohomail.com; s=zohoarc; b=kZBdbyA3wBS7YtJwR7jOs7kNNKCz/yEgFc+dl3VOo/FvMT8iH0EC97hLIUy9T8+BfaHJ/tfjEojUVTS5DWdElhmNpgpIklYimkpq9kkitC/MfmbeWqSn6LzepDWZS1OmkauyWkfS0kRNlZlI4aT68xPVQEIh1i8R71fQFAplDXo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768245715; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=wFWnMBGs3EqdkSFSl4jkxzAxcrQYjU8NeLny07qSBpY=; b=GvfHLPcC9g9BVFIFF1+BLTz7DzeNeG4odrI/K7cyq+3FmjD5s2LhgAnV1oqXejloB0GV1pHLqqorSWvz1QDID3roatKxCzA367W0VlkvVzKSNdYHEaSZ1ozgzVE2S+rE6DQwq+VeZYfY1luoIE/2iT1bfQUZi7LpLfFwJN6G/aA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1768245715161980.1845811375326; Mon, 12 Jan 2026 11:21:55 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id C84E33FBCA; Mon, 12 Jan 2026 14:21:53 -0500 (EST) Received: from [172.19.199.83] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 2F5EF4198E; Mon, 12 Jan 2026 14:20:41 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 9FCCA41864; Mon, 12 Jan 2026 14:20:32 -0500 (EST) Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 53FE03F366 for ; Mon, 12 Jan 2026 14:20:31 -0500 (EST) Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-64d30dc4ed7so13243404a12.0 for ; Mon, 12 Jan 2026 11:20:31 -0800 (PST) Received: from tulp.my.domain (2001-1c02-1a15-3000-c218-03ff-feb5-6cc4.cable.dynamic.v6.ziggo.nl. [2001:1c02:1a15:3000:c218:3ff:feb5:6cc4]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6507bf66214sm18095861a12.27.2026.01.12.11.20.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jan 2026 11:20:28 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768245630; x=1768850430; darn=lists.libvirt.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=wFWnMBGs3EqdkSFSl4jkxzAxcrQYjU8NeLny07qSBpY=; b=LovWYD+GK6c2ppgT+CdeDFpooUcmMDO2NHdjtLp7RztoSnwpvw3HdfsJ0NAlX2OexE uzLCF1Ou+OF7/IC8YjM+6xMiItgd6sICvytKGmHWzGrpHnRMLDCKdXEBxUFVXkjbYcUA XgN8PNeuHbQoNWWqkELvKawoRxMxDF/QpOeqhyFVZmiFb+ZHaukYpf3rv0W4kGvWDOBj VLFMkQeE1W6XPqgeF411/PtnWeoaY8l1POzwaL+30NhkYPzkwFOA8nCUntwkWvyw8rd3 BZ6JgfK8euvx9V8lIVwyVYj2BFOKKa02eSvMqBSwyL5LoQyDUPlRlJON/xqOp89M9v77 GnTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768245630; x=1768850430; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wFWnMBGs3EqdkSFSl4jkxzAxcrQYjU8NeLny07qSBpY=; b=hl+A7hDRtUza/VMri8U6l1eLqBrTF76uCCK0979lxUJbjXD78Kd3c41rhs1WO/oaHe 0TAbANaWT6Ra1lYE8r7iECSow1ygKx+bNsBgbjw6e+TiF+a3/l/wSl6a7AjcdZduXS2r QPmsacTLJrRetSx90dqIQeoL17MNcWFGVKwa3zVXMthIYGZQqkABBRhCE1C3Pz4vUgc6 iHwQUaFTqaOI7tNPTfYFq6D0DRUVYcaXN3eNEi0F2+NoCVVWJmqoc2O0+W3dVwAjAZSh yXYUMrhiuggDyI9J87EOuin6s0ddbMi8uxdMZog/JITVGnpug55O5ANqmnYl9Mfe1UMu mynQ== X-Gm-Message-State: AOJu0YwN5iwSdFQSCZq9QeSQvxXFW89KFfJj06Rm8VZ2v2fxl+TrkY73 P2jZfjFcjYQgSU+6pgp3KF/4dLVt/rOtZ6MNth7MtVEbncPjOhavLAasJbBHIdLV X-Gm-Gg: AY/fxX7pCtD6V4xFDkBGqt9978vdhkiIRWHGO6FjxR5QLrcYVknY+XNQuiDM3IMekup 2QGBvTIMIoWtby8EYKsUvMr9Wij9Am4CI0cP7vDn/SyEqket89Z8gwIlbZKigmnvINR3HVcJPmw Uym5t66aR+GdUaUJ8di6pI/UUo7fgaJnJwtnifjywhskkzymSx8bmdUUsQz9SszTy2D6ZgBqYXd XvIT5Ty9heOWnZSvzjYa/cieB/gCoIopwPZSkYwGwBuBRPbhGbjjPTOpyGcOpeuN2dBhbF7yr+i yqtVHPv8rHtN6M5Rh3wDhFdYXDtoVfChuhM2VlTLGXu4f/+Mx7TdPXK84VM2rQbUvgYGwjL4XQB fXHmcVzJ2mFpm6sbGSapqtewq6zXmRKPUQFFzL7uMufm4A+20QsePeARINpdHkvysIv0xqc/wpa fFD43L8zPdu/QVdUCgbu1HB7LINgLXRYYJuebTPyPb9qTfoNSMV2adiPBVIngxWhIFCPwjgEr18 vfPMMP4UyWFUbmtShhqxV4G X-Google-Smtp-Source: AGHT+IECRbQgTPqg7P9n5EAMbncS6OkqK0Y1i7umP/UfYhSTrvPRns+1ngvSonIMBkDKWW3uZwENPQ== X-Received: by 2002:a05:6402:430c:b0:64c:e9b6:14d6 with SMTP id 4fb4d7f45d1cf-65097e6c2e1mr17867426a12.25.1768245629325; Mon, 12 Jan 2026 11:20:29 -0800 (PST) From: Roman Bogorodskiy To: devel@lists.libvirt.org Subject: [PATCH] qemu: introduce the "virtualization" feature Date: Mon, 12 Jan 2026 20:17:15 +0100 Message-ID: <20260112191715.95917-1-bogorodskiy@gmail.com> X-Mailer: git-send-email 2.52.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: YEXWGGNZ4T7RBBRIHGAL5VPLDZQPJIDX X-Message-ID-Hash: YEXWGGNZ4T7RBBRIHGAL5VPLDZQPJIDX X-MailFrom: bogorodskiy@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Roman Bogorodskiy X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1768245719332158500 Content-Type: text/plain; charset="utf-8" The "virt" board in QEMU has a "virtualization" option that is documented like this: virtualization Set ``on``/``off`` to enable/disable emulating a guest CPU which implemen= ts the Arm Virtualization Extensions. The default is ``off``. (from system/arm/virt.rst) According to the documentation, the "virtualiaztion" option is related to the "gic-version" option. Specifically, gic version=3D4 requires virtualization to be enabled. And gic version=3Dmax will use version=3D4 when virtualization is enabled, and 3 when not. Libvirt does not currently model neither gic version "3" nor "max" though. It is also documented for the "vexpress-a(9|15)" boards, where it is also disabled by default: - QEMU defaults to providing a CPU which does not provide either TrustZone or the Virtualization Extensions: if you want these you must enable them with ``-machine secure=3Don`` and ``-machine virtualization=3Don`` (system/arm/vexpress.rst). On the command line it looks like: qemu-system-aarch64 -machine type=3Dvirt,virtualization=3Don .. Model it using the "virtualization" element in the "features" section: Signed-off-by: Roman Bogorodskiy Reviewed-by: Michal Privoznik --- docs/formatdomain.rst | 4 ++ src/conf/domain_conf.c | 4 ++ src/conf/domain_conf.h | 1 + src/conf/schemas/domaincommon.rng | 5 +++ src/qemu/qemu_command.c | 9 ++++ src/qemu/qemu_validate.c | 1 + ...64-virt-virtualization.aarch64-latest.args | 38 ++++++++++++++++ ...h64-virt-virtualization.aarch64-latest.xml | 45 +++++++++++++++++++ .../aarch64-virt-virtualization.xml | 25 +++++++++++ tests/qemuxmlconftest.c | 2 + 10 files changed, 134 insertions(+) create mode 100644 tests/qemuxmlconfdata/aarch64-virt-virtualization.aarch= 64-latest.args create mode 100644 tests/qemuxmlconfdata/aarch64-virt-virtualization.aarch= 64-latest.xml create mode 100644 tests/qemuxmlconfdata/aarch64-virt-virtualization.xml diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 04ef319a73..ad74d91950 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -2378,6 +2378,10 @@ are: one IMSIC device present per core), or ``none`` (no support for AIA). If the attribute is not defined, the hypervisor default will be used. :since:`Since 11.1.0` (QEMU/KVM and RISC-V guests only) +``virtualization`` + Enable emulating a guest CPU which implements the Arm Virtualization Ex= tensions. + If the attribute is not defined, the hypervisor default will be used. + :since:`Since 12.1.0` (QEMU/KVM and ARM virt guests only) =20 Time keeping ------------ diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9ca5c2450c..1a8c5cb5b7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -188,6 +188,7 @@ VIR_ENUM_IMPL(virDomainFeature, "ras", "ps2", "aia", + "virtualization", ); =20 VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, @@ -17480,6 +17481,7 @@ virDomainFeaturesDefParse(virDomainDef *def, case VIR_DOMAIN_FEATURE_PAE: case VIR_DOMAIN_FEATURE_VIRIDIAN: case VIR_DOMAIN_FEATURE_PRIVNET: + case VIR_DOMAIN_FEATURE_VIRTUALIZATION: def->features[val] =3D VIR_TRISTATE_SWITCH_ON; break; =20 @@ -21636,6 +21638,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDef = *src, case VIR_DOMAIN_FEATURE_CCF_ASSIST: case VIR_DOMAIN_FEATURE_RAS: case VIR_DOMAIN_FEATURE_PS2: + case VIR_DOMAIN_FEATURE_VIRTUALIZATION: if (src->features[i] !=3D dst->features[i]) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("State of feature '%1$s' differs: source:= '%2$s', destination: '%3$s'"), @@ -28867,6 +28870,7 @@ virDomainDefFormatFeatures(virBuffer *buf, case VIR_DOMAIN_FEATURE_PAE: case VIR_DOMAIN_FEATURE_VIRIDIAN: case VIR_DOMAIN_FEATURE_PRIVNET: + case VIR_DOMAIN_FEATURE_VIRTUALIZATION: /* NOTE: This is for old style booleans. New XML * should use the explicit state=3Don|off output below */ switch ((virTristateSwitch) def->features[i]) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index cb35ff06bd..d0f4c082fd 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2243,6 +2243,7 @@ typedef enum { VIR_DOMAIN_FEATURE_RAS, VIR_DOMAIN_FEATURE_PS2, VIR_DOMAIN_FEATURE_AIA, + VIR_DOMAIN_FEATURE_VIRTUALIZATION, =20 VIR_DOMAIN_FEATURE_LAST } virDomainFeature; diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index 114dd3f96f..8669d8f791 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -7180,6 +7180,11 @@ + + + + + diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 0de0a79b46..b410daf156 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7011,6 +7011,15 @@ qemuAppendDomainFeaturesMachineParam(virBuffer *buf, } } =20 + if (def->features[VIR_DOMAIN_FEATURE_VIRTUALIZATION] =3D=3D VIR_TRISTA= TE_SWITCH_ON) { + if (virQEMUCapsGetArch(qemuCaps) !=3D VIR_ARCH_AARCH64) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtualization option is not available with = this QEMU binary")); + return -1; + } + virBufferAddLit(buf, ",virtualization=3Don"); + } + if (def->features[VIR_DOMAIN_FEATURE_HTM] !=3D VIR_TRISTATE_SWITCH_ABS= ENT) { const char *str; str =3D virTristateSwitchTypeToString(def->features[VIR_DOMAIN_FEA= TURE_HTM]); diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 184c23d307..5474d00ecd 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -182,6 +182,7 @@ qemuValidateDomainDefFeatures(const virDomainDef *def, break; =20 case VIR_DOMAIN_FEATURE_GIC: + case VIR_DOMAIN_FEATURE_VIRTUALIZATION: if (def->features[i] =3D=3D VIR_TRISTATE_SWITCH_ON && !qemuDomainIsARMVirt(def)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, diff --git a/tests/qemuxmlconfdata/aarch64-virt-virtualization.aarch64-late= st.args b/tests/qemuxmlconfdata/aarch64-virt-virtualization.aarch64-latest.= args new file mode 100644 index 0000000000..be04ecc641 --- /dev/null +++ b/tests/qemuxmlconfdata/aarch64-virt-virtualization.aarch64-latest.args @@ -0,0 +1,38 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/var/lib/libvirt/qemu/domain--1-aarch64-virt-default \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/var/lib/libvirt/qemu/domain--1-aarch64-virt-default/.loca= l/share \ +XDG_CACHE_HOME=3D/var/lib/libvirt/qemu/domain--1-aarch64-virt-default/.cac= he \ +XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-aarch64-virt-default/.co= nfig \ +/usr/bin/qemu-system-aarch64 \ +-name guest=3Daarch64-virt-default-nic,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/va= r/lib/libvirt/qemu/domain--1-aarch64-virt-default/master-key.aes"}' \ +-machine virt,usb=3Doff,gic-version=3D2,virtualization=3Don,dump-guest-cor= e=3Doff,memory-backend=3Dmach-virt.ram,acpi=3Doff \ +-accel tcg \ +-cpu cortex-a53 \ +-m size=3D1048576k \ +-object '{"qom-type":"memory-backend-ram","id":"mach-virt.ram","size":1073= 741824}' \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 6ba410c5-1e5c-4d57-bee7-2228e7ffa32f \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-kernel /aarch64.kernel \ +-initrd /aarch64.initrd \ +-append console=3DttyAMA0 \ +-device '{"driver":"pcie-root-port","port":8,"chassis":1,"id":"pci.1","bus= ":"pcie.0","multifunction":true,"addr":"0x1"}' \ +-device '{"driver":"pcie-root-port","port":9,"chassis":2,"id":"pci.2","bus= ":"pcie.0","addr":"0x1.0x1"}' \ +-netdev '{"type":"user","id":"hostnet0"}' \ +-device '{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":= "52:54:00:09:a4:37","bus":"pci.1","addr":"0x0"}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxmlconfdata/aarch64-virt-virtualization.aarch64-late= st.xml b/tests/qemuxmlconfdata/aarch64-virt-virtualization.aarch64-latest.x= ml new file mode 100644 index 0000000000..7636046257 --- /dev/null +++ b/tests/qemuxmlconfdata/aarch64-virt-virtualization.aarch64-latest.xml @@ -0,0 +1,45 @@ + + aarch64-virt-default-nic + 6ba410c5-1e5c-4d57-bee7-2228e7ffa32f + 1048576 + 1048576 + 1 + + hvm + /aarch64.kernel + /aarch64.initrd + console=3DttyAMA0 + + + + + + + + cortex-a53 + + + destroy + restart + destroy + + /usr/bin/qemu-system-aarch64 + + + + +
+ + + + +
+ + + + +
+ +