mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Sasha Levin <sashal@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>, Oliver Upton <oupton@kernel.org>,
	Fuad Tabba <fuad.tabba@linux.dev>,
	Joey Gouly <joey.gouly@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Steffen Eiden <seiden@linux.ibm.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Sean Christopherson <seanjc@google.com>,
	Shuah Khan <shuah@kernel.org>,
	"Lorenzo Stoakes (ARM)" <ljs@kernel.org>,
	Itaru Kitayama <itaru.kitayama@fujitsu.com>,
	linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
	kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: arm64: selftests: Skip ignored AArch32 ID regs in the failed-run test
Date: Sun, 25 Oct 2026 21:48:10 +0000	[thread overview]
Message-ID: <at55GhnsD67k2Xkg@sirena.co.uk> (raw)
In-Reply-To: <20261024161118.1007472-1-sashal@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 2074 bytes --]

On Sat, Oct 24, 2026 at 12:11:18PM -0400, Sasha Levin wrote:

> An ignored write leaves the register unchanged, so the ID registers are
> still immutable and only the test's expectation is wrong. Skip the
> AArch32 ID registers that KVM_ARM_GET_REG_WRITABLE_MASKS reports as not
> writable for this VM, which is decided by the same
> kvm_supports_32bit_el0() check as the write path. The aarch64_only flag

Another approach if we're going to change the test would be to have the
test support WI registers like the kernel does and also accept a
successful write that does not change the value, as you say this is also
maintaining immutability.  Doing that would handle anything else that
gets made WI.

> This does not change the AArch32 ID register readback issue under nested
> virtualization that Itaru reported:
> https://lore.kernel.org/all/as8x38o9taXgKZym@sm-arm-grace07/

It's been reported by a bunch of people, including me with the test
fixup that Itaru was mentioning.  It does seem like if we're going to
fix this in the test we should fix all the instances rather than just
one, or we should just fix the kernel like Marc previously requested
(given that we've just stepped on the same landmine...).

> +		/*
> +		 * KVM ignores writes to the AArch32 ID registers when it can't
> +		 * expose AArch32 EL0, and reports them as not writable.
> +		 */
> +		if (sys_reg_CRm(reg_id) < 4 && !masks[encoding_to_range_idx(reg_id)])
> +			continue;
> +
> +		val = vcpu_get_reg(vcpu, reg);

This is checking for AArch32 AFAICT because we're currently seeing
issues due to the lack of AArch32 making the registers WI but one would
expect the same issue to recur for any other ID registers which we end
up doing the same thing for.  If we're going to do this shouldn't we
just check for writability?  Adding the check for AAarch32 as well seems
to have the same papering over the cracks concern that Marc raised.

If writes are being accepted to things reported as unwritable at all
that seems like a separate issue to the finalization, we should test for
that separately.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

      parent reply	other threads:[~2026-10-25 21:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-24 16:11 Sasha Levin
2026-10-25  8:34 ` Fuad Tabba
2026-10-25 21:48 ` Mark Brown [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=at55GhnsD67k2Xkg@sirena.co.uk \
    --to=broonie@kernel.org \
    --cc=fuad.tabba@linux.dev \
    --cc=itaru.kitayama@fujitsu.com \
    --cc=joey.gouly@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=sashal@kernel.org \
    --cc=seanjc@google.com \
    --cc=seiden@linux.ibm.com \
    --cc=shuah@kernel.org \
    --cc=suzuki.poulose@arm.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

all inboxes | Powered by JetHome®