From: Miguel Luis <miguel.luis@oracle.com>
To: Marc Zyngier <maz@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Oliver Upton <oliver.upton@linux.dev>,
James Morse <james.morse@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kvmarm@lists.linux.dev" <kvmarm@lists.linux.dev>
Subject: Re: [PATCH 3/3] KVM: arm64: nv: Handle all _EL02 and _EL12 registers
Date: Mon, 18 Sep 2023 12:41:45 +0000 [thread overview]
Message-ID: <4A24B4EC-B221-48B6-BA91-DB7AC72CAA8D@oracle.com> (raw)
In-Reply-To: <867conerys.wl-maz@kernel.org>
Hi Marc,
> On 18 Sep 2023, at 09:44, Marc Zyngier <maz@kernel.org> wrote:
>
> On Wed, 13 Sep 2023 19:52:08 +0100,
> Miguel Luis <miguel.luis@oracle.com> wrote:
>>
>> Specify both _EL02 and _EL12 system registers.
>>
>> Signed-off-by: Miguel Luis <miguel.luis@oracle.com>
>> ---
>> arch/arm64/kvm/emulate-nested.c | 35 +++++++++++++++++++++++++++++----
>> 1 file changed, 31 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/arm64/kvm/emulate-nested.c b/arch/arm64/kvm/emulate-nested.c
>> index 9aa1c06abdb7..957afd97e488 100644
>> --- a/arch/arm64/kvm/emulate-nested.c
>> +++ b/arch/arm64/kvm/emulate-nested.c
>> @@ -690,10 +690,37 @@ static const struct encoding_to_trap_config encoding_to_cgt[] __initconst = {
>> SR_RANGE_TRAP(sys_reg(3, 4, 14, 0, 3),
>> sys_reg(3, 4, 14, 5, 2), CGT_HCR_NV),
>> /* All _EL02, _EL12 registers */
>> - SR_RANGE_TRAP(sys_reg(3, 5, 0, 0, 0),
>> - sys_reg(3, 5, 10, 15, 7), CGT_HCR_NV),
>> - SR_RANGE_TRAP(sys_reg(3, 5, 12, 0, 0),
>> - sys_reg(3, 5, 14, 15, 7), CGT_HCR_NV),
>> + SR_TRAP(SYS_SCTLR_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_CPACR_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_SCTLR2_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_ZCR_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_TRFCR_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_SMCR_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_TTBR0_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_TTBR1_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_TCR_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_TCR2_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_SPSR_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_ELR_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_AFSR0_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_AFSR1_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_ESR_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_TFSR_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_FAR_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_BRBCR_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_PMSCR_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_MAIR_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_AMAIR_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_VBAR_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_CONTEXTIDR_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_SCXTNUM_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_CNTKCTL_EL12, CGT_HCR_NV),
>> + SR_TRAP(SYS_CNTP_TVAL_EL02, CGT_HCR_NV),
>> + SR_TRAP(SYS_CNTP_CTL_EL02, CGT_HCR_NV),
>> + SR_TRAP(SYS_CNTP_CVAL_EL02, CGT_HCR_NV),
>> + SR_TRAP(SYS_CNTV_TVAL_EL02, CGT_HCR_NV),
>> + SR_TRAP(SYS_CNTV_CTL_EL02, CGT_HCR_NV),
>> + SR_TRAP(SYS_CNTV_CVAL_EL02, CGT_HCR_NV),
>> SR_TRAP(OP_AT_S1E2R, CGT_HCR_NV),
>> SR_TRAP(OP_AT_S1E2W, CGT_HCR_NV),
>> SR_TRAP(OP_AT_S12E1R, CGT_HCR_NV),
>
> While I could see the problem with the EL2 registers, I'm not
> convinced by this patch. Is there an actual case for non _EL02, non
> _EL12 registers that are included in the two ranges above?
>
Having DDI0487Ja as reference, there is none. It is not clear to me having two
separate ranges. If it is to cover _EL02 and _EL12 ranges separately then the
second range is covering both aliases. I couldn't find the reason for these
aliases start and end other than SYS_SCTLR_EL12 and SYS_CNTV_CVAL_EL02,
respectively.
Thanks
Miguel
> Thanks,
>
> M.
>
> --
> Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2023-09-18 12:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-13 18:52 [PATCH 0/3] Fine grain sysregs allowed to trap for nested virtualization Miguel Luis
2023-09-13 18:52 ` [PATCH 1/3] arm64: Add missing _EL12 encodings Miguel Luis
2023-09-13 18:52 ` [PATCH 2/3] arm64/kvm: Fine grain _EL2 system registers list that affect nested virtualization Miguel Luis
2023-09-18 9:40 ` Marc Zyngier
2023-09-19 14:54 ` Miguel Luis
2023-09-19 16:31 ` Marc Zyngier
2023-09-13 18:52 ` [PATCH 3/3] KVM: arm64: nv: Handle all _EL02 and _EL12 registers Miguel Luis
2023-09-18 9:44 ` Marc Zyngier
2023-09-18 12:41 ` Miguel Luis [this message]
2023-09-18 12:56 ` Marc Zyngier
2023-09-25 11:04 ` Miguel Luis
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=4A24B4EC-B221-48B6-BA91-DB7AC72CAA8D@oracle.com \
--to=miguel.luis@oracle.com \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--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).