From: Richard Henderson <richard.henderson@linaro.org>
To: Zenghui Yu <yuzenghui@huawei.com>,
qemu-devel@nongnu.org, qemu-arm@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
kernel.yuz@gmail.com, wanghaibin.wang@huawei.com
Subject: Re: [Q] arm: SVE accesses at EL0 is broken with E2H+TGE?
Date: Wed, 26 Jan 2022 09:08:23 +1100 [thread overview]
Message-ID: <138138f3-3fd3-b685-1492-060eda777f91@linaro.org> (raw)
In-Reply-To: <6cdfd5de-2465-adca-73b3-9c66945cf18a@huawei.com>
On 1/13/22 2:03 PM, Zenghui Yu wrote:
> Hi,
>
> I've just exercised the SVE emulation in QEMU with
>
> | `qemu-system-aarch64 -M virt,virtualization=on,gic-version=3 \
> | -cpu max -accel tcg [...]`
>
> Since QEMU sets ID_AA64MMFR1_EL1.VH for -cpu max, the Linux guest I use
> was booting with VHE enabled and running with E2H+TGE. But I've then
> seen the Linux sve-probe-vls selftest [1] failure in guest which runs at
> EL0 and can be described as:
>
> 1) Call prctl(PR_SVE_SET_VL, vl == 64) to set the vector length.
> 2) Emit RDVL instruction **but** get vl == 16. Emmm..
>
> Looking a bit further at the way we emulate SVE in QEMU, there might be
> some issues need to be addressed.
>
> * sve_zcr_len_for_el() implementation
>
> Per DDI 0584 B.a, when HCR_EL2.{E2H,TGE} == {1,1} and EL2 is enabled in
> the current Security state, ZCR_EL1 has no effect on execution at EL0.
> We should use ZCR_EL2 instead for E2H+TGE.
>
> * CPTR_EL2 register accessors
>
> CPTR_EL2 has diffrent layout with or without VHE, but looks like we only
> take the nVHE one into account. Take sve_exception_el(env, el == 0) as
> an example, we don't check CPTR_EL2.ZEN for EL0 SVE accesses and we will
> never generate an exception even if needed...
>
> ... whilst Linux kernel indeed relies on a trap to EL2 to restore SVE
> context appropriately for userland. SVE accesses at EL0 is broken in
> that case, I guess?
Correct on both. Thanks for the detailed report.
r~
prev parent reply other threads:[~2022-01-25 22:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-13 3:03 [Q] arm: SVE accesses at EL0 is broken with E2H+TGE? Zenghui Yu via
2022-01-25 22:08 ` Richard Henderson [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=138138f3-3fd3-b685-1492-060eda777f91@linaro.org \
--to=richard.henderson@linaro.org \
--cc=kernel.yuz@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=wanghaibin.wang@huawei.com \
--cc=yuzenghui@huawei.com \
/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;
as well as URLs for NNTP newsgroup(s).