From: Andre Przywara <andre.przywara@arm.com>
To: Will Deacon <will@kernel.org>,
Julien Thierry <julien.thierry.kdev@gmail.com>
Cc: maz@kernel.org, Sascha Bischoff <Sascha.Bischoff@arm.com>,
kvm@vger.kernel.org, kvmarm@lists.linux.dev,
Alexandru Elisei <alexandru.elisei@arm.com>
Subject: [PATCH kvmtool v7 4/6] arm64: Add FEAT_E2H0 support
Date: Mon, 23 Mar 2026 17:47:15 +0100 [thread overview]
Message-ID: <20260323164717.2571585-5-andre.przywara@arm.com> (raw)
In-Reply-To: <20260323164717.2571585-1-andre.przywara@arm.com>
From: Marc Zyngier <maz@kernel.org>
The --nested option allows a guest to boot at EL2 without FEAT_E2H0
(i.e. mandating VHE support). While this is great for "modern" operating
systems and hypervisors, a few legacy guests are stuck in a distant past.
To support those, add the --e2h0 command line option, that exposes
FEAT_E2H0 to the guest, at the expense of a number of other features, such
as FEAT_NV2. This is conditioned on the host itself supporting FEAT_E2H0.
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Sascha Bischoff <sascha.bischoff@arm.com>
---
arm64/include/kvm/kvm-config-arch.h | 5 ++++-
arm64/kvm-cpu.c | 5 +++++
arm64/kvm.c | 3 +++
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/arm64/include/kvm/kvm-config-arch.h b/arm64/include/kvm/kvm-config-arch.h
index 44c43367..73bf4211 100644
--- a/arm64/include/kvm/kvm-config-arch.h
+++ b/arm64/include/kvm/kvm-config-arch.h
@@ -11,6 +11,7 @@ struct kvm_config_arch {
bool has_pmuv3;
bool mte_disabled;
bool nested_virt;
+ bool e2h0;
u64 kaslr_seed;
enum irqchip_type irqchip;
u64 fw_addr;
@@ -63,6 +64,8 @@ int sve_vl_parser(const struct option *opt, const char *arg, int unset);
OPT_U64('\0', "counter-offset", &(cfg)->counter_offset, \
"Specify the counter offset, defaulting to 0"), \
OPT_BOOLEAN('\0', "nested", &(cfg)->nested_virt, \
- "Start VCPUs in EL2 (for nested virt)"),
+ "Start VCPUs in EL2 (for nested virt)"), \
+ OPT_BOOLEAN('\0', "e2h0", &(cfg)->e2h0, \
+ "Create guest without VHE support"),
#endif /* ARM_COMMON__KVM_CONFIG_ARCH_H */
diff --git a/arm64/kvm-cpu.c b/arm64/kvm-cpu.c
index 42dc11da..5e4f3a7d 100644
--- a/arm64/kvm-cpu.c
+++ b/arm64/kvm-cpu.c
@@ -76,6 +76,11 @@ static void kvm_cpu__select_features(struct kvm *kvm, struct kvm_vcpu_init *init
if (!kvm__supports_extension(kvm, KVM_CAP_ARM_EL2))
die("EL2 (nested virt) is not supported");
init->features[0] |= 1UL << KVM_ARM_VCPU_HAS_EL2;
+ if (kvm->cfg.arch.e2h0) {
+ if (!kvm__supports_extension(kvm, KVM_CAP_ARM_EL2_E2H0))
+ die("FEAT_E2H0 is not supported");
+ init->features[0] |= 1UL << KVM_ARM_VCPU_HAS_EL2_E2H0;
+ }
}
}
diff --git a/arm64/kvm.c b/arm64/kvm.c
index 6e971dd7..4ce24933 100644
--- a/arm64/kvm.c
+++ b/arm64/kvm.c
@@ -440,6 +440,9 @@ void kvm__arch_validate_cfg(struct kvm *kvm)
kvm->cfg.ram_addr + kvm->cfg.ram_size > SZ_4G) {
die("RAM extends above 4GB");
}
+
+ if (kvm->cfg.arch.e2h0 && !kvm->cfg.arch.nested_virt)
+ pr_warning("--e2h0 requires --nested, ignoring");
}
u64 kvm__arch_default_ram_address(void)
--
2.43.0
next prev parent reply other threads:[~2026-03-23 16:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 16:47 [PATCH kvmtool v7 0/6] arm64: Nested virtualization support Andre Przywara
2026-03-23 16:47 ` [PATCH kvmtool v7 1/6] arm64: Initial nested virt support Andre Przywara
2026-03-23 16:47 ` [PATCH kvmtool v7 2/6] arm64: nested: Add support for setting maintenance IRQ Andre Przywara
2026-04-07 13:47 ` Sascha Bischoff
2026-03-23 16:47 ` [PATCH kvmtool v7 3/6] arm64: Add counter offset control Andre Przywara
2026-03-23 16:47 ` Andre Przywara [this message]
2026-03-23 16:47 ` [PATCH kvmtool v7 5/6] arm64: Generate HYP timer interrupt specifiers Andre Przywara
2026-03-23 16:47 ` [PATCH kvmtool v7 6/6] arm64: Handle virtio endianness reset when running nested Andre Przywara
2026-04-07 13:49 ` Sascha Bischoff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260323164717.2571585-5-andre.przywara@arm.com \
--to=andre.przywara@arm.com \
--cc=Sascha.Bischoff@arm.com \
--cc=alexandru.elisei@arm.com \
--cc=julien.thierry.kdev@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox