summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/task-analyzer.py
diff options
context:
space:
mode:
authorSascha Bischoff <Sascha.Bischoff@arm.com>2026-09-04 11:52:03 +0000
committerMarc Zyngier <maz@kernel.org>2026-09-14 10:49:09 +0100
commitf9846846c4df6818d323f4a86c168bd2d63c6cdb (patch)
tree8fa5cb0284aac0b6a3ea96229a9106cf9afc67b7 /tools/perf/scripts/python/task-analyzer.py
parent8bcdcbb57a46a5f72ae55e8d69517ac5df8c05bd (diff)
KVM: arm64: gic-v5: Implement save/restore mechanisms for ISTs
When running a GICv5 VM, there are up to two ISTs that must be saved or restored when migrating a VM. The SPI IST is allocated by the hypervisor, as the guest presumes the memory for the SPI state is allocated by the hardware. The LPI IST is also shadowed in KVM when the guest enables LPIs, so the guest's LPI IST memory is not used directly by the physical GICv5 hardware. As both in-use ISTs are backed by host allocations, userspace provides migration storage for both tables through KVM_DEV_ARM_VGIC_GRP_IST. The userspace descriptor supplies separate SPI and LPI buffers, each containing the architected 32-bit ISTE state for the corresponding interrupt number space. If the guest has not configured an LPI IST, userspace must omit the LPI buffer. On save, acquire every vCPU mutex, returning -EBUSY if any vCPU is already running. Holding these locks blocks KVM_RUN while the IST state is exported. Use IRS_SAVE_VMR to write the IRS's internal state back to the ISTs and check that the VM remained quiescent. After copying each IST, issue a Q-only IRS_SAVE_VMR operation to update IRS_SAVE_VM_STATUSR.Q and repeat the check. If the VM has not remained quiescent since the save began, propagate an error to userspace so that the save can be retried without losing incoming interrupt state. On restore, reject the operation if any vCPU has already run. Validate the userspace buffers and, if the restored IRS state describes an LPI IST, allocate the shadow host IST while the VMTE is still valid. This allows the IRS operation that assigns the IST to update the VMTE. Then make the VMTE invalid before copying the SPI and LPI IST state from the userspace-provided buffers, and make it valid again once the copy is complete. Once restoration completes successfully, clear the pending LPI IST restore state recorded when IRS_IST_BASER.Valid was restored, allowing the guest to run. As part of restoring the ISTs, track pending interrupts and clear their pending state from the restored host ISTs. Once the VM is valid again, make those interrupts pending through the GIC VDPEND system instruction. Once a host LPI IST has been allocated, the guest-visible IRS_IST_BASER and IRS_IST_CFGR state describes that allocation. Userspace may replay values with the same defined fields, but KVM rejects changes while the host IST exists. During save, also require the VMTE IST_ID_BITS value to match IRS_IST_CFGR.LPI_ID_BITS so that userspace buffer validation and the host IST walk use the same number of entries. Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com> Link: https://patch.msgid.link/20260904113404.4051341-36-sascha.bischoff@arm.com Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/task-analyzer.py')
0 files changed, 0 insertions, 0 deletions