From 5f51ac014c4ff646e1347b1e3dd7a8ee1419c23a Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Date: Tue, 9 Jun 2020 13:23:24 -0300
Subject: [PATCH 094/201] perf pmu: Add a perf_pmu__fake object to use with
 __parse_events()

mainline inclusion
from mainline-v5.9-rc1
commit e46fc8d9dd352c88fec49b140008958d2dc1efe1
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8C0CX

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e46fc8d9dd352c88fec49b140008958d2dc1efe1

----------------------------------------------------------------------

When wanting to use the support in __parse_events() for fake pmus, just
pass it.

Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: hongrongxuan <hongrongxuan@huawei.com>
---
 tools/perf/util/pmu.c | 2 ++
 tools/perf/util/pmu.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 7eefbebbf990..7217b8fac00d 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -21,6 +21,8 @@
 #include "cache.h"
 #include "string2.h"
 
+struct perf_pmu perf_pmu__fake;
+
 struct perf_pmu_format {
 	char *name;
 	int value;
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 79f167db4a33..c44c4a701bf4 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -33,6 +33,8 @@ struct perf_pmu {
 	int (*set_drv_config)	(struct perf_evsel_config_term *term);
 };
 
+extern struct perf_pmu perf_pmu__fake;
+
 struct perf_pmu_info {
 	const char *unit;
 	const char *metric_expr;
-- 
2.27.0

