Re: [PATCH v5 24/49] KVM: arm64: selftests: Update vGICv5 selftest to set IRS address

[email protected] Fri, 07 Aug 2026 15:04:20 +0000
Newsgroups dev.linux.lists.kvmarm,org.kernel.vger.kvm
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The selftest unconditionally sets the newly introduced `KVM_VGIC_V5_ADDR_TYPE_IRS` device attribute, which will assert and fail on older kernels that support GICv5 but lack this new UAPI.
--

--- Patch [24]: [PATCH v5 24/49] KVM: arm64: selftests: Update vGICv5 selftest to set IRS address ---
commit ea26c5c169753d8ee7936265dd3dd56864a96817
Author: Sascha Bischoff <[email protected]>

KVM: arm64: selftests: Update vGICv5 selftest to set IRS address

This commit updates the vGICv5 selftest to configure the IRS address
before initializing the VGIC. Setting this address is now mandatory for
running a GICv5 VM, as resources cannot be mapped without it.

> diff --git a/tools/testing/selftests/kvm/arm64/vgic_v5.c b/tools/testing/selftests/kvm/arm64/vgic_v5.c
> --- a/tools/testing/selftests/kvm/arm64/vgic_v5.c
> +++ b/tools/testing/selftests/kvm/arm64/vgic_v5.c

[ ... ]

> @@ -116,6 +117,11 @@ static void test_vgic_v5_ppis(u32 gic_dev_type)
>  	for (i = 0; i < NR_VCPUS; i++)
>  		vcpu_init_descriptor_tables(vcpus[i]);
>  
> +	/* Set the address of the IRS before initialising the GIC */
> +	attr = GICV5_IRS_CONFIG_BASE_GPA;
> +	kvm_device_attr_set(v.gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
> +			    KVM_VGIC_V5_ADDR_TYPE_IRS, &attr);

[Severity: Medium]
Will this cause the selftest to fail when run against older kernels that
support GICv5 but lack the new KVM_VGIC_V5_ADDR_TYPE_IRS attribute?

Because kvm_device_attr_set() asserts on failure, running this test against
an older kernel might abort the test suite entirely rather than gracefully
skipping it.

Should this code use __kvm_has_device_attr() to check for the presence of
KVM_VGIC_V5_ADDR_TYPE_IRS before setting it, or gracefully handle the error
if it is missing?

>  	kvm_device_attr_set(v.gic_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,
>  			    KVM_DEV_ARM_VGIC_CTRL_INIT, NULL);

-- 
Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=24