]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
KVM: arm64: Refactor kvm_reset_cptr_el2()
authorFuad Tabba <tabba@google.com>
Mon, 16 Dec 2024 10:50:53 +0000 (10:50 +0000)
committerMarc Zyngier <maz@kernel.org>
Fri, 20 Dec 2024 13:54:00 +0000 (13:54 +0000)
Fold kvm_get_reset_cptr_el2() into kvm_reset_cptr_el2(), since it
is its only caller. Add a comment to clarify that this function
is meant for the host value of cptr_el2.

No functional change intended.

Signed-off-by: Fuad Tabba <tabba@google.com>
Link: https://lore.kernel.org/r/20241216105057.579031-14-tabba@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/include/asm/kvm_emulate.h

index cf811009a33c9e36b65fd1e3a7ea8643d8a1a1c4..7b3dc52248ce475e5724fd1309e377523ad51f55 100644 (file)
@@ -619,7 +619,8 @@ static __always_inline void kvm_write_cptr_el2(u64 val)
                write_sysreg(val, cptr_el2);
 }
 
-static __always_inline u64 kvm_get_reset_cptr_el2(struct kvm_vcpu *vcpu)
+/* Resets the value of cptr_el2 when returning to the host. */
+static __always_inline void kvm_reset_cptr_el2(struct kvm_vcpu *vcpu)
 {
        u64 val;
 
@@ -643,13 +644,6 @@ static __always_inline u64 kvm_get_reset_cptr_el2(struct kvm_vcpu *vcpu)
                        val &= ~CPTR_EL2_TSM;
        }
 
-       return val;
-}
-
-static __always_inline void kvm_reset_cptr_el2(struct kvm_vcpu *vcpu)
-{
-       u64 val = kvm_get_reset_cptr_el2(vcpu);
-
        kvm_write_cptr_el2(val);
 }