The perf c2c tool provides means for Shared Data C2C/HITM analysis. It allows
 you to track down the cacheline contentions.
 
-On x86, the tool is based on load latency and precise store facility events
+On Intel, the tool is based on load latency and precise store facility events
 provided by Intel CPUs. On PowerPC, the tool uses random instruction sampling
-with thresholding feature.
+with thresholding feature. On AMD, the tool uses IBS op pmu (due to hardware
+limitations, perf c2c is not supported on Zen3 cpus).
 
 These events provide:
   - memory address of the access
 
 -l::
 --ldlat::
-       Configure mem-loads latency. (x86 only)
+       Configure mem-loads latency. Supported on Intel and Arm64 processors
+       only. Ignored on other archs.
 
 -k::
 --all-kernel::
   -W,-d,--phys-data,--sample-cpu
 
 Unless specified otherwise with '-e' option, following events are monitored by
-default on x86:
+default on Intel:
 
   cpu/mem-loads,ldlat=30/P
   cpu/mem-stores/P
 
+following on AMD:
+
+  ibs_op//
+
 and following on PowerPC:
 
   cpu/mem-loads/
 
        Be more verbose (show counter open errors, etc)
 
 --ldlat <n>::
-       Specify desired latency for loads event. (x86 only)
+       Specify desired latency for loads event. Supported on Intel and Arm64
+       processors only. Ignored on other archs.
 
 In addition, for report all perf report options are valid, and for record
 all perf record options.
 
 // SPDX-License-Identifier: GPL-2.0
 #include "util/pmu.h"
+#include "util/env.h"
 #include "map_symbol.h"
 #include "mem-events.h"
+#include "linux/string.h"
 
 static char mem_loads_name[100];
 static bool mem_loads_name__init;
 
 #define E(t, n, s) { .tag = t, .name = n, .sysfs_name = s }
 
-static struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX] = {
+static struct perf_mem_event perf_mem_events_intel[PERF_MEM_EVENTS__MAX] = {
        E("ldlat-loads",        "%s/mem-loads,ldlat=%u/P",      "%s/events/mem-loads"),
        E("ldlat-stores",       "%s/mem-stores/P",              "%s/events/mem-stores"),
        E(NULL,                 NULL,                           NULL),
 };
 
+static struct perf_mem_event perf_mem_events_amd[PERF_MEM_EVENTS__MAX] = {
+       E(NULL,         NULL,           NULL),
+       E(NULL,         NULL,           NULL),
+       E("mem-ldst",   "ibs_op//",     "ibs_op"),
+};
+
+static int perf_mem_is_amd_cpu(void)
+{
+       struct perf_env env = { .total_mem = 0, };
+
+       perf_env__cpuid(&env);
+       if (env.cpuid && strstarts(env.cpuid, "AuthenticAMD"))
+               return 1;
+       return -1;
+}
+
 struct perf_mem_event *perf_mem_events__ptr(int i)
 {
+       /* 0: Uninitialized, 1: Yes, -1: No */
+       static int is_amd;
+
        if (i >= PERF_MEM_EVENTS__MAX)
                return NULL;
 
-       return &perf_mem_events[i];
+       if (!is_amd)
+               is_amd = perf_mem_is_amd_cpu();
+
+       if (is_amd == 1)
+               return &perf_mem_events_amd[i];
+
+       return &perf_mem_events_intel[i];
 }
 
 bool is_mem_loads_aux_event(struct evsel *leader)