KVM: arm64: Advertise tracepoint constant strings as tracepoint_string()

As it turns out, directly passing strings to a tracepoint is
slightly frowned upon, and it is expected that callers would
wrap such strings with tracepoint_string().

In turn, the strings appear in printk_formats, where tooling
can pick them up.

Reported-by: Primiano Tucci <primiano@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
diff --git a/arch/arm64/kvm/debug.c b/arch/arm64/kvm/debug.c
index 4fd5c21..cc24c2d 100644
--- a/arch/arm64/kvm/debug.c
+++ b/arch/arm64/kvm/debug.c
@@ -21,6 +21,11 @@
 				DBG_MDSCR_KDE | \
 				DBG_MDSCR_MDE)
 
+#define trace_set_dreg(s, v)					\
+	trace_kvm_arm_set_dreg32(tracepoint_string(s), (v))
+#define trace_set_regset(s, n, ctrls, values)			\
+	trace_kvm_arm_set_regset(tracepoint_string(s), (n), (ctrls), (values))
+
 static DEFINE_PER_CPU(u64, mdcr_el2);
 
 /**
@@ -39,8 +44,8 @@ static void save_guest_debug_regs(struct kvm_vcpu *vcpu)
 
 	vcpu->arch.guest_debug_preserved.mdscr_el1 = val;
 
-	trace_kvm_arm_set_dreg32("Saved MDSCR_EL1",
-				vcpu->arch.guest_debug_preserved.mdscr_el1);
+	trace_set_dreg("Saved MDSCR_EL1",
+		       vcpu->arch.guest_debug_preserved.mdscr_el1);
 }
 
 static void restore_guest_debug_regs(struct kvm_vcpu *vcpu)
@@ -49,8 +54,8 @@ static void restore_guest_debug_regs(struct kvm_vcpu *vcpu)
 
 	vcpu_write_sys_reg(vcpu, val, MDSCR_EL1);
 
-	trace_kvm_arm_set_dreg32("Restored MDSCR_EL1",
-				vcpu_read_sys_reg(vcpu, MDSCR_EL1));
+	trace_set_dreg("Restored MDSCR_EL1",
+		       vcpu_read_sys_reg(vcpu, MDSCR_EL1));
 }
 
 /**
@@ -112,7 +117,7 @@ static void kvm_arm_setup_mdcr_el2(struct kvm_vcpu *vcpu)
 	    kvm_vcpu_os_lock_enabled(vcpu))
 		vcpu->arch.mdcr_el2 |= MDCR_EL2_TDA;
 
-	trace_kvm_arm_set_dreg32("MDCR_EL2", vcpu->arch.mdcr_el2);
+	trace_set_dreg("MDCR_EL2", vcpu->arch.mdcr_el2);
 }
 
 /**
@@ -198,7 +203,7 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)
 			vcpu_write_sys_reg(vcpu, mdscr, MDSCR_EL1);
 		}
 
-		trace_kvm_arm_set_dreg32("SPSR_EL2", *vcpu_cpsr(vcpu));
+		trace_set_dreg("SPSR_EL2", *vcpu_cpsr(vcpu));
 
 		/*
 		 * HW Breakpoints and watchpoints
@@ -218,13 +223,13 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)
 			vcpu->arch.debug_ptr = &vcpu->arch.external_debug_state;
 			vcpu->arch.flags |= KVM_ARM64_DEBUG_DIRTY;
 
-			trace_kvm_arm_set_regset("BKPTS", get_num_brps(),
-						&vcpu->arch.debug_ptr->dbg_bcr[0],
-						&vcpu->arch.debug_ptr->dbg_bvr[0]);
+			trace_set_regset("BKPTS", get_num_brps(),
+					 &vcpu->arch.debug_ptr->dbg_bcr[0],
+					 &vcpu->arch.debug_ptr->dbg_bvr[0]);
 
-			trace_kvm_arm_set_regset("WAPTS", get_num_wrps(),
-						&vcpu->arch.debug_ptr->dbg_wcr[0],
-						&vcpu->arch.debug_ptr->dbg_wvr[0]);
+			trace_set_regset("WAPTS", get_num_wrps(),
+					 &vcpu->arch.debug_ptr->dbg_wcr[0],
+					 &vcpu->arch.debug_ptr->dbg_wvr[0]);
 
 		/*
 		 * The OS Lock blocks debug exceptions in all ELs when it is
@@ -252,7 +257,7 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)
 	if (has_vhe() && orig_mdcr_el2 != vcpu->arch.mdcr_el2)
 		write_sysreg(vcpu->arch.mdcr_el2, mdcr_el2);
 
-	trace_kvm_arm_set_dreg32("MDSCR_EL1", vcpu_read_sys_reg(vcpu, MDSCR_EL1));
+	trace_set_dreg("MDSCR_EL1", vcpu_read_sys_reg(vcpu, MDSCR_EL1));
 }
 
 void kvm_arm_clear_debug(struct kvm_vcpu *vcpu)
@@ -272,13 +277,13 @@ void kvm_arm_clear_debug(struct kvm_vcpu *vcpu)
 		if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW) {
 			kvm_arm_reset_debug_ptr(vcpu);
 
-			trace_kvm_arm_set_regset("BKPTS", get_num_brps(),
-						&vcpu->arch.debug_ptr->dbg_bcr[0],
-						&vcpu->arch.debug_ptr->dbg_bvr[0]);
+			trace_set_regset("BKPTS", get_num_brps(),
+					 &vcpu->arch.debug_ptr->dbg_bcr[0],
+					 &vcpu->arch.debug_ptr->dbg_bvr[0]);
 
-			trace_kvm_arm_set_regset("WAPTS", get_num_wrps(),
-						&vcpu->arch.debug_ptr->dbg_wcr[0],
-						&vcpu->arch.debug_ptr->dbg_wvr[0]);
+			trace_set_regset("WAPTS", get_num_wrps(),
+					 &vcpu->arch.debug_ptr->dbg_wcr[0],
+					 &vcpu->arch.debug_ptr->dbg_wvr[0]);
 		}
 	}
 }
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index 7b45c040..ae27635 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -354,6 +354,9 @@ static bool trap_dbgauthstatus_el1(struct kvm_vcpu *vcpu,
 	}
 }
 
+#define trace_fn_trap_reg(r, w, v)		\
+	trace_trap_reg(tracepoint_string(__func__), (r), (w), (v))
+
 /*
  * We want to avoid world-switching all the DBG registers all the
  * time:
@@ -392,7 +395,7 @@ static bool trap_debug_regs(struct kvm_vcpu *vcpu,
 		p->regval = vcpu_read_sys_reg(vcpu, r->reg);
 	}
 
-	trace_trap_reg(__func__, r->reg, p->is_write, p->regval);
+	trace_fn_trap_reg(r->reg, p->is_write, p->regval);
 
 	return true;
 }
@@ -445,7 +448,7 @@ static bool trap_bvr(struct kvm_vcpu *vcpu,
 	else
 		dbg_to_reg(vcpu, p, rd, dbg_reg);
 
-	trace_trap_reg(__func__, rd->CRm, p->is_write, *dbg_reg);
+	trace_fn_trap_reg(rd->CRm, p->is_write, *dbg_reg);
 
 	return true;
 }
@@ -487,7 +490,7 @@ static bool trap_bcr(struct kvm_vcpu *vcpu,
 	else
 		dbg_to_reg(vcpu, p, rd, dbg_reg);
 
-	trace_trap_reg(__func__, rd->CRm, p->is_write, *dbg_reg);
+	trace_fn_trap_reg(rd->CRm, p->is_write, *dbg_reg);
 
 	return true;
 }
@@ -530,7 +533,7 @@ static bool trap_wvr(struct kvm_vcpu *vcpu,
 	else
 		dbg_to_reg(vcpu, p, rd, dbg_reg);
 
-	trace_trap_reg(__func__, rd->CRm, p->is_write,
+	trace_fn_trap_reg(rd->CRm, p->is_write,
 		vcpu->arch.vcpu_debug_state.dbg_wvr[rd->CRm]);
 
 	return true;
@@ -573,7 +576,7 @@ static bool trap_wcr(struct kvm_vcpu *vcpu,
 	else
 		dbg_to_reg(vcpu, p, rd, dbg_reg);
 
-	trace_trap_reg(__func__, rd->CRm, p->is_write, *dbg_reg);
+	trace_fn_trap_reg(rd->CRm, p->is_write, *dbg_reg);
 
 	return true;
 }