]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: arm64: Add save/restore support for POR_EL2
authorMarc Zyngier <maz@kernel.org>
Wed, 23 Oct 2024 14:53:40 +0000 (15:53 +0100)
committerOliver Upton <oliver.upton@linux.dev>
Thu, 31 Oct 2024 02:44:22 +0000 (02:44 +0000)
POR_EL2 needs saving when the guest is VHE, and restoring in
any case.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20241023145345.1613824-33-maz@kernel.org
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/kvm/hyp/vhe/sysreg-sr.c

index a603966726f653fa7f74d60a6fba7af2cb9594d5..5f78a39053a793fb5d8d6339273aea0ed9d03051 100644 (file)
@@ -58,6 +58,9 @@ static void __sysreg_save_vel2_state(struct kvm_vcpu *vcpu)
                                __vcpu_sys_reg(vcpu, PIRE0_EL2) = read_sysreg_el1(SYS_PIRE0);
                                __vcpu_sys_reg(vcpu, PIR_EL2) = read_sysreg_el1(SYS_PIR);
                        }
+
+                       if (ctxt_has_s1poe(&vcpu->arch.ctxt))
+                               __vcpu_sys_reg(vcpu, POR_EL2) = read_sysreg_el1(SYS_POR);
                }
 
                /*
@@ -123,6 +126,9 @@ static void __sysreg_restore_vel2_state(struct kvm_vcpu *vcpu)
                        write_sysreg_el1(__vcpu_sys_reg(vcpu, PIR_EL2), SYS_PIR);
                        write_sysreg_el1(__vcpu_sys_reg(vcpu, PIRE0_EL2), SYS_PIRE0);
                }
+
+               if (ctxt_has_s1poe(&vcpu->arch.ctxt))
+                       write_sysreg_el1(__vcpu_sys_reg(vcpu, POR_EL2), SYS_POR);
        }
 
        write_sysreg_el1(__vcpu_sys_reg(vcpu, ESR_EL2),         SYS_ESR);