linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Sebastian Ott <sebott@redhat.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Oliver Upton <oliver.upton@linux.dev>
Subject: Re: [PATCH 3/4] KVM: arm64: show writable masks for feature registers
Date: Tue, 19 Mar 2024 09:50:23 +0000	[thread overview]
Message-ID: <86msquzh28.wl-maz@kernel.org> (raw)
In-Reply-To: <356fc3d6-4129-f57f-055c-6a8e73e179e7@redhat.com>

On Mon, 18 Mar 2024 18:20:06 +0000,
Sebastian Ott <sebott@redhat.com> wrote:
> 
> On Mon, 18 Mar 2024, Marc Zyngier wrote:
> > On Mon, 18 Mar 2024 11:16:35 +0000,
> > Sebastian Ott <sebott@redhat.com> wrote:
> >> 
> >> Instead of using ~0UL provide the actual writable mask for
> >> non-id feature registers in the output of the
> >> KVM_ARM_GET_REG_WRITABLE_MASKS ioctl.
> > 
> > CTR_EL0 definitely seems to be in the feature ID range. And so does
> > CLIDR_EL1.
> 
> Sry, bad wording. I mean feature id regs for which is_id_reg() is false.
>

Maybe this means that we should revisit the range delineated by
is_id_reg().

> >> 
> >> This changes the mask for the CTR_EL0 register.
> > 
> > Only that?
> 
> Yes.

The patch shows otherwise, I'm afraid.

> 
> >> Signed-off-by: Sebastian Ott <sebott@redhat.com>
> >> ---
> >>  arch/arm64/kvm/sys_regs.c | 21 ++++++---------------
> >>  1 file changed, 6 insertions(+), 15 deletions(-)
> >> 
> >> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> >> index b2019faa9d73..0f8fe7790c35 100644
> >> --- a/arch/arm64/kvm/sys_regs.c
> >> +++ b/arch/arm64/kvm/sys_regs.c
> >> @@ -2489,12 +2489,12 @@ static const struct sys_reg_desc sys_reg_descs[] = {
> >> 
> >>  	{ SYS_DESC(SYS_CCSIDR_EL1), access_ccsidr },
> >>  	{ SYS_DESC(SYS_CLIDR_EL1), access_clidr, reset_clidr, CLIDR_EL1,
> >> -	  .set_user = set_clidr },
> >> +	  .set_user = set_clidr, .val = ~0UL },
> > 
> > How is CLIDR_EL1 (and all the crap that depend on it) recomputed when
> > CTR_EL0 is changed?
> 
> Do we have means to handle dependencies here? There is no natural order
> in which userspace is writing to these regs. Nor a good time or a trigger
> when the kernel should do a sanity/dependency check..

Well, we're not going to run the guest with something that describes
an inconsistent topology either, so this is the very first thing that
needs to be solved.

Either by restoring acceptable defaults when the topology changes due
to a write to CTR_EL0, or by returning an error to userspace if the
cache topology has been restored but CTR_EL0 is incompatible with it.

	M.

-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2024-03-19  9:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-18 11:16 [RFC] [PATCH 0/4] KVM: arm64: emulation for CTR_EL0 Sebastian Ott
2024-03-18 11:16 ` [PATCH 1/4] KVM: arm64: add emulation for CTR_EL0 register Sebastian Ott
2024-03-18 11:45   ` Marc Zyngier
2024-03-18 11:16 ` [PATCH 2/4] KVM: arm64: ensure guest access to CTR_EL0 is trapped Sebastian Ott
2024-03-18 11:47   ` Marc Zyngier
2024-03-18 11:16 ` [PATCH 3/4] KVM: arm64: show writable masks for feature registers Sebastian Ott
2024-03-18 12:03   ` Marc Zyngier
2024-03-18 18:20     ` Sebastian Ott
2024-03-19  9:50       ` Marc Zyngier [this message]
2024-03-18 18:22     ` Sebastian Ott
2024-03-18 11:16 ` [PATCH 4/4] KVM: selftests: aarch64: add tool to dump registers Sebastian Ott
2024-03-18 15:24 ` [RFC] [PATCH 0/4] KVM: arm64: emulation for CTR_EL0 Marc Zyngier

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=86msquzh28.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=oliver.upton@linux.dev \
    --cc=sebott@redhat.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).