From: Zenghui Yu <zenghui.yu@linux.dev>
To: Alexander Graf <agraf@csgraf.de>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org,
peter.maydell@linaro.org, wanghaibin.wang@huawei.com
Subject: Re: [PATCH] hvf: arm: Fix encodings for ID_AA64PFR1_EL1 and debug System registers
Date: Sun, 5 May 2024 22:31:54 +0800 [thread overview]
Message-ID: <960d6344-4aa5-4644-ba97-a06d21f4ead8@linux.dev> (raw)
In-Reply-To: <f0c19830-d4e0-4585-b960-7dd3fa1a3c76@csgraf.de>
On 2024/5/5 21:18, Alexander Graf wrote:
>
> On 03.05.24 19:34, Zenghui Yu wrote:
>> We wrongly encoded ID_AA64PFR1_EL1 using {3,0,0,4,2} in
>> hvf_sreg_match[] so
>> we fail to get the expected ARMCPRegInfo from cp_regs hash table with the
>> wrong key.
>>
>> Fix it with the correct encoding {3,0,0,4,1}. With that fixed, the Linux
>> guest can properly detect FEAT_SSBS2 on my M1 HW.
>>
>> All DBG{B,W}{V,C}R_EL1 registers are also wrongly encoded with op0 == 14.
>> It happens to work because HVF_SYSREG(CRn, CRm, 14, op1, op2) equals to
>> HVF_SYSREG(CRn, CRm, 2, op1, op2), by definition. But we shouldn't
>> rely on
>> it.
>>
>> Fixes: a1477da3ddeb ("hvf: Add Apple Silicon support")
>> Signed-off-by: Zenghui Yu <zenghui.yu@linux.dev>
>
>
> Nice catch! Did you find them only because of functional issues or have
> you taken an automated pass somehow to validate the sysreg definitions
> are correct?
Neither, this was found by code inspection. I was just curious about how
VMM would interact with hypervisor to expose features to the guest. Docs
at https://developer.apple.com/documentation/hypervisor are not that
detailed (I may need to read further ;-) ).
P.S., I verified on M1 that ID_AA64PFR1_EL1 is 0x20 at
hvf_arm_get_host_cpu_features() stage and is overwritten as 0x0 later
w/o this patch, which indicates the (guest visible) feature ID registers
are "writable" to some extent.
> Reviewed-by: Alexander Graf <agraf@csgraf.de>
Thanks!
Zenghui
next prev parent reply other threads:[~2024-05-05 14:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-03 15:34 [PATCH] hvf: arm: Fix encodings for ID_AA64PFR1_EL1 and debug System registers Zenghui Yu
2024-05-05 13:18 ` Alexander Graf
2024-05-05 14:31 ` Zenghui Yu [this message]
2024-05-05 13:38 ` Marcin Juszkiewicz
2024-05-07 9:43 ` Peter Maydell
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=960d6344-4aa5-4644-ba97-a06d21f4ead8@linux.dev \
--to=zenghui.yu@linux.dev \
--cc=agraf@csgraf.de \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=wanghaibin.wang@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 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.