[PATCH v2] KVM: arm64: selftests: Check ID regs are immutable after a failed run

Mark Brown broonie at kernel.org
Wed Aug 5 07:15:23 PDT 2026


On Wed, Aug 05, 2026 at 07:47:40AM +0100, Fuad Tabba wrote:
> Add a set_id_regs case covering ID register immutability when a vCPU's
> first KVM_RUN fails after finalization but before
> KVM_ARCH_FLAG_HAS_RAN_ONCE is set. The test provokes such a failure with
> a PMUv3-enabled vCPU whose PMU is left uninitialized, then checks that
> KVM_SET_ONE_REG on the feature and implementation ID registers, and
> KVM_CREATE_DEVICE for a vGIC, are all rejected with -EBUSY.

> +	/*
> +	 * A PMUv3 vCPU left without PMU init is rejected by
> +	 * kvm_arm_pmu_v3_enable(), which runs after sysreg finalization.
> +	 */
> +	r = _vcpu_run(vcpu);
> +	TEST_ASSERT(r < 0 && errno == EINVAL,
> +		    "first KVM_RUN should fail post-finalization: r=%d errno=%d",
> +		    r, errno);

As mentioned on the prior version TEST_ASSERT() is not good practice for
something reporting individual kselftest results, and while there's a
bunch of bad practice in this file we do also have some attempts at
doing better (although not currently entirely successful).

Otherwise this looks fine so I guess

Acked-by: Mark Brown <broonie at kernel.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20260805/75dec522/attachment.sig>


More information about the linux-arm-kernel mailing list