]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
KVM: arm64: Don't pass host_debug_state to BRBE world-switch routines
authorWill Deacon <will@kernel.org>
Fri, 27 Mar 2026 13:00:46 +0000 (13:00 +0000)
committerMarc Zyngier <maz@kernel.org>
Sat, 28 Mar 2026 17:07:50 +0000 (17:07 +0000)
Now that the SPE and BRBE nVHE world-switch routines operate on the
host_debug_state directly, tweak the BRBE code to do the same for
consistency.

This is purely cosmetic.

Cc: Marc Zyngier <maz@kernel.org>
Cc: Oliver Upton <oupton@kernel.org>
Cc: James Clark <james.clark@linaro.org>
Cc: Leo Yan <leo.yan@arm.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Fuad Tabba <tabba@google.com>
Cc: Alexandru Elisei <alexandru.elisei@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
Tested-by: Fuad Tabba <tabba@google.com>
Reviewed-by: Fuad Tabba <tabba@google.com>
Link: https://patch.msgid.link/20260327130047.21065-4-will@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/hyp/nvhe/debug-sr.c

index 84bc80f4e36b24a5875fb3ffe94fab1d36cb8cb7..f8904391c1259fef2b4cefa3bdf4a816d9719e75 100644 (file)
@@ -156,8 +156,10 @@ static void __trace_switch_to_host(void)
                          *host_data_ptr(host_debug_state.trfcr_el1));
 }
 
-static void __debug_save_brbe(u64 *brbcr_el1)
+static void __debug_save_brbe(void)
 {
+       u64 *brbcr_el1 = host_data_ptr(host_debug_state.brbcr_el1);
+
        *brbcr_el1 = 0;
 
        /* Check if the BRBE is enabled */
@@ -173,8 +175,10 @@ static void __debug_save_brbe(u64 *brbcr_el1)
        write_sysreg_el1(0, SYS_BRBCR);
 }
 
-static void __debug_restore_brbe(u64 brbcr_el1)
+static void __debug_restore_brbe(void)
 {
+       u64 brbcr_el1 = *host_data_ptr(host_debug_state.brbcr_el1);
+
        if (!brbcr_el1)
                return;
 
@@ -190,7 +194,7 @@ void __debug_save_host_buffers_nvhe(struct kvm_vcpu *vcpu)
 
        /* Disable BRBE branch records */
        if (host_data_test_flag(HAS_BRBE))
-               __debug_save_brbe(host_data_ptr(host_debug_state.brbcr_el1));
+               __debug_save_brbe();
 
        if (__trace_needs_switch())
                __trace_switch_to_guest();
@@ -206,7 +210,7 @@ void __debug_restore_host_buffers_nvhe(struct kvm_vcpu *vcpu)
        if (host_data_test_flag(HAS_SPE))
                __debug_restore_spe();
        if (host_data_test_flag(HAS_BRBE))
-               __debug_restore_brbe(*host_data_ptr(host_debug_state.brbcr_el1));
+               __debug_restore_brbe();
        if (__trace_needs_switch())
                __trace_switch_to_host();
 }