diff --git a/tools/perf/util/help.c b/tools/perf/util/help.c
index 6f2975a0035856a6ea1f7d1b02b3ad47a0d5ef45..4fa764d8f7d7cff626c631f4cfe49dd29a431dde 100644
--- a/tools/perf/util/help.c
+++ b/tools/perf/util/help.c
@@ -3,6 +3,7 @@
 #include "exec_cmd.h"
 #include "levenshtein.h"
 #include "help.h"
+#include <termios.h>
 
 void add_cmdname(struct cmdnames *cmds, const char *name, size_t len)
 {
diff --git a/tools/perf/util/top.h b/tools/perf/util/top.h
index 33347ca89ee4077559f9bd2284c135b586bc7bba..86ff1b15059b6a1d7be4ace532a29df04b244683 100644
--- a/tools/perf/util/top.h
+++ b/tools/perf/util/top.h
@@ -5,6 +5,7 @@
 #include "types.h"
 #include <stddef.h>
 #include <stdbool.h>
+#include <termios.h>
 
 struct perf_evlist;
 struct perf_evsel;