Re: [PATCH v1 2/2] KVM: arm64: selftests: Add an ITS MOVALL test
flat view
From: Marc Zyngier <maz@kernel.org>
Date: 2026-09-30 12:21:53
Also in:
kvmarm
On Tue, 29 Sep 2026 20:04:52 +0100, Fuad Tabba [off-list ref] wrote:
Map LPI A to vCPU0's collection and LPI B to vCPU1's, remap vCPU0's collection to vCPU2 and MOVALL vCPU0's LPIs there, then inject both. A must be taken on vCPU2 and B on vCPU1. KVM's MAPC handling already moves A to vCPU2, so only MOVALL handling can move B: without "KVM: arm64: vgic-its: Fix MOVALL handling of source redistributor", it moves B to vCPU2 as well.
MOVALL is about moving the pending bits (see 5.3.13 in the IHI0069H.b spec). Doing MOVALL first and only then injecting the interrupts doesn't quite check the MOVALL requirement. That doesn't impact KVM itself (we don't use pending tables at all), but you probably don't want to hardcode implementation specific behaviours here.
quoted hunk ↗ jump to hunk
Assisted-by: LLM Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev> --- tools/testing/selftests/kvm/Makefile.kvm | 1 + .../selftests/kvm/arm64/vgic_its_movall.c | 341 ++++++++++++++++++ 2 files changed, 342 insertions(+) create mode 100644 tools/testing/selftests/kvm/arm64/vgic_its_movall.cdiff --git a/tools/testing/selftests/kvm/Makefile.kvm b/tools/testing/selftests/kvm/Makefile.kvm index 908bdc7cf4f58..fb0bc99242975 100644 --- a/tools/testing/selftests/kvm/Makefile.kvm +++ b/tools/testing/selftests/kvm/Makefile.kvm@@ -190,6 +190,7 @@ TEST_GEN_PROGS_arm64 += arm64/stage2_block_transitions TEST_GEN_PROGS_arm64 += arm64/vcpu_width_config TEST_GEN_PROGS_arm64 += arm64/vgic_init TEST_GEN_PROGS_arm64 += arm64/vgic_irq +TEST_GEN_PROGS_arm64 += arm64/vgic_its_movall TEST_GEN_PROGS_arm64 += arm64/vgic_its_save TEST_GEN_PROGS_arm64 += arm64/vgic_lpi_stress TEST_GEN_PROGS_arm64 += arm64/vgic_v5diff --git a/tools/testing/selftests/kvm/arm64/vgic_its_movall.c b/tools/testing/selftests/kvm/arm64/vgic_its_movall.c new file mode 100644 index 0000000000000..41918576bdf63 --- /dev/null +++ b/tools/testing/selftests/kvm/arm64/vgic_its_movall.c@@ -0,0 +1,341 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * vgic_its_movall - MOVALL does not move the LPIs of other redistributors. + * + * Two LPIs, A and B, target two different redistributors. A's collection is + * remapped to a third redistributor with MAPC, followed by MOVALL from the + * first redistributor to the third. Both LPIs are then injected. A must be + * taken on the third redistributor, and B must stay on its own, which is not + * MOVALL's source. + * + * Copyright (c) 2026 Google LLC + * Author: Fuad Tabba <fuad.tabba@linux.dev> + */ + +#include <linux/sizes.h> +#include <pthread.h> +#include <stdatomic.h> + +#include "kvm_util.h" +#include "gic.h" +#include "gic_v3.h" +#include "gic_v3_its.h" +#include "processor.h" +#include "ucall.h" +#include "vgic.h" + +#define TEST_MEMSLOT_INDEX 1 + +#define GIC_LPI_OFFSET 8192 +#define NR_VCPUS 3 +#define NR_LPIS 2 +#define DEVICE_ID 0 + +/* LPI A (event 0) starts on vCPU0 and moves to vCPU2; B (event 1) stays on vCPU1 */ +#define LPI_A_COLL 0 +#define LPI_B_COLL 1 +#define MOVALL_FROM 0 +#define MOVALL_TO 2 +#define LPI_B_VCPU 1 + +#define LPI_PROP_DEFAULT_PRIO 0xa0 + +static gpa_t gpa_base; + +static struct kvm_vm *vm; +static struct kvm_vcpu *vcpus[NR_VCPUS]; +static int its_fd; + +static struct test_data { + bool request_vcpus_stop; + + gpa_t device_table; + gpa_t collection_table; + gpa_t cmdq_base; + void *cmdq_base_va; + gpa_t itt_table; + + gpa_t lpi_prop_table; + gpa_t lpi_pend_tables; +} test_data;
There seem to be a lot of commonality with the existing vgic_lpi_stress test. I'd rather we make this test the container for most ITS-related tests, instead of coming up with new individual tests. Thanks, N, -- Without deviation from the norm, progress is not possible.