Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Fuad Tabba <fuad.tabba@linux.dev>
Cc: Oliver Upton <oupton@kernel.org>,
	kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	Joey Gouly <joey.gouly@arm.com>,
	Steffen Eiden <seiden@linux.ibm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Mark Brown <broonie@kernel.org>, Lorenzo Stoakes <ljs@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] KVM: arm64: Only enable S1PIE and S1POE with the features they imply
Date: Mon, 19 Oct 2026 08:31:18 +0100	[thread overview]
Message-ID: <861p9m1709.wl-maz@kernel.org> (raw)
In-Reply-To: <CA+EHjTwHP7h_=e1s-iCDekMNvHGAQA3K1zv5v_4=PXQw9ueiFg@mail.gmail.com>

On Sun, 18 Oct 2026 19:52:35 +0100,
Fuad Tabba <fuad.tabba@linux.dev> wrote:
> 
> Hi Marc,
> 
> On Sun, 18 Oct 2026 18:37:37 +0100, Marc Zyngier <maz@kernel.org> wrote:
> [...]
> > I'm afraid that this only addresses part of the problem. Ultimately,
> > the idregs themselves require some sanitisation because KVM uses this
> > as the source of truth. I was pointing this in my reply to Broonie,
> > and this is (probably) what sashiko is blabbing on about.
> 
> It seems so. The trap tables were only one of the places that read
> S1PIE and S1POE. Sashiko found another: PIR_EL2, PIRE0_EL2 and POR_EL2
> accessed from vEL2 have no FGT bit, so accesses to them reached the
> hardware registers.
> 
> > I hacked something that could be used as the bases for such
> > sanitisation, although it is quite crude and doesn't cover all of the
> > possible requirements, see below. I've only boot-tested it in a nested
> > guest, and I'm not even sure it actually works (my test box doesn't
> > have these features).
> 
> I'll send your patch as v3, rebased on -rc3 with you as the author,

Please at least add yourself as a co-author.

> once I've tested it. I'm dropping v2's trap table changes, since
> they're redundant once the ID registers are sanitised. I made two
> changes to your patch. The sanitisation now runs before
> kvm_init_nv_sysregs(), so the nested RESx masks are computed from the
> sanitised values.

Isn't that already the case? At least with kvmarm-7.4,
kvm_vm_finalize_sys_regs() is called before kvm_init_nv_sysregs().

> I dropped the res1 half, which isn't set by anything.

I'd like to keep this, as it will eventually get used, just like the
recompute loop is a bit useless for now, but will become useful in the
future as dependencies get recomputed.

The way I imagine this to work is that each sanitised field entry will
point to a subtable containing the encoding of the field and the a
function that checks for the dependency. That's not required for now,
as S1P[IO]E is only a boolean, but I expect some features to
eventually need something more fine-grained.

Thanks,

	M.

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


  reply	other threads:[~2026-10-19  7:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-18  8:09 [PATCH v2] KVM: arm64: Only enable S1PIE and S1POE with the features they imply Fuad Tabba
2026-10-18 17:37 ` Marc Zyngier
2026-10-18 18:52   ` Fuad Tabba
2026-10-19  7:31     ` Marc Zyngier [this message]
2026-10-19  8:49       ` Fuad Tabba

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=861p9m1709.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=fuad.tabba@linux.dev \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=oupton@kernel.org \
    --cc=seiden@linux.ibm.com \
    --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