summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/rwsem.c
diff options
context:
space:
mode:
authorYijie Yang <yijie.yang@oss.qualcomm.com>2026-08-11 16:46:47 +0800
committerRob Herring (Arm) <robh@kernel.org>2026-08-15 15:46:52 -0500
commite1c13aed4a1641550e8c9518c96f016e1d52d09b (patch)
tree61c2297688373db165cc857b7c7adcb147a5c419 /tools/perf/util/rwsem.c
downloadlinux-stable-e1c13aed4a1641550e8c9518c96f016e1d52d09b.tar.gz
linux-stable-e1c13aed4a1641550e8c9518c96f016e1d52d09b.zip
dt-bindings: interconnect: qcom-bwmon: Add Maili cpu-bwmon compatiblegrafted
Add the Qualcomm Maili SoC compatible string for the CPU bandwidth monitor (BWMONv4). This falls back to the sdm845-bwmon compatible, consistent with the existing pattern used by other recent SoCs such as sm8750 and kaanapali. Signed-off-by: Yijie Yang <yijie.yang@oss.qualcomm.com> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Reviewed-by: Jingyi Wang <jingyi.wang@oss.qualcomm.com> Link: https://patch.msgid.link/20260811-bwmon-v2-1-80f7f150ab9e@oss.qualcomm.com Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Diffstat (limited to 'tools/perf/util/rwsem.c')
-rw-r--r--tools/perf/util/rwsem.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/tools/perf/util/rwsem.c b/tools/perf/util/rwsem.c
new file mode 100644
index 000000000..9d2683239
--- /dev/null
+++ b/tools/perf/util/rwsem.c
@@ -0,0 +1,71 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "util.h"
+#include "rwsem.h"
+
+#if RWS_ERRORCHECK
+#include "mutex.h"
+#endif
+
+int init_rwsem(struct rw_semaphore *sem)
+{
+#if RWS_ERRORCHECK
+ mutex_init(&sem->mtx);
+ return 0;
+#else
+ return pthread_rwlock_init(&sem->lock, NULL);
+#endif
+}
+
+int exit_rwsem(struct rw_semaphore *sem)
+{
+#if RWS_ERRORCHECK
+ mutex_destroy(&sem->mtx);
+ return 0;
+#else
+ return pthread_rwlock_destroy(&sem->lock);
+#endif
+}
+
+int down_read(struct rw_semaphore *sem)
+ NO_THREAD_SAFETY_ANALYSIS
+{
+#if RWS_ERRORCHECK
+ mutex_lock(&sem->mtx);
+ return 0;
+#else
+ return perf_singlethreaded ? 0 : pthread_rwlock_rdlock(&sem->lock);
+#endif
+}
+
+int up_read(struct rw_semaphore *sem)
+ NO_THREAD_SAFETY_ANALYSIS
+{
+#if RWS_ERRORCHECK
+ mutex_unlock(&sem->mtx);
+ return 0;
+#else
+ return perf_singlethreaded ? 0 : pthread_rwlock_unlock(&sem->lock);
+#endif
+}
+
+int down_write(struct rw_semaphore *sem)
+ NO_THREAD_SAFETY_ANALYSIS
+{
+#if RWS_ERRORCHECK
+ mutex_lock(&sem->mtx);
+ return 0;
+#else
+ return perf_singlethreaded ? 0 : pthread_rwlock_wrlock(&sem->lock);
+#endif
+}
+
+int up_write(struct rw_semaphore *sem)
+ NO_THREAD_SAFETY_ANALYSIS
+{
+#if RWS_ERRORCHECK
+ mutex_unlock(&sem->mtx);
+ return 0;
+#else
+ return perf_singlethreaded ? 0 : pthread_rwlock_unlock(&sem->lock);
+#endif
+}