Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KVM: arm64: Return early from kvm_finalize_sys_regs() if guest has run

If the guest has already run, we have no business finalizing the
system register state - it is too late. Therefore, check early and
bail if the VM has already run.

This change also stops kvm_init_nv_sysregs() from being called once
the RM has run once. Although this looks like a behavioural change,
the function returns early once it has been called the first time.

Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Link: https://patch.msgid.link/20260319154937.3619520-4-sascha.bischoff@arm.com
Signed-off-by: Marc Zyngier <maz@kernel.org>

authored by

Sascha Bischoff and committed by
Marc Zyngier
cbd8c958 3a2857da

+4 -1
+4 -1
arch/arm64/kvm/sys_regs.c
··· 5659 5659 5660 5660 guard(mutex)(&kvm->arch.config_lock); 5661 5661 5662 + if (kvm_vm_has_ran_once(kvm)) 5663 + return 0; 5664 + 5662 5665 /* 5663 5666 * This hacks into the ID registers, so only perform it when the 5664 5667 * first vcpu runs, or the kvm_set_vm_id_reg() helper will scream. 5665 5668 */ 5666 - if (!irqchip_in_kernel(kvm) && !kvm_vm_has_ran_once(kvm)) { 5669 + if (!irqchip_in_kernel(kvm)) { 5667 5670 u64 val; 5668 5671 5669 5672 val = kvm_read_vm_id_reg(kvm, SYS_ID_AA64PFR0_EL1) & ~ID_AA64PFR0_EL1_GIC;