Re: [PATCH] KVM: arm64: selftests: Skip ignored AArch32 ID regs in the failed-run test
From: Mark Brown
Date: Sun Oct 25 2026 - 17:48:22 EST
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:
signature.asc
Description: PGP signature