From: "Alex Bennée" <alex.bennee@linaro.org>
To: Mohamed Mediouni <mohamed@unpredictable.fr>
Cc: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH v2] target/arm: implement FEAT_E2H0
Date: Thu, 05 Feb 2026 20:57:29 +0000 [thread overview]
Message-ID: <87sebenc1y.fsf@draig.linaro.org> (raw)
In-Reply-To: <10F9A8B0-27FD-40B3-9299-E27883823423@unpredictable.fr> (Mohamed Mediouni's message of "Thu, 5 Feb 2026 14:02:26 +0100")
Mohamed Mediouni <mohamed@unpredictable.fr> writes:
>> On 5. Feb 2026, at 13:23, Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>> Richard Henderson <richard.henderson@linaro.org> writes:
>>
>>> On 2/4/26 23:13, Alex Bennée wrote:
>>>> FEAT_E2H0 is a formalisation of the existing behaviour of HCR_EL2.E2H
>>>> being programmable to switch between EL2 host mode and the
>>>> "traditional" nVHE EL2 mode. This implies at some point we might want
>>>> to model CPUs without FEAT_E2H0 which will always have EL2 host mode
>>>> enabled.
>>>> There are two values to represent no E2H0 systems of which 0b1110
>>>> will
>>>> make HCR_EL2.NV1 RES0 for FEAT_NV systems. For FEAT_NV2 the NV1 bit is
>>>> always valid.
>>>> Message-ID: <20260130181648.628364-1-alex.bennee@linaro.org>
>>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>>> ---
>>>> v2
>>>> - new helper and properly handling NV1
>>>> ---
>> <snip>
>>>
>>>> @@ -3801,10 +3802,13 @@ static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask)
>>>> valid_mask |= HCR_GPF;
>>>> }
>>>> if (cpu_isar_feature(aa64_nv, cpu)) {
>>>> - valid_mask |= HCR_NV | HCR_NV1 | HCR_AT;
>>>> + valid_mask |= HCR_NV | HCR_AT;
>>>> + if (!cpu_isar_feature(aa64_noe2h0_and_nv1_res0, cpu)) {
>>>> + valid_mask |= HCR_NV1;
>>>> + }
>>>> }
>>>> if (cpu_isar_feature(aa64_nv2, cpu)) {
>>>> - valid_mask |= HCR_NV2;
>>>> + valid_mask |= HCR_NV1 | HCR_NV2;
>>>
>>> Why add NV1 here?
>>
>> My reading was if you had FEAT_NV2 then HCR_NV1 was always valid
>> whatever E2H0 might say. Unless we can validate we don't get
>> contradictory ID values elsewhere?
> KVM with nested virt enabled out of the box exposes a virtual machine with
> VHE-only L1 and above, with no allowance for an nVHE nested guest past L1.
>
> In the Linux kernel in arch/arm64/kvm/nested.c:
>
> case SYS_ID_AA64MMFR4_EL1:
> /*
> * You get EITHER
> *
> * - FEAT_VHE without FEAT_E2H0
> * - FEAT_NV limited to FEAT_NV2
> * - HCR_EL2.NV1 being RES0
> *
> * OR
> *
> * - FEAT_E2H0 without FEAT_VHE nor FEAT_NV
> *
> * Life is too short for anything else.
> */
This is a choice a host can make to simplify things but we want to make
sure we could represent hardware that makes a different choice.
>
> And after taking a further look at the machine readable spec*, 0b1110 is valid together
> with FEAT_NV2, as nothing there says otherwise.
>
> *
> https://developer.arm.com/Architectures/A-Profile%20Architecture#Downloads
Is this from the XML or the registers description?
>>
>>
>> --
>> Alex Bennée
>> Virtualisation Tech Lead @ Linaro
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
prev parent reply other threads:[~2026-02-05 20:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-04 13:13 [PATCH v2] target/arm: implement FEAT_E2H0 Alex Bennée
2026-02-04 15:55 ` Mohamed Mediouni
2026-02-04 21:43 ` Richard Henderson
2026-02-05 12:23 ` Alex Bennée
2026-02-05 13:02 ` Mohamed Mediouni
2026-02-05 20:57 ` Alex Bennée [this message]
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=87sebenc1y.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=mohamed@unpredictable.fr \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.