[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191126163630.17300-6-roman.sudarikov@linux.intel.com>
Date: Tue, 26 Nov 2019 19:36:29 +0300
From: roman.sudarikov@...ux.intel.com
To: peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
mark.rutland@....com, alexander.shishkin@...ux.intel.com,
jolsa@...hat.com, namhyung@...nel.org,
linux-kernel@...r.kernel.org, eranian@...gle.com,
bgregg@...flix.com, ak@...ux.intel.com, kan.liang@...ux.intel.com
Cc: alexander.antonov@...el.com, roman.sudarikov@...ux.intel.com
Subject: [PATCH 5/6] perf tools: Add feature check for libpci
From: Roman Sudarikov <roman.sudarikov@...ux.intel.com>
Add feature check for libpci to show device name in --iiostat mode.
libpci support allows device name to b:d:f notion.
Signed-off-by: Roman Sudarikov <roman.sudarikov@...ux.intel.com>
Co-developed-by: Alexander Antonov <alexander.antonov@...el.com>
Signed-off-by: Alexander Antonov <alexander.antonov@...el.com>
---
tools/build/Makefile.feature | 2 ++
tools/build/feature/Makefile | 4 ++++
tools/build/feature/test-all.c | 5 +++++
tools/build/feature/test-libpci.c | 10 ++++++++++
tools/perf/Makefile.config | 10 ++++++++++
tools/perf/builtin-version.c | 1 +
tools/perf/tests/make | 1 +
7 files changed, 33 insertions(+)
create mode 100644 tools/build/feature/test-libpci.c
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 8a19753cc26a..bebdfb99607c 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -50,6 +50,7 @@ FEATURE_TESTS_BASIC := \
libelf-mmap \
libnuma \
numa_num_possible_cpus \
+ libpci \
libperl \
libpython \
libpython-version \
@@ -115,6 +116,7 @@ FEATURE_DISPLAY ?= \
libelf \
libnuma \
numa_num_possible_cpus \
+ libpci \
libperl \
libpython \
libcrypto \
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 8499385365c0..f0d5f886602d 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -28,6 +28,7 @@ FILES= \
test-libelf-mmap.bin \
test-libnuma.bin \
test-numa_num_possible_cpus.bin \
+ test-libpci.bin \
test-libperl.bin \
test-libpython.bin \
test-libpython-version.bin \
@@ -210,6 +211,9 @@ PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
+$(OUTPUT)test-libpci.bin:
+ $(BUILD) -lpci
+
$(OUTPUT)test-libperl.bin:
$(BUILD) $(FLAGS_PERL_EMBED)
diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
index 88145e8cde1a..c61d34804a06 100644
--- a/tools/build/feature/test-all.c
+++ b/tools/build/feature/test-all.c
@@ -74,6 +74,10 @@
# include "test-libunwind.c"
#undef main
+#define main main_test_libpci
+# include "test-libpci.c"
+#undef
+
#define main main_test_libaudit
# include "test-libaudit.c"
#undef main
@@ -210,6 +214,7 @@ int main(int argc, char *argv[])
main_test_libunwind();
main_test_libaudit();
main_test_libslang();
+ main_test_libpci();
main_test_gtk2(argc, argv);
main_test_gtk2_infobar(argc, argv);
main_test_libbfd();
diff --git a/tools/build/feature/test-libpci.c b/tools/build/feature/test-libpci.c
new file mode 100644
index 000000000000..4bbeb9ffd687
--- /dev/null
+++ b/tools/build/feature/test-libpci.c
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "pci/pci.h"
+
+int main(void)
+{
+ struct pci_access *pacc = pci_alloc();
+
+ pci_cleanup(pacc);
+ return 0;
+}
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 46f7fba2306c..1b9d341492c8 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -839,6 +839,16 @@ ifndef NO_LIBCAP
endif
endif
+ifndef NO_PCILIB
+ ifeq ($(feature-libpci), 1)
+ CFLAGS += -DHAVE_LIBPCI_SUPPORT
+ EXTLIBS += -lpci
+ else
+ msg := $(warning No libpci found, show pci devices without names in iiostat mode, please install libpci-dev/pciutils-devel);
+ NO_PCILIB := 1
+ endif
+endif
+
ifndef NO_BACKTRACE
ifeq ($(feature-backtrace), 1)
CFLAGS += -DHAVE_BACKTRACE_SUPPORT
diff --git a/tools/perf/builtin-version.c b/tools/perf/builtin-version.c
index 05cf2af9e2c2..ec4e0eb07825 100644
--- a/tools/perf/builtin-version.c
+++ b/tools/perf/builtin-version.c
@@ -76,6 +76,7 @@ static void library_status(void)
STATUS(HAVE_LIBUNWIND_SUPPORT, libunwind);
STATUS(HAVE_DWARF_SUPPORT, libdw-dwarf-unwind);
STATUS(HAVE_ZLIB_SUPPORT, zlib);
+ STATUS(HAVE_LIBPCI_SUPPORT, libpci);
STATUS(HAVE_LZMA_SUPPORT, lzma);
STATUS(HAVE_AUXTRACE_SUPPORT, get_cpuid);
STATUS(HAVE_LIBBPF_SUPPORT, bpf);
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index c850d1664c56..0b78cf6e8377 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -109,6 +109,7 @@ make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
make_minimal += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1
make_minimal += NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1 NO_LIBZSTD=1
make_minimal += NO_LIBCAP=1
+make_minimal += NO_LIBPCI=1
# $(run) contains all available tests
run := make_pure
--
2.19.1
Powered by blists - more mailing lists