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

soc: qcom: smp2p: Introduce tracepoint support

Introduce tracepoint support for smp2p to enable
communication logging between local and remote processors.
Include tracepoints with information about the remote subsystem
name, negotiation details, supported features, bit change
notifications, and ssr activity. These logs are useful for
debugging issues between subsystems.

Signed-off-by: Sudeepgoud Patil <quic_sudeepgo@quicinc.com>
Link: https://lore.kernel.org/r/20240716173835.997259-3-quic_sudeepgo@quicinc.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>

authored by

Sudeepgoud Patil and committed by
Bjorn Andersson
85a55eee 8400291e

+108
+1
drivers/soc/qcom/Makefile
··· 25 25 obj-$(CONFIG_QCOM_SMD_RPM) += rpm-proc.o smd-rpm.o 26 26 obj-$(CONFIG_QCOM_SMEM) += smem.o 27 27 obj-$(CONFIG_QCOM_SMEM_STATE) += smem_state.o 28 + CFLAGS_smp2p.o := -I$(src) 28 29 obj-$(CONFIG_QCOM_SMP2P) += smp2p.o 29 30 obj-$(CONFIG_QCOM_SMSM) += smsm.o 30 31 obj-$(CONFIG_QCOM_SOCINFO) += socinfo.o
+9
drivers/soc/qcom/smp2p.c
··· 161 161 struct list_head outbound; 162 162 }; 163 163 164 + #define CREATE_TRACE_POINTS 165 + #include "trace-smp2p.h" 166 + 164 167 static void qcom_smp2p_kick(struct qcom_smp2p *smp2p) 165 168 { 166 169 /* Make sure any updated data is written before the kick */ ··· 195 192 struct smp2p_smem_item *out = smp2p->out; 196 193 u32 val; 197 194 195 + trace_smp2p_ssr_ack(smp2p->dev); 198 196 smp2p->ssr_ack = !smp2p->ssr_ack; 199 197 200 198 val = out->flags & ~BIT(SMP2P_FLAGS_RESTART_ACK_BIT); ··· 218 214 smp2p->ssr_ack_enabled = true; 219 215 220 216 smp2p->negotiation_done = true; 217 + trace_smp2p_negotiate(smp2p->dev, out->features); 221 218 } 222 219 } 223 220 ··· 256 251 257 252 status = val ^ entry->last_value; 258 253 entry->last_value = val; 254 + 255 + trace_smp2p_notify_in(entry, status, val); 259 256 260 257 /* No changes of this entry? */ 261 258 if (!status) ··· 421 414 val |= value; 422 415 writel(val, entry->value); 423 416 spin_unlock_irqrestore(&entry->lock, flags); 417 + 418 + trace_smp2p_update_bits(entry, orig, val); 424 419 425 420 if (val != orig) 426 421 qcom_smp2p_kick(entry->smp2p);
+98
drivers/soc/qcom/trace-smp2p.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + */ 5 + 6 + #undef TRACE_SYSTEM 7 + #define TRACE_SYSTEM qcom_smp2p 8 + 9 + #if !defined(__QCOM_SMP2P_TRACE_H__) || defined(TRACE_HEADER_MULTI_READ) 10 + #define __QCOM_SMP2P_TRACE_H__ 11 + 12 + #include <linux/device.h> 13 + #include <linux/tracepoint.h> 14 + 15 + TRACE_EVENT(smp2p_ssr_ack, 16 + TP_PROTO(const struct device *dev), 17 + TP_ARGS(dev), 18 + TP_STRUCT__entry( 19 + __string(dev_name, dev_name(dev)) 20 + ), 21 + TP_fast_assign( 22 + __assign_str(dev_name); 23 + ), 24 + TP_printk("%s: SSR detected", __get_str(dev_name)) 25 + ); 26 + 27 + TRACE_EVENT(smp2p_negotiate, 28 + TP_PROTO(const struct device *dev, unsigned int features), 29 + TP_ARGS(dev, features), 30 + TP_STRUCT__entry( 31 + __string(dev_name, dev_name(dev)) 32 + __field(u32, out_features) 33 + ), 34 + TP_fast_assign( 35 + __assign_str(dev_name); 36 + __entry->out_features = features; 37 + ), 38 + TP_printk("%s: state=open out_features=%s", __get_str(dev_name), 39 + __print_flags(__entry->out_features, "|", 40 + {SMP2P_FEATURE_SSR_ACK, "SMP2P_FEATURE_SSR_ACK"}) 41 + ) 42 + ); 43 + 44 + TRACE_EVENT(smp2p_notify_in, 45 + TP_PROTO(struct smp2p_entry *smp2p_entry, unsigned long status, u32 val), 46 + TP_ARGS(smp2p_entry, status, val), 47 + TP_STRUCT__entry( 48 + __string(dev_name, dev_name(smp2p_entry->smp2p->dev)) 49 + __string(client_name, smp2p_entry->name) 50 + __field(unsigned long, status) 51 + __field(u32, val) 52 + ), 53 + TP_fast_assign( 54 + __assign_str(dev_name); 55 + __assign_str(client_name); 56 + __entry->status = status; 57 + __entry->val = val; 58 + ), 59 + TP_printk("%s: %s: status:0x%0lx val:0x%0x", 60 + __get_str(dev_name), 61 + __get_str(client_name), 62 + __entry->status, 63 + __entry->val 64 + ) 65 + ); 66 + 67 + TRACE_EVENT(smp2p_update_bits, 68 + TP_PROTO(struct smp2p_entry *smp2p_entry, u32 orig, u32 val), 69 + TP_ARGS(smp2p_entry, orig, val), 70 + TP_STRUCT__entry( 71 + __string(dev_name, dev_name(smp2p_entry->smp2p->dev)) 72 + __string(client_name, smp2p_entry->name) 73 + __field(u32, orig) 74 + __field(u32, val) 75 + ), 76 + TP_fast_assign( 77 + __assign_str(dev_name); 78 + __assign_str(client_name); 79 + __entry->orig = orig; 80 + __entry->val = val; 81 + ), 82 + TP_printk("%s: %s: orig:0x%0x new:0x%0x", 83 + __get_str(dev_name), 84 + __get_str(client_name), 85 + __entry->orig, 86 + __entry->val 87 + ) 88 + ); 89 + 90 + #endif /* __QCOM_SMP2P_TRACE_H__ */ 91 + 92 + #undef TRACE_INCLUDE_PATH 93 + #define TRACE_INCLUDE_PATH . 94 + 95 + #undef TRACE_INCLUDE_FILE 96 + #define TRACE_INCLUDE_FILE trace-smp2p 97 + 98 + #include <trace/define_trace.h>