From 76cb841cb886eef6b3bee341a2266c76578724ad Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 6 May 2024 03:02:30 +0200 Subject: Adding upstream version 4.19.249. Signed-off-by: Daniel Baumann --- tools/Makefile | 179 + tools/accounting/.gitignore | 1 + tools/accounting/Makefile | 10 + tools/accounting/getdelays.c | 551 + tools/arch/alpha/include/asm/barrier.h | 9 + tools/arch/alpha/include/uapi/asm/bitsperlong.h | 9 + tools/arch/alpha/include/uapi/asm/errno.h | 128 + tools/arch/alpha/include/uapi/asm/mman.h | 48 + tools/arch/arc/include/uapi/asm/mman.h | 7 + tools/arch/arm/include/asm/barrier.h | 12 + tools/arch/arm/include/uapi/asm/kvm.h | 299 + tools/arch/arm/include/uapi/asm/mman.h | 7 + tools/arch/arm/include/uapi/asm/perf_regs.h | 24 + tools/arch/arm64/include/asm/barrier.h | 17 + tools/arch/arm64/include/uapi/asm/bitsperlong.h | 24 + tools/arch/arm64/include/uapi/asm/bpf_perf_event.h | 9 + tools/arch/arm64/include/uapi/asm/kvm.h | 312 + tools/arch/arm64/include/uapi/asm/mman.h | 7 + tools/arch/arm64/include/uapi/asm/perf_regs.h | 41 + tools/arch/arm64/include/uapi/asm/unistd.h | 20 + tools/arch/h8300/include/asm/bitsperlong.h | 15 + tools/arch/h8300/include/uapi/asm/mman.h | 7 + tools/arch/hexagon/include/uapi/asm/bitsperlong.h | 27 + tools/arch/hexagon/include/uapi/asm/mman.h | 7 + tools/arch/ia64/include/asm/barrier.h | 46 + tools/arch/ia64/include/uapi/asm/bitsperlong.h | 9 + tools/arch/ia64/include/uapi/asm/mman.h | 7 + .../arch/microblaze/include/uapi/asm/bitsperlong.h | 2 + tools/arch/microblaze/include/uapi/asm/mman.h | 7 + tools/arch/mips/include/asm/barrier.h | 21 + tools/arch/mips/include/asm/errno.h | 17 + tools/arch/mips/include/uapi/asm/bitsperlong.h | 9 + tools/arch/mips/include/uapi/asm/errno.h | 130 + tools/arch/mips/include/uapi/asm/kvm.h | 209 + tools/arch/mips/include/uapi/asm/mman.h | 47 + tools/arch/parisc/include/uapi/asm/bitsperlong.h | 15 + tools/arch/parisc/include/uapi/asm/errno.h | 127 + tools/arch/parisc/include/uapi/asm/mman.h | 46 + tools/arch/powerpc/include/asm/barrier.h | 30 + tools/arch/powerpc/include/uapi/asm/bitsperlong.h | 13 + tools/arch/powerpc/include/uapi/asm/errno.h | 10 + tools/arch/powerpc/include/uapi/asm/kvm.h | 677 + tools/arch/powerpc/include/uapi/asm/mman.h | 16 + tools/arch/powerpc/include/uapi/asm/perf_regs.h | 51 + tools/arch/powerpc/include/uapi/asm/unistd.h | 404 + tools/arch/riscv/include/uapi/asm/bitsperlong.h | 25 + tools/arch/s390/include/asm/barrier.h | 31 + tools/arch/s390/include/uapi/asm/bitsperlong.h | 13 + tools/arch/s390/include/uapi/asm/bpf_perf_event.h | 9 + tools/arch/s390/include/uapi/asm/kvm.h | 277 + tools/arch/s390/include/uapi/asm/kvm_perf.h | 22 + tools/arch/s390/include/uapi/asm/mman.h | 7 + tools/arch/s390/include/uapi/asm/perf_regs.h | 44 + tools/arch/s390/include/uapi/asm/ptrace.h | 457 + tools/arch/s390/include/uapi/asm/sie.h | 252 + tools/arch/sh/include/asm/barrier.h | 33 + tools/arch/sh/include/uapi/asm/mman.h | 7 + tools/arch/sparc/include/asm/barrier.h | 9 + tools/arch/sparc/include/asm/barrier_32.h | 7 + tools/arch/sparc/include/asm/barrier_64.h | 43 + tools/arch/sparc/include/uapi/asm/bitsperlong.h | 13 + tools/arch/sparc/include/uapi/asm/errno.h | 118 + tools/arch/sparc/include/uapi/asm/mman.h | 16 + tools/arch/x86/include/asm/atomic.h | 73 + tools/arch/x86/include/asm/barrier.h | 29 + tools/arch/x86/include/asm/cmpxchg.h | 90 + tools/arch/x86/include/asm/cpufeatures.h | 381 + tools/arch/x86/include/asm/disabled-features.h | 83 + tools/arch/x86/include/asm/mcsafe_test.h | 13 + tools/arch/x86/include/asm/required-features.h | 106 + tools/arch/x86/include/asm/rmwcc.h | 42 + tools/arch/x86/include/asm/unistd_32.h | 16 + tools/arch/x86/include/asm/unistd_64.h | 16 + tools/arch/x86/include/uapi/asm/bitsperlong.h | 13 + tools/arch/x86/include/uapi/asm/errno.h | 1 + tools/arch/x86/include/uapi/asm/kvm.h | 419 + tools/arch/x86/include/uapi/asm/kvm_perf.h | 17 + tools/arch/x86/include/uapi/asm/mman.h | 6 + tools/arch/x86/include/uapi/asm/perf_regs.h | 34 + tools/arch/x86/include/uapi/asm/svm.h | 179 + tools/arch/x86/include/uapi/asm/unistd.h | 18 + tools/arch/x86/include/uapi/asm/vmx.h | 151 + tools/arch/x86/lib/memcpy_64.S | 297 + tools/arch/x86/lib/memset_64.S | 139 + tools/arch/xtensa/include/asm/barrier.h | 18 + tools/arch/xtensa/include/uapi/asm/mman.h | 48 + tools/bpf/.gitignore | 5 + tools/bpf/Makefile | 107 + tools/bpf/Makefile.helpers | 59 + tools/bpf/bpf_asm.c | 52 + tools/bpf/bpf_dbg.c | 1398 ++ tools/bpf/bpf_exp.l | 198 + tools/bpf/bpf_exp.y | 656 + tools/bpf/bpf_jit_disasm.c | 329 + tools/bpf/bpftool/.gitignore | 5 + tools/bpf/bpftool/Documentation/Makefile | 52 + tools/bpf/bpftool/Documentation/bpftool-cgroup.rst | 140 + tools/bpf/bpftool/Documentation/bpftool-map.rst | 161 + tools/bpf/bpftool/Documentation/bpftool-perf.rst | 81 + tools/bpf/bpftool/Documentation/bpftool-prog.rst | 194 + tools/bpf/bpftool/Documentation/bpftool.rst | 61 + tools/bpf/bpftool/Makefile | 132 + tools/bpf/bpftool/bash-completion/bpftool | 559 + tools/bpf/bpftool/btf_dumper.c | 251 + tools/bpf/bpftool/cfg.c | 514 + tools/bpf/bpftool/cfg.h | 43 + tools/bpf/bpftool/cgroup.c | 479 + tools/bpf/bpftool/common.c | 626 + tools/bpf/bpftool/jit_disasm.c | 188 + tools/bpf/bpftool/json_writer.c | 356 + tools/bpf/bpftool/json_writer.h | 72 + tools/bpf/bpftool/main.c | 410 + tools/bpf/bpftool/main.h | 168 + tools/bpf/bpftool/map.c | 1065 ++ tools/bpf/bpftool/map_perf_ring.c | 309 + tools/bpf/bpftool/perf.c | 247 + tools/bpf/bpftool/prog.c | 983 ++ tools/bpf/bpftool/xlated_dumper.c | 346 + tools/bpf/bpftool/xlated_dumper.h | 67 + tools/build/.gitignore | 1 + tools/build/Build | 3 + tools/build/Build.include | 102 + tools/build/Documentation/Build.txt | 168 + tools/build/Makefile | 46 + tools/build/Makefile.build | 162 + tools/build/Makefile.feature | 241 + tools/build/Makefile.include | 9 + tools/build/feature/.gitignore | 3 + tools/build/feature/Makefile | 304 + tools/build/feature/test-all.c | 219 + tools/build/feature/test-backtrace.c | 14 + tools/build/feature/test-bionic.c | 7 + tools/build/feature/test-bpf.c | 42 + tools/build/feature/test-clang.cpp | 22 + tools/build/feature/test-compile.c | 7 + tools/build/feature/test-cplus-demangle.c | 15 + tools/build/feature/test-cxx.cpp | 16 + tools/build/feature/test-disassembler-four-args.c | 15 + tools/build/feature/test-dwarf.c | 11 + tools/build/feature/test-dwarf_getlocations.c | 13 + tools/build/feature/test-eventfd.c | 9 + tools/build/feature/test-fortify-source.c | 6 + tools/build/feature/test-get_cpuid.c | 8 + tools/build/feature/test-get_current_dir_name.c | 10 + tools/build/feature/test-gettid.c | 11 + tools/build/feature/test-glibc.c | 20 + tools/build/feature/test-gtk2-infobar.c | 12 + tools/build/feature/test-gtk2.c | 11 + tools/build/feature/test-hello.c | 6 + tools/build/feature/test-jvmti.c | 14 + tools/build/feature/test-libaudit.c | 11 + tools/build/feature/test-libbabeltrace.c | 10 + tools/build/feature/test-libbfd.c | 16 + tools/build/feature/test-libcrypto.c | 18 + tools/build/feature/test-libdw-dwarf-unwind.c | 14 + tools/build/feature/test-libelf-gelf_getnote.c | 8 + tools/build/feature/test-libelf-getphdrnum.c | 9 + tools/build/feature/test-libelf-getshdrstrndx.c | 9 + tools/build/feature/test-libelf-mmap.c | 9 + tools/build/feature/test-libelf.c | 9 + tools/build/feature/test-libnuma.c | 10 + tools/build/feature/test-libopencsd.c | 8 + tools/build/feature/test-libperl.c | 10 + tools/build/feature/test-libpython.c | 9 + tools/build/feature/test-libslang.c | 7 + tools/build/feature/test-libunwind-aarch64.c | 27 + tools/build/feature/test-libunwind-arm.c | 28 + .../feature/test-libunwind-debug-frame-aarch64.c | 17 + .../build/feature/test-libunwind-debug-frame-arm.c | 17 + tools/build/feature/test-libunwind-debug-frame.c | 17 + tools/build/feature/test-libunwind-x86.c | 28 + tools/build/feature/test-libunwind-x86_64.c | 28 + tools/build/feature/test-libunwind.c | 28 + tools/build/feature/test-llvm-version.cpp | 12 + tools/build/feature/test-llvm.cpp | 14 + tools/build/feature/test-lzma.c | 11 + tools/build/feature/test-numa_num_possible_cpus.c | 7 + .../feature/test-pthread-attr-setaffinity-np.c | 18 + tools/build/feature/test-pthread-barrier.c | 12 + tools/build/feature/test-reallocarray.c | 8 + tools/build/feature/test-sched_getcpu.c | 10 + tools/build/feature/test-sdt.c | 8 + tools/build/feature/test-setns.c | 7 + tools/build/feature/test-stackprotector-all.c | 7 + tools/build/feature/test-sync-compare-and-swap.c | 15 + tools/build/feature/test-timerfd.c | 19 + tools/build/feature/test-zlib.c | 10 + tools/build/fixdep.c | 170 + tools/build/tests/ex/Build | 11 + tools/build/tests/ex/Makefile | 27 + tools/build/tests/ex/a.c | 6 + tools/build/tests/ex/arch/Build | 2 + tools/build/tests/ex/arch/e.c | 6 + tools/build/tests/ex/arch/f.c | 6 + tools/build/tests/ex/b.c | 6 + tools/build/tests/ex/c.c | 6 + tools/build/tests/ex/d.c | 6 + tools/build/tests/ex/empty/Build | 0 tools/build/tests/ex/empty2/README | 2 + tools/build/tests/ex/ex.c | 22 + tools/build/tests/ex/inc.c | 9 + tools/build/tests/run.sh | 70 + tools/cgroup/.gitignore | 1 + tools/cgroup/Makefile | 11 + tools/cgroup/cgroup_event_listener.c | 83 + tools/firewire/Makefile | 20 + tools/firewire/decode-fcp.c | 214 + tools/firewire/list.h | 63 + tools/firewire/nosy-dump.c | 1035 ++ tools/firewire/nosy-dump.h | 174 + tools/gpio/.gitignore | 4 + tools/gpio/Build | 4 + tools/gpio/Makefile | 82 + tools/gpio/gpio-event-mon.c | 194 + tools/gpio/gpio-hammer.c | 171 + tools/gpio/gpio-utils.c | 270 + tools/gpio/gpio-utils.h | 43 + tools/gpio/lsgpio.c | 195 + tools/hv/Makefile | 35 + tools/hv/hv_fcopy_daemon.c | 248 + tools/hv/hv_get_dhcp_info.sh | 29 + tools/hv/hv_get_dns_info.sh | 13 + tools/hv/hv_kvp_daemon.c | 1632 +++ tools/hv/hv_set_ifconfig.sh | 65 + tools/hv/hv_vss_daemon.c | 339 + tools/hv/lsvmbus | 112 + tools/iio/Build | 3 + tools/iio/Makefile | 66 + tools/iio/iio_event_monitor.c | 358 + tools/iio/iio_generic_buffer.c | 693 + tools/iio/iio_utils.c | 994 ++ tools/iio/iio_utils.h | 85 + tools/iio/lsiio.c | 191 + tools/include/asm-generic/atomic-gcc.h | 72 + tools/include/asm-generic/barrier.h | 44 + tools/include/asm-generic/bitops.h | 31 + tools/include/asm-generic/bitops/__ffs.h | 45 + tools/include/asm-generic/bitops/__ffz.h | 12 + tools/include/asm-generic/bitops/__fls.h | 44 + tools/include/asm-generic/bitops/arch_hweight.h | 26 + tools/include/asm-generic/bitops/atomic.h | 27 + tools/include/asm-generic/bitops/const_hweight.h | 44 + tools/include/asm-generic/bitops/find.h | 78 + tools/include/asm-generic/bitops/fls.h | 42 + tools/include/asm-generic/bitops/fls64.h | 37 + tools/include/asm-generic/bitops/hweight.h | 8 + tools/include/asm-generic/bitsperlong.h | 21 + tools/include/asm-generic/hugetlb_encode.h | 34 + tools/include/asm/alternative-asm.h | 10 + tools/include/asm/atomic.h | 11 + tools/include/asm/barrier.h | 28 + tools/include/asm/bug.h | 45 + tools/include/asm/export.h | 7 + tools/include/asm/sections.h | 4 + tools/include/linux/atomic.h | 13 + tools/include/linux/bitmap.h | 150 + tools/include/linux/bitops.h | 72 + tools/include/linux/bits.h | 26 + tools/include/linux/bug.h | 11 + tools/include/linux/compiler-gcc.h | 42 + tools/include/linux/compiler.h | 175 + tools/include/linux/coresight-pmu.h | 34 + tools/include/linux/debug_locks.h | 14 + tools/include/linux/delay.h | 4 + tools/include/linux/err.h | 55 + tools/include/linux/export.h | 10 + tools/include/linux/filter.h | 286 + tools/include/linux/ftrace.h | 4 + tools/include/linux/gfp.h | 4 + tools/include/linux/hardirq.h | 12 + tools/include/linux/hash.h | 104 + tools/include/linux/hashtable.h | 149 + tools/include/linux/interrupt.h | 4 + tools/include/linux/irqflags.h | 39 + tools/include/linux/jhash.h | 175 + tools/include/linux/kallsyms.h | 34 + tools/include/linux/kern_levels.h | 26 + tools/include/linux/kernel.h | 120 + tools/include/linux/linkage.h | 4 + tools/include/linux/list.h | 772 ++ tools/include/linux/lockdep.h | 72 + tools/include/linux/log2.h | 179 + tools/include/linux/module.h | 12 + tools/include/linux/mutex.h | 4 + tools/include/linux/nmi.h | 0 tools/include/linux/overflow.h | 278 + tools/include/linux/poison.h | 96 + tools/include/linux/proc_fs.h | 4 + tools/include/linux/rbtree.h | 104 + tools/include/linux/rbtree_augmented.h | 245 + tools/include/linux/rcu.h | 25 + tools/include/linux/refcount.h | 152 + tools/include/linux/sched/clock.h | 4 + tools/include/linux/sched/mm.h | 4 + tools/include/linux/sched/task.h | 4 + tools/include/linux/seq_file.h | 4 + tools/include/linux/spinlock.h | 34 + tools/include/linux/stacktrace.h | 33 + tools/include/linux/string.h | 40 + tools/include/linux/stringify.h | 13 + tools/include/linux/time64.h | 13 + tools/include/linux/types.h | 81 + tools/include/linux/unaligned/packed_struct.h | 47 + tools/include/tools/be_byteshift.h | 71 + tools/include/tools/config.h | 34 + tools/include/tools/endian.h | 57 + tools/include/tools/le_byteshift.h | 71 + tools/include/tools/libc_compat.h | 20 + tools/include/trace/events/lock.h | 4 + tools/include/uapi/asm-generic/bitsperlong.h | 15 + tools/include/uapi/asm-generic/bpf_perf_event.h | 9 + tools/include/uapi/asm-generic/errno-base.h | 40 + tools/include/uapi/asm-generic/errno.h | 123 + tools/include/uapi/asm-generic/fcntl.h | 220 + tools/include/uapi/asm-generic/ioctls.h | 119 + tools/include/uapi/asm-generic/mman-common.h | 77 + tools/include/uapi/asm-generic/mman.h | 24 + tools/include/uapi/asm-generic/unistd.h | 785 ++ tools/include/uapi/asm/bitsperlong.h | 22 + tools/include/uapi/asm/bpf_perf_event.h | 7 + tools/include/uapi/asm/errno.h | 18 + tools/include/uapi/drm/drm.h | 1012 ++ tools/include/uapi/drm/i915_drm.h | 1724 +++ tools/include/uapi/linux/bpf.h | 2796 ++++ tools/include/uapi/linux/bpf_common.h | 57 + tools/include/uapi/linux/bpf_perf_event.h | 18 + tools/include/uapi/linux/btf.h | 113 + tools/include/uapi/linux/erspan.h | 52 + tools/include/uapi/linux/fcntl.h | 94 + tools/include/uapi/linux/hw_breakpoint.h | 35 + tools/include/uapi/linux/if_link.h | 1002 ++ tools/include/uapi/linux/in.h | 304 + tools/include/uapi/linux/kcmp.h | 28 + tools/include/uapi/linux/kvm.h | 1552 +++ tools/include/uapi/linux/lirc.h | 217 + tools/include/uapi/linux/mman.h | 36 + tools/include/uapi/linux/netlink.h | 251 + tools/include/uapi/linux/perf_event.h | 1130 ++ tools/include/uapi/linux/prctl.h | 223 + tools/include/uapi/linux/sched.h | 58 + tools/include/uapi/linux/seg6.h | 55 + tools/include/uapi/linux/seg6_local.h | 80 + tools/include/uapi/linux/stat.h | 174 + tools/include/uapi/linux/vhost.h | 228 + tools/include/uapi/sound/asound.h | 1037 ++ tools/kvm/kvm_stat/Makefile | 42 + tools/kvm/kvm_stat/kvm_stat | 1716 +++ tools/kvm/kvm_stat/kvm_stat.txt | 105 + tools/laptop/dslm/.gitignore | 1 + tools/laptop/dslm/Makefile | 10 + tools/laptop/dslm/dslm.c | 166 + tools/laptop/freefall/Makefile | 17 + tools/laptop/freefall/freefall.c | 174 + tools/leds/.gitignore | 1 + tools/leds/Makefile | 13 + tools/leds/led_hw_brightness_mon.c | 85 + tools/leds/uledmon.c | 64 + tools/lib/api/Build | 9 + tools/lib/api/Makefile | 67 + tools/lib/api/cpu.c | 19 + tools/lib/api/cpu.h | 7 + tools/lib/api/debug-internal.h | 21 + tools/lib/api/debug.c | 29 + tools/lib/api/debug.h | 11 + tools/lib/api/fd/Build | 1 + tools/lib/api/fd/array.c | 128 + tools/lib/api/fd/array.h | 49 + tools/lib/api/fs/Build | 2 + tools/lib/api/fs/fs.c | 558 + tools/lib/api/fs/fs.h | 60 + tools/lib/api/fs/tracing_path.c | 167 + tools/lib/api/fs/tracing_path.h | 22 + tools/lib/bitmap.c | 75 + tools/lib/bpf/.gitignore | 2 + tools/lib/bpf/Build | 1 + tools/lib/bpf/Makefile | 221 + tools/lib/bpf/bpf.c | 691 + tools/lib/bpf/bpf.h | 115 + tools/lib/bpf/btf.c | 395 + tools/lib/bpf/btf.h | 26 + tools/lib/bpf/libbpf.c | 2431 ++++ tools/lib/bpf/libbpf.h | 300 + tools/lib/bpf/libbpf_errno.c | 75 + tools/lib/bpf/nlattr.c | 187 + tools/lib/bpf/nlattr.h | 72 + tools/lib/bpf/str_error.c | 18 + tools/lib/bpf/str_error.h | 6 + tools/lib/find_bit.c | 128 + tools/lib/hweight.c | 63 + tools/lib/lockdep/.gitignore | 1 + tools/lib/lockdep/Build | 1 + tools/lib/lockdep/Makefile | 162 + tools/lib/lockdep/common.c | 29 + tools/lib/lockdep/include/liblockdep/common.h | 52 + tools/lib/lockdep/include/liblockdep/mutex.h | 71 + tools/lib/lockdep/include/liblockdep/rwlock.h | 87 + tools/lib/lockdep/lockdep | 3 + tools/lib/lockdep/lockdep.c | 28 + tools/lib/lockdep/lockdep_internals.h | 1 + tools/lib/lockdep/lockdep_states.h | 1 + tools/lib/lockdep/preload.c | 443 + tools/lib/lockdep/rbtree.c | 1 + tools/lib/lockdep/run_tests.sh | 32 + tools/lib/lockdep/tests/AA.c | 14 + tools/lib/lockdep/tests/ABA.c | 14 + tools/lib/lockdep/tests/ABBA.c | 14 + tools/lib/lockdep/tests/ABBA_2threads.c | 47 + tools/lib/lockdep/tests/ABBCCA.c | 16 + tools/lib/lockdep/tests/ABBCCDDA.c | 18 + tools/lib/lockdep/tests/ABCABC.c | 16 + tools/lib/lockdep/tests/ABCDBCDA.c | 18 + tools/lib/lockdep/tests/ABCDBDDA.c | 18 + tools/lib/lockdep/tests/WW.c | 14 + tools/lib/lockdep/tests/common.h | 13 + tools/lib/lockdep/tests/unlock_balance.c | 13 + tools/lib/rbtree.c | 548 + tools/lib/str_error_r.c | 27 + tools/lib/string.c | 115 + tools/lib/subcmd/Build | 7 + tools/lib/subcmd/Makefile | 69 + tools/lib/subcmd/exec-cmd.c | 210 + tools/lib/subcmd/exec-cmd.h | 17 + tools/lib/subcmd/help.c | 270 + tools/lib/subcmd/help.h | 36 + tools/lib/subcmd/pager.c | 120 + tools/lib/subcmd/pager.h | 11 + tools/lib/subcmd/parse-options.c | 1006 ++ tools/lib/subcmd/parse-options.h | 242 + tools/lib/subcmd/run-command.c | 229 + tools/lib/subcmd/run-command.h | 61 + tools/lib/subcmd/sigchain.c | 54 + tools/lib/subcmd/sigchain.h | 11 + tools/lib/subcmd/subcmd-config.c | 12 + tools/lib/subcmd/subcmd-config.h | 15 + tools/lib/subcmd/subcmd-util.h | 76 + tools/lib/symbol/kallsyms.c | 76 + tools/lib/symbol/kallsyms.h | 29 + tools/lib/traceevent/.gitignore | 3 + tools/lib/traceevent/Build | 17 + tools/lib/traceevent/Makefile | 301 + tools/lib/traceevent/event-parse.c | 6892 ++++++++++ tools/lib/traceevent/event-parse.h | 991 ++ tools/lib/traceevent/event-plugin.c | 444 + tools/lib/traceevent/event-utils.h | 67 + tools/lib/traceevent/kbuffer-parse.c | 729 + tools/lib/traceevent/kbuffer.h | 68 + tools/lib/traceevent/parse-filter.c | 2445 ++++ tools/lib/traceevent/parse-utils.c | 71 + tools/lib/traceevent/plugin_cfg80211.c | 43 + tools/lib/traceevent/plugin_function.c | 194 + tools/lib/traceevent/plugin_hrtimer.c | 88 + tools/lib/traceevent/plugin_jbd2.c | 75 + tools/lib/traceevent/plugin_kmem.c | 94 + tools/lib/traceevent/plugin_kvm.c | 522 + tools/lib/traceevent/plugin_mac80211.c | 102 + tools/lib/traceevent/plugin_sched_switch.c | 160 + tools/lib/traceevent/plugin_scsi.c | 433 + tools/lib/traceevent/plugin_xen.c | 137 + tools/lib/traceevent/trace-seq.c | 240 + tools/lib/vsprintf.c | 25 + tools/memory-model/Documentation/cheatsheet.txt | 30 + tools/memory-model/Documentation/explanation.txt | 1896 +++ tools/memory-model/Documentation/recipes.txt | 570 + tools/memory-model/Documentation/references.txt | 114 + tools/memory-model/README | 206 + tools/memory-model/linux-kernel.bell | 52 + tools/memory-model/linux-kernel.cat | 128 + tools/memory-model/linux-kernel.cfg | 21 + tools/memory-model/linux-kernel.def | 108 + tools/memory-model/litmus-tests/.gitignore | 1 + .../litmus-tests/CoRR+poonceonce+Once.litmus | 26 + .../litmus-tests/CoRW+poonceonce+Once.litmus | 25 + .../litmus-tests/CoWR+poonceonce+Once.litmus | 25 + .../litmus-tests/CoWW+poonceonce.litmus | 18 + .../IRIW+fencembonceonces+OnceOnce.litmus | 45 + .../litmus-tests/IRIW+poonceonces+OnceOnce.litmus | 43 + .../ISA2+pooncelock+pooncelock+pombonce.litmus | 41 + .../litmus-tests/ISA2+poonceonces.litmus | 37 + ...cerelease+poacquirerelease+poacquireonce.litmus | 39 + .../LB+fencembonceonce+ctrlonceonce.litmus | 34 + .../LB+poacquireonce+pooncerelease.litmus | 29 + .../litmus-tests/LB+poonceonces.litmus | 28 + .../MP+fencewmbonceonce+fencermbonceonce.litmus | 30 + .../litmus-tests/MP+onceassign+derefonce.litmus | 34 + .../MP+polockmbonce+poacquiresilsil.litmus | 35 + .../MP+polockonce+poacquiresilsil.litmus | 34 + tools/memory-model/litmus-tests/MP+polocks.litmus | 35 + .../litmus-tests/MP+poonceonces.litmus | 27 + .../MP+pooncerelease+poacquireonce.litmus | 28 + .../memory-model/litmus-tests/MP+porevlocks.litmus | 35 + .../litmus-tests/R+fencembonceonces.litmus | 30 + .../memory-model/litmus-tests/R+poonceonces.litmus | 27 + tools/memory-model/litmus-tests/README | 153 + .../S+fencewmbonceonce+poacquireonce.litmus | 27 + .../memory-model/litmus-tests/S+poonceonces.litmus | 28 + .../litmus-tests/SB+fencembonceonces.litmus | 32 + .../litmus-tests/SB+poonceonces.litmus | 29 + .../litmus-tests/SB+rfionceonce-poonceonces.litmus | 32 + .../litmus-tests/WRC+poonceonces+Once.litmus | 35 + .../WRC+pooncerelease+fencermbonceonce+Once.litmus | 38 + .../Z6.0+pooncelock+poonceLock+pombonce.litmus | 42 + .../Z6.0+pooncelock+pooncelock+pombonce.litmus | 40 + ...release+poacquirerelease+fencembonceonce.litmus | 42 + tools/memory-model/lock.cat | 146 + tools/memory-model/scripts/checkalllitmus.sh | 73 + tools/memory-model/scripts/checklitmus.sh | 86 + tools/nfsd/inject_fault.sh | 50 + tools/objtool/.gitignore | 3 + tools/objtool/Build | 22 + tools/objtool/Documentation/stack-validation.txt | 317 + tools/objtool/Makefile | 64 + tools/objtool/arch.h | 82 + tools/objtool/arch/x86/Build | 12 + tools/objtool/arch/x86/decode.c | 496 + tools/objtool/arch/x86/include/asm/inat.h | 244 + tools/objtool/arch/x86/include/asm/inat_types.h | 29 + tools/objtool/arch/x86/include/asm/insn.h | 244 + tools/objtool/arch/x86/include/asm/orc_types.h | 109 + tools/objtool/arch/x86/lib/inat.c | 97 + tools/objtool/arch/x86/lib/insn.c | 606 + tools/objtool/arch/x86/lib/x86-opcode-map.txt | 1078 ++ tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk | 393 + tools/objtool/builtin-check.c | 59 + tools/objtool/builtin-orc.c | 68 + tools/objtool/builtin.h | 28 + tools/objtool/cfi.h | 55 + tools/objtool/check.c | 2281 ++++ tools/objtool/check.h | 82 + tools/objtool/elf.c | 693 + tools/objtool/elf.h | 107 + tools/objtool/objtool.c | 134 + tools/objtool/orc.h | 30 + tools/objtool/orc_dump.c | 224 + tools/objtool/orc_gen.c | 242 + tools/objtool/special.c | 193 + tools/objtool/special.h | 42 + tools/objtool/sync-check.sh | 29 + tools/objtool/warn.h | 70 + tools/pci/pcitest.c | 233 + tools/pci/pcitest.sh | 72 + tools/pcmcia/.gitignore | 1 + tools/pcmcia/Makefile | 10 + tools/pcmcia/crc32hash.c | 32 + tools/perf/.gitignore | 36 + tools/perf/Build | 55 + tools/perf/CREDITS | 30 + tools/perf/Documentation/Build.txt | 49 + tools/perf/Documentation/Makefile | 362 + tools/perf/Documentation/android.txt | 78 + tools/perf/Documentation/asciidoc.conf | 91 + tools/perf/Documentation/asciidoctor-extensions.rb | 29 + .../callchain-overhead-calculation.txt | 108 + tools/perf/Documentation/examples.txt | 225 + tools/perf/Documentation/intel-bts.txt | 86 + tools/perf/Documentation/intel-pt.txt | 891 ++ tools/perf/Documentation/itrace.txt | 36 + tools/perf/Documentation/jit-interface.txt | 15 + tools/perf/Documentation/jitdump-specification.txt | 170 + tools/perf/Documentation/manpage-1.72.xsl | 14 + tools/perf/Documentation/manpage-base.xsl | 35 + tools/perf/Documentation/manpage-bold-literal.xsl | 17 + tools/perf/Documentation/manpage-normal.xsl | 13 + tools/perf/Documentation/manpage-suppress-sp.xsl | 21 + tools/perf/Documentation/perf-annotate.txt | 132 + tools/perf/Documentation/perf-archive.txt | 22 + tools/perf/Documentation/perf-bench.txt | 209 + tools/perf/Documentation/perf-buildid-cache.txt | 79 + tools/perf/Documentation/perf-buildid-list.txt | 43 + tools/perf/Documentation/perf-c2c.txt | 290 + tools/perf/Documentation/perf-config.txt | 520 + tools/perf/Documentation/perf-data.txt | 48 + tools/perf/Documentation/perf-diff.txt | 227 + tools/perf/Documentation/perf-evlist.txt | 45 + tools/perf/Documentation/perf-ftrace.txt | 87 + tools/perf/Documentation/perf-help.txt | 38 + tools/perf/Documentation/perf-inject.txt | 69 + tools/perf/Documentation/perf-kallsyms.txt | 24 + tools/perf/Documentation/perf-kmem.txt | 77 + tools/perf/Documentation/perf-kvm.txt | 164 + tools/perf/Documentation/perf-list.txt | 291 + tools/perf/Documentation/perf-lock.txt | 70 + tools/perf/Documentation/perf-mem.txt | 92 + tools/perf/Documentation/perf-probe.txt | 299 + tools/perf/Documentation/perf-record.txt | 509 + tools/perf/Documentation/perf-report.txt | 493 + tools/perf/Documentation/perf-sched.txt | 167 + tools/perf/Documentation/perf-script-perl.txt | 216 + tools/perf/Documentation/perf-script-python.txt | 641 + tools/perf/Documentation/perf-script.txt | 389 + tools/perf/Documentation/perf-stat.txt | 378 + tools/perf/Documentation/perf-test.txt | 36 + tools/perf/Documentation/perf-timechart.txt | 128 + tools/perf/Documentation/perf-top.txt | 294 + tools/perf/Documentation/perf-trace.txt | 243 + tools/perf/Documentation/perf-version.txt | 24 + tools/perf/Documentation/perf.data-file-format.txt | 497 + tools/perf/Documentation/perf.txt | 49 + tools/perf/Documentation/perfconfig.example | 38 + tools/perf/Documentation/tips.txt | 36 + tools/perf/MANIFEST | 18 + tools/perf/Makefile | 112 + tools/perf/Makefile.config | 1048 ++ tools/perf/Makefile.perf | 901 ++ tools/perf/arch/Build | 2 + tools/perf/arch/alpha/Build | 1 + tools/perf/arch/arm/Build | 2 + tools/perf/arch/arm/Makefile | 4 + tools/perf/arch/arm/annotate/instructions.c | 61 + tools/perf/arch/arm/include/arch-tests.h | 12 + tools/perf/arch/arm/include/dwarf-regs-table.h | 10 + tools/perf/arch/arm/include/perf_regs.h | 60 + tools/perf/arch/arm/tests/Build | 4 + tools/perf/arch/arm/tests/arch-tests.c | 16 + tools/perf/arch/arm/tests/dwarf-unwind.c | 62 + tools/perf/arch/arm/tests/regs_load.S | 59 + tools/perf/arch/arm/util/Build | 6 + tools/perf/arch/arm/util/auxtrace.c | 108 + tools/perf/arch/arm/util/cs-etm.c | 770 ++ tools/perf/arch/arm/util/cs-etm.h | 15 + tools/perf/arch/arm/util/dwarf-regs.c | 64 + tools/perf/arch/arm/util/pmu.c | 31 + tools/perf/arch/arm/util/unwind-libdw.c | 38 + tools/perf/arch/arm/util/unwind-libunwind.c | 50 + tools/perf/arch/arm64/Build | 2 + tools/perf/arch/arm64/Makefile | 28 + tools/perf/arch/arm64/annotate/instructions.c | 64 + tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | 62 + tools/perf/arch/arm64/include/arch-tests.h | 12 + tools/perf/arch/arm64/include/dwarf-regs-table.h | 14 + tools/perf/arch/arm64/include/perf_regs.h | 94 + tools/perf/arch/arm64/tests/Build | 4 + tools/perf/arch/arm64/tests/arch-tests.c | 16 + tools/perf/arch/arm64/tests/dwarf-unwind.c | 62 + tools/perf/arch/arm64/tests/regs_load.S | 47 + tools/perf/arch/arm64/util/Build | 10 + tools/perf/arch/arm64/util/arm-spe.c | 226 + tools/perf/arch/arm64/util/dwarf-regs.c | 96 + tools/perf/arch/arm64/util/header.c | 65 + tools/perf/arch/arm64/util/sym-handling.c | 22 + tools/perf/arch/arm64/util/unwind-libdw.c | 60 + tools/perf/arch/arm64/util/unwind-libunwind.c | 86 + tools/perf/arch/common.c | 212 + tools/perf/arch/common.h | 10 + tools/perf/arch/mips/Build | 1 + tools/perf/arch/parisc/Build | 1 + tools/perf/arch/powerpc/Build | 2 + tools/perf/arch/powerpc/Makefile | 33 + tools/perf/arch/powerpc/annotate/instructions.c | 61 + .../perf/arch/powerpc/entry/syscalls/mksyscalltbl | 37 + tools/perf/arch/powerpc/include/arch-tests.h | 14 + tools/perf/arch/powerpc/include/dwarf-regs-table.h | 28 + tools/perf/arch/powerpc/include/perf_regs.h | 72 + tools/perf/arch/powerpc/tests/Build | 4 + tools/perf/arch/powerpc/tests/arch-tests.c | 16 + tools/perf/arch/powerpc/tests/dwarf-unwind.c | 63 + tools/perf/arch/powerpc/tests/regs_load.S | 95 + tools/perf/arch/powerpc/util/Build | 10 + tools/perf/arch/powerpc/util/book3s_hcalls.h | 124 + tools/perf/arch/powerpc/util/book3s_hv_exits.h | 34 + tools/perf/arch/powerpc/util/dwarf-regs.c | 105 + tools/perf/arch/powerpc/util/header.c | 47 + tools/perf/arch/powerpc/util/kvm-stat.c | 172 + tools/perf/arch/powerpc/util/perf_regs.c | 162 + tools/perf/arch/powerpc/util/skip-callchain-idx.c | 283 + tools/perf/arch/powerpc/util/sym-handling.c | 155 + tools/perf/arch/powerpc/util/unwind-libdw.c | 74 + tools/perf/arch/powerpc/util/unwind-libunwind.c | 96 + tools/perf/arch/s390/Build | 1 + tools/perf/arch/s390/Makefile | 30 + tools/perf/arch/s390/annotate/instructions.c | 174 + tools/perf/arch/s390/entry/syscalls/mksyscalltbl | 32 + tools/perf/arch/s390/entry/syscalls/syscall.tbl | 390 + tools/perf/arch/s390/include/dwarf-regs-table.h | 72 + tools/perf/arch/s390/include/perf_regs.h | 95 + tools/perf/arch/s390/util/Build | 9 + tools/perf/arch/s390/util/auxtrace.c | 120 + tools/perf/arch/s390/util/dwarf-regs.c | 44 + tools/perf/arch/s390/util/header.c | 149 + tools/perf/arch/s390/util/kvm-stat.c | 112 + tools/perf/arch/s390/util/machine.c | 52 + tools/perf/arch/s390/util/unwind-libdw.c | 63 + tools/perf/arch/sh/Build | 1 + tools/perf/arch/sh/Makefile | 3 + tools/perf/arch/sh/include/dwarf-regs-table.h | 26 + tools/perf/arch/sh/util/Build | 1 + tools/perf/arch/sh/util/dwarf-regs.c | 55 + tools/perf/arch/sparc/Build | 1 + tools/perf/arch/sparc/Makefile | 3 + tools/perf/arch/sparc/include/dwarf-regs-table.h | 19 + tools/perf/arch/sparc/util/Build | 1 + tools/perf/arch/sparc/util/dwarf-regs.c | 43 + tools/perf/arch/x86/Build | 2 + tools/perf/arch/x86/Makefile | 27 + tools/perf/arch/x86/annotate/instructions.c | 204 + tools/perf/arch/x86/entry/syscalls/syscall_64.tbl | 388 + tools/perf/arch/x86/entry/syscalls/syscalltbl.sh | 40 + tools/perf/arch/x86/include/arch-tests.h | 23 + tools/perf/arch/x86/include/dwarf-regs-table.h | 15 + tools/perf/arch/x86/include/perf_regs.h | 87 + tools/perf/arch/x86/tests/Build | 8 + tools/perf/arch/x86/tests/arch-tests.c | 37 + tools/perf/arch/x86/tests/bp-modify.c | 213 + tools/perf/arch/x86/tests/dwarf-unwind.c | 63 + tools/perf/arch/x86/tests/gen-insn-x86-dat.awk | 75 + tools/perf/arch/x86/tests/gen-insn-x86-dat.sh | 43 + tools/perf/arch/x86/tests/insn-x86-dat-32.c | 1679 +++ tools/perf/arch/x86/tests/insn-x86-dat-64.c | 1729 +++ tools/perf/arch/x86/tests/insn-x86-dat-src.c | 2693 ++++ tools/perf/arch/x86/tests/insn-x86.c | 186 + tools/perf/arch/x86/tests/intel-cqm.c | 128 + tools/perf/arch/x86/tests/perf-time-to-tsc.c | 168 + tools/perf/arch/x86/tests/rdpmc.c | 180 + tools/perf/arch/x86/tests/regs_load.S | 99 + tools/perf/arch/x86/util/Build | 18 + tools/perf/arch/x86/util/auxtrace.c | 80 + tools/perf/arch/x86/util/dwarf-regs.c | 129 + tools/perf/arch/x86/util/event.c | 76 + tools/perf/arch/x86/util/group.c | 28 + tools/perf/arch/x86/util/header.c | 79 + tools/perf/arch/x86/util/intel-bts.c | 462 + tools/perf/arch/x86/util/intel-pt.c | 1122 ++ tools/perf/arch/x86/util/kvm-stat.c | 166 + tools/perf/arch/x86/util/machine.c | 103 + tools/perf/arch/x86/util/perf_regs.c | 256 + tools/perf/arch/x86/util/pmu.c | 20 + tools/perf/arch/x86/util/tsc.c | 82 + tools/perf/arch/x86/util/unwind-libdw.c | 53 + tools/perf/arch/x86/util/unwind-libunwind.c | 115 + tools/perf/arch/xtensa/Build | 1 + tools/perf/arch/xtensa/Makefile | 3 + tools/perf/arch/xtensa/include/dwarf-regs-table.h | 9 + tools/perf/arch/xtensa/util/Build | 1 + tools/perf/arch/xtensa/util/dwarf-regs.c | 25 + tools/perf/bench/Build | 14 + tools/perf/bench/bench.h | 55 + tools/perf/bench/futex-hash.c | 227 + tools/perf/bench/futex-lock-pi.c | 229 + tools/perf/bench/futex-requeue.c | 221 + tools/perf/bench/futex-wake-parallel.c | 323 + tools/perf/bench/futex-wake.c | 212 + tools/perf/bench/futex.h | 101 + tools/perf/bench/mem-functions.c | 374 + tools/perf/bench/mem-memcpy-arch.h | 13 + tools/perf/bench/mem-memcpy-x86-64-asm-def.h | 13 + tools/perf/bench/mem-memcpy-x86-64-asm.S | 17 + tools/perf/bench/mem-memcpy-x86-64-lib.c | 24 + tools/perf/bench/mem-memset-arch.h | 13 + tools/perf/bench/mem-memset-x86-64-asm-def.h | 13 + tools/perf/bench/mem-memset-x86-64-asm.S | 12 + tools/perf/bench/numa.c | 1844 +++ tools/perf/bench/sched-messaging.c | 332 + tools/perf/bench/sched-pipe.c | 186 + tools/perf/builtin-annotate.c | 639 + tools/perf/builtin-bench.c | 293 + tools/perf/builtin-buildid-cache.c | 527 + tools/perf/builtin-buildid-list.c | 119 + tools/perf/builtin-c2c.c | 2987 +++++ tools/perf/builtin-config.c | 260 + tools/perf/builtin-data.c | 128 + tools/perf/builtin-diff.c | 1363 ++ tools/perf/builtin-evlist.c | 81 + tools/perf/builtin-ftrace.c | 521 + tools/perf/builtin-help.c | 493 + tools/perf/builtin-inject.c | 876 ++ tools/perf/builtin-kallsyms.c | 68 + tools/perf/builtin-kmem.c | 2020 +++ tools/perf/builtin-kvm.c | 1641 +++ tools/perf/builtin-list.c | 127 + tools/perf/builtin-lock.c | 1034 ++ tools/perf/builtin-mem.c | 459 + tools/perf/builtin-probe.c | 748 ++ tools/perf/builtin-record.c | 1902 +++ tools/perf/builtin-report.c | 1404 ++ tools/perf/builtin-sched.c | 3532 +++++ tools/perf/builtin-script.c | 3542 +++++ tools/perf/builtin-stat.c | 3154 +++++ tools/perf/builtin-timechart.c | 2018 +++ tools/perf/builtin-top.c | 1518 +++ tools/perf/builtin-trace.c | 3387 +++++ tools/perf/builtin-version.c | 95 + tools/perf/builtin.h | 44 + tools/perf/check-headers.sh | 108 + tools/perf/command-list.txt | 32 + tools/perf/design.txt | 462 + tools/perf/examples/bpf/5sec.c | 49 + tools/perf/examples/bpf/augmented_syscalls.c | 55 + tools/perf/examples/bpf/empty.c | 3 + tools/perf/examples/bpf/hello.c | 9 + tools/perf/examples/bpf/sys_enter_openat.c | 33 + tools/perf/include/bpf/bpf.h | 36 + tools/perf/include/bpf/stdio.h | 19 + tools/perf/jvmti/Build | 8 + tools/perf/jvmti/jvmti_agent.c | 496 + tools/perf/jvmti/jvmti_agent.h | 34 + tools/perf/jvmti/libjvmti.c | 422 + tools/perf/perf-archive.sh | 48 + tools/perf/perf-completion.sh | 298 + tools/perf/perf-read-vdso.c | 35 + tools/perf/perf-sys.h | 74 + tools/perf/perf-with-kcore.sh | 259 + tools/perf/perf.c | 539 + tools/perf/perf.h | 93 + tools/perf/pmu-events/Build | 15 + tools/perf/pmu-events/README | 152 + .../arch/arm64/ampere/emag/core-imp-def.json | 32 + .../arch/arm64/arm/cortex-a53/branch.json | 25 + .../pmu-events/arch/arm64/arm/cortex-a53/bus.json | 8 + .../arch/arm64/arm/cortex-a53/cache.json | 27 + .../arch/arm64/arm/cortex-a53/memory.json | 12 + .../arch/arm64/arm/cortex-a53/other.json | 28 + .../arch/arm64/arm/cortex-a53/pipeline.json | 52 + .../pmu-events/arch/arm64/armv8-recommended.json | 452 + .../arch/arm64/cavium/thunderx2/core-imp-def.json | 113 + .../arch/arm64/hisilicon/hip08/core-imp-def.json | 122 + tools/perf/pmu-events/arch/arm64/mapfile.csv | 19 + tools/perf/pmu-events/arch/powerpc/mapfile.csv | 17 + .../perf/pmu-events/arch/powerpc/power8/cache.json | 176 + .../arch/powerpc/power8/floating-point.json | 14 + .../pmu-events/arch/powerpc/power8/frontend.json | 470 + .../pmu-events/arch/powerpc/power8/marked.json | 794 ++ .../pmu-events/arch/powerpc/power8/memory.json | 212 + .../perf/pmu-events/arch/powerpc/power8/other.json | 4064 ++++++ .../pmu-events/arch/powerpc/power8/pipeline.json | 350 + tools/perf/pmu-events/arch/powerpc/power8/pmc.json | 140 + .../arch/powerpc/power8/translation.json | 176 + .../perf/pmu-events/arch/powerpc/power9/cache.json | 107 + .../arch/powerpc/power9/floating-point.json | 32 + .../pmu-events/arch/powerpc/power9/frontend.json | 357 + .../pmu-events/arch/powerpc/power9/marked.json | 627 + .../pmu-events/arch/powerpc/power9/memory.json | 127 + .../perf/pmu-events/arch/powerpc/power9/other.json | 2337 ++++ .../pmu-events/arch/powerpc/power9/pipeline.json | 532 + tools/perf/pmu-events/arch/powerpc/power9/pmc.json | 117 + .../arch/powerpc/power9/translation.json | 227 + tools/perf/pmu-events/arch/s390/cf_z10/basic.json | 86 + tools/perf/pmu-events/arch/s390/cf_z10/crypto.json | 114 + .../perf/pmu-events/arch/s390/cf_z10/extended.json | 128 + tools/perf/pmu-events/arch/s390/cf_z13/basic.json | 86 + tools/perf/pmu-events/arch/s390/cf_z13/crypto.json | 114 + .../perf/pmu-events/arch/s390/cf_z13/extended.json | 394 + .../pmu-events/arch/s390/cf_z13/transaction.json | 7 + tools/perf/pmu-events/arch/s390/cf_z14/basic.json | 58 + tools/perf/pmu-events/arch/s390/cf_z14/crypto.json | 114 + .../perf/pmu-events/arch/s390/cf_z14/extended.json | 373 + .../pmu-events/arch/s390/cf_z14/transaction.json | 7 + tools/perf/pmu-events/arch/s390/cf_z196/basic.json | 86 + .../perf/pmu-events/arch/s390/cf_z196/crypto.json | 114 + .../pmu-events/arch/s390/cf_z196/extended.json | 170 + .../perf/pmu-events/arch/s390/cf_zec12/basic.json | 86 + .../perf/pmu-events/arch/s390/cf_zec12/crypto.json | 114 + .../pmu-events/arch/s390/cf_zec12/extended.json | 247 + .../pmu-events/arch/s390/cf_zec12/transaction.json | 7 + tools/perf/pmu-events/arch/s390/mapfile.csv | 6 + tools/perf/pmu-events/arch/x86/bonnell/cache.json | 746 ++ .../arch/x86/bonnell/floating-point.json | 261 + .../perf/pmu-events/arch/x86/bonnell/frontend.json | 83 + tools/perf/pmu-events/arch/x86/bonnell/memory.json | 154 + tools/perf/pmu-events/arch/x86/bonnell/other.json | 450 + .../perf/pmu-events/arch/x86/bonnell/pipeline.json | 364 + .../arch/x86/bonnell/virtual-memory.json | 124 + .../pmu-events/arch/x86/broadwell/bdw-metrics.json | 164 + .../perf/pmu-events/arch/x86/broadwell/cache.json | 3399 +++++ .../arch/x86/broadwell/floating-point.json | 165 + .../pmu-events/arch/x86/broadwell/frontend.json | 286 + .../perf/pmu-events/arch/x86/broadwell/memory.json | 3045 +++++ .../perf/pmu-events/arch/x86/broadwell/other.json | 44 + .../pmu-events/arch/x86/broadwell/pipeline.json | 1427 ++ .../perf/pmu-events/arch/x86/broadwell/uncore.json | 278 + .../arch/x86/broadwell/virtual-memory.json | 388 + .../arch/x86/broadwellde/bdwde-metrics.json | 164 + .../pmu-events/arch/x86/broadwellde/cache.json | 809 ++ .../arch/x86/broadwellde/floating-point.json | 165 + .../pmu-events/arch/x86/broadwellde/frontend.json | 286 + .../pmu-events/arch/x86/broadwellde/memory.json | 432 + .../pmu-events/arch/x86/broadwellde/other.json | 44 + .../pmu-events/arch/x86/broadwellde/pipeline.json | 1427 ++ .../arch/x86/broadwellde/uncore-cache.json | 317 + .../arch/x86/broadwellde/uncore-memory.json | 86 + .../arch/x86/broadwellde/uncore-power.json | 92 + .../arch/x86/broadwellde/virtual-memory.json | 388 + .../arch/x86/broadwellx/bdx-metrics.json | 164 + .../perf/pmu-events/arch/x86/broadwellx/cache.json | 965 ++ .../arch/x86/broadwellx/floating-point.json | 165 + .../pmu-events/arch/x86/broadwellx/frontend.json | 286 + .../pmu-events/arch/x86/broadwellx/memory.json | 679 + .../perf/pmu-events/arch/x86/broadwellx/other.json | 44 + .../pmu-events/arch/x86/broadwellx/pipeline.json | 1427 ++ .../arch/x86/broadwellx/uncore-cache.json | 317 + .../arch/x86/broadwellx/uncore-interconnect.json | 28 + .../arch/x86/broadwellx/uncore-memory.json | 86 + .../arch/x86/broadwellx/uncore-power.json | 92 + .../arch/x86/broadwellx/virtual-memory.json | 388 + tools/perf/pmu-events/arch/x86/goldmont/cache.json | 2045 +++ .../pmu-events/arch/x86/goldmont/frontend.json | 52 + .../perf/pmu-events/arch/x86/goldmont/memory.json | 294 + tools/perf/pmu-events/arch/x86/goldmont/other.json | 82 + .../pmu-events/arch/x86/goldmont/pipeline.json | 455 + .../arch/x86/goldmont/virtual-memory.json | 75 + .../pmu-events/arch/x86/goldmontplus/cache.json | 1453 ++ .../pmu-events/arch/x86/goldmontplus/frontend.json | 62 + .../pmu-events/arch/x86/goldmontplus/memory.json | 38 + .../pmu-events/arch/x86/goldmontplus/other.json | 98 + .../pmu-events/arch/x86/goldmontplus/pipeline.json | 544 + .../arch/x86/goldmontplus/virtual-memory.json | 218 + tools/perf/pmu-events/arch/x86/haswell/cache.json | 1064 ++ .../arch/x86/haswell/floating-point.json | 83 + .../perf/pmu-events/arch/x86/haswell/frontend.json | 294 + .../pmu-events/arch/x86/haswell/hsw-metrics.json | 158 + tools/perf/pmu-events/arch/x86/haswell/memory.json | 676 + tools/perf/pmu-events/arch/x86/haswell/other.json | 43 + .../perf/pmu-events/arch/x86/haswell/pipeline.json | 1338 ++ tools/perf/pmu-events/arch/x86/haswell/uncore.json | 374 + .../arch/x86/haswell/virtual-memory.json | 484 + tools/perf/pmu-events/arch/x86/haswellx/cache.json | 1100 ++ .../arch/x86/haswellx/floating-point.json | 83 + .../pmu-events/arch/x86/haswellx/frontend.json | 294 + .../pmu-events/arch/x86/haswellx/hsx-metrics.json | 158 + .../perf/pmu-events/arch/x86/haswellx/memory.json | 767 ++ tools/perf/pmu-events/arch/x86/haswellx/other.json | 43 + .../pmu-events/arch/x86/haswellx/pipeline.json | 1338 ++ .../pmu-events/arch/x86/haswellx/uncore-cache.json | 317 + .../arch/x86/haswellx/uncore-interconnect.json | 28 + .../arch/x86/haswellx/uncore-memory.json | 86 + .../pmu-events/arch/x86/haswellx/uncore-power.json | 92 + .../arch/x86/haswellx/virtual-memory.json | 484 + .../perf/pmu-events/arch/x86/ivybridge/cache.json | 1102 ++ .../arch/x86/ivybridge/floating-point.json | 151 + .../pmu-events/arch/x86/ivybridge/frontend.json | 305 + .../pmu-events/arch/x86/ivybridge/ivb-metrics.json | 164 + .../perf/pmu-events/arch/x86/ivybridge/memory.json | 236 + .../perf/pmu-events/arch/x86/ivybridge/other.json | 44 + .../pmu-events/arch/x86/ivybridge/pipeline.json | 1309 ++ .../perf/pmu-events/arch/x86/ivybridge/uncore.json | 314 + .../arch/x86/ivybridge/virtual-memory.json | 180 + tools/perf/pmu-events/arch/x86/ivytown/cache.json | 1260 ++ .../arch/x86/ivytown/floating-point.json | 151 + .../perf/pmu-events/arch/x86/ivytown/frontend.json | 305 + .../pmu-events/arch/x86/ivytown/ivt-metrics.json | 164 + tools/perf/pmu-events/arch/x86/ivytown/memory.json | 503 + tools/perf/pmu-events/arch/x86/ivytown/other.json | 44 + .../perf/pmu-events/arch/x86/ivytown/pipeline.json | 1309 ++ .../pmu-events/arch/x86/ivytown/uncore-cache.json | 322 + .../arch/x86/ivytown/uncore-interconnect.json | 48 + .../pmu-events/arch/x86/ivytown/uncore-memory.json | 78 + .../pmu-events/arch/x86/ivytown/uncore-power.json | 274 + .../arch/x86/ivytown/virtual-memory.json | 198 + tools/perf/pmu-events/arch/x86/jaketown/cache.json | 1290 ++ .../arch/x86/jaketown/floating-point.json | 138 + .../pmu-events/arch/x86/jaketown/frontend.json | 305 + .../pmu-events/arch/x86/jaketown/jkt-metrics.json | 140 + .../perf/pmu-events/arch/x86/jaketown/memory.json | 422 + tools/perf/pmu-events/arch/x86/jaketown/other.json | 58 + .../pmu-events/arch/x86/jaketown/pipeline.json | 1220 ++ .../pmu-events/arch/x86/jaketown/uncore-cache.json | 210 + .../arch/x86/jaketown/uncore-interconnect.json | 48 + .../arch/x86/jaketown/uncore-memory.json | 82 + .../pmu-events/arch/x86/jaketown/uncore-power.json | 273 + .../arch/x86/jaketown/virtual-memory.json | 149 + .../pmu-events/arch/x86/knightslanding/cache.json | 2305 ++++ .../arch/x86/knightslanding/frontend.json | 34 + .../pmu-events/arch/x86/knightslanding/memory.json | 1110 ++ .../arch/x86/knightslanding/pipeline.json | 435 + .../arch/x86/knightslanding/uncore-memory.json | 42 + .../arch/x86/knightslanding/virtual-memory.json | 65 + tools/perf/pmu-events/arch/x86/mapfile.csv | 34 + .../perf/pmu-events/arch/x86/nehalemep/cache.json | 3229 +++++ .../arch/x86/nehalemep/floating-point.json | 229 + .../pmu-events/arch/x86/nehalemep/frontend.json | 26 + .../perf/pmu-events/arch/x86/nehalemep/memory.json | 739 ++ .../perf/pmu-events/arch/x86/nehalemep/other.json | 210 + .../pmu-events/arch/x86/nehalemep/pipeline.json | 881 ++ .../arch/x86/nehalemep/virtual-memory.json | 109 + .../perf/pmu-events/arch/x86/nehalemex/cache.json | 3184 +++++ .../arch/x86/nehalemex/floating-point.json | 229 + .../pmu-events/arch/x86/nehalemex/frontend.json | 26 + .../perf/pmu-events/arch/x86/nehalemex/memory.json | 739 ++ .../perf/pmu-events/arch/x86/nehalemex/other.json | 210 + .../pmu-events/arch/x86/nehalemex/pipeline.json | 881 ++ .../arch/x86/nehalemex/virtual-memory.json | 109 + .../pmu-events/arch/x86/sandybridge/cache.json | 1879 +++ .../arch/x86/sandybridge/floating-point.json | 138 + .../pmu-events/arch/x86/sandybridge/frontend.json | 305 + .../pmu-events/arch/x86/sandybridge/memory.json | 445 + .../pmu-events/arch/x86/sandybridge/other.json | 58 + .../pmu-events/arch/x86/sandybridge/pipeline.json | 1220 ++ .../arch/x86/sandybridge/snb-metrics.json | 140 + .../pmu-events/arch/x86/sandybridge/uncore.json | 314 + .../arch/x86/sandybridge/virtual-memory.json | 149 + .../perf/pmu-events/arch/x86/silvermont/cache.json | 812 ++ .../pmu-events/arch/x86/silvermont/frontend.json | 47 + .../pmu-events/arch/x86/silvermont/memory.json | 11 + .../pmu-events/arch/x86/silvermont/pipeline.json | 359 + .../arch/x86/silvermont/virtual-memory.json | 69 + tools/perf/pmu-events/arch/x86/skylake/cache.json | 939 ++ .../arch/x86/skylake/floating-point.json | 67 + .../perf/pmu-events/arch/x86/skylake/frontend.json | 482 + tools/perf/pmu-events/arch/x86/skylake/memory.json | 615 + tools/perf/pmu-events/arch/x86/skylake/other.json | 48 + .../perf/pmu-events/arch/x86/skylake/pipeline.json | 950 ++ .../pmu-events/arch/x86/skylake/skl-metrics.json | 164 + tools/perf/pmu-events/arch/x86/skylake/uncore.json | 254 + .../arch/x86/skylake/virtual-memory.json | 284 + tools/perf/pmu-events/arch/x86/skylakex/cache.json | 1749 +++ .../arch/x86/skylakex/floating-point.json | 87 + .../pmu-events/arch/x86/skylakex/frontend.json | 482 + .../perf/pmu-events/arch/x86/skylakex/memory.json | 1473 +++ tools/perf/pmu-events/arch/x86/skylakex/other.json | 164 + .../pmu-events/arch/x86/skylakex/pipeline.json | 950 ++ .../pmu-events/arch/x86/skylakex/skx-metrics.json | 164 + .../arch/x86/skylakex/uncore-memory.json | 172 + .../pmu-events/arch/x86/skylakex/uncore-other.json | 1156 ++ .../arch/x86/skylakex/virtual-memory.json | 284 + .../pmu-events/arch/x86/westmereep-dp/cache.json | 2817 ++++ .../arch/x86/westmereep-dp/floating-point.json | 229 + .../arch/x86/westmereep-dp/frontend.json | 26 + .../pmu-events/arch/x86/westmereep-dp/memory.json | 758 ++ .../pmu-events/arch/x86/westmereep-dp/other.json | 287 + .../arch/x86/westmereep-dp/pipeline.json | 899 ++ .../arch/x86/westmereep-dp/virtual-memory.json | 173 + .../pmu-events/arch/x86/westmereep-sp/cache.json | 3233 +++++ .../arch/x86/westmereep-sp/floating-point.json | 229 + .../arch/x86/westmereep-sp/frontend.json | 26 + .../pmu-events/arch/x86/westmereep-sp/memory.json | 739 ++ .../pmu-events/arch/x86/westmereep-sp/other.json | 287 + .../arch/x86/westmereep-sp/pipeline.json | 899 ++ .../arch/x86/westmereep-sp/virtual-memory.json | 149 + .../perf/pmu-events/arch/x86/westmereex/cache.json | 3225 +++++ .../arch/x86/westmereex/floating-point.json | 229 + .../pmu-events/arch/x86/westmereex/frontend.json | 26 + .../pmu-events/arch/x86/westmereex/memory.json | 747 ++ .../perf/pmu-events/arch/x86/westmereex/other.json | 287 + .../pmu-events/arch/x86/westmereex/pipeline.json | 905 ++ .../arch/x86/westmereex/virtual-memory.json | 173 + tools/perf/pmu-events/jevents.c | 1172 ++ tools/perf/pmu-events/jevents.h | 22 + tools/perf/pmu-events/jsmn.c | 313 + tools/perf/pmu-events/jsmn.h | 68 + tools/perf/pmu-events/json.c | 162 + tools/perf/pmu-events/json.h | 39 + tools/perf/pmu-events/pmu-events.h | 44 + tools/perf/python/tracepoint.py | 48 + tools/perf/python/twatch.py | 68 + tools/perf/scripts/Build | 2 + tools/perf/scripts/perl/Perf-Trace-Util/Build | 5 + tools/perf/scripts/perl/Perf-Trace-Util/Context.c | 138 + tools/perf/scripts/perl/Perf-Trace-Util/Context.xs | 42 + .../perf/scripts/perl/Perf-Trace-Util/Makefile.PL | 18 + tools/perf/scripts/perl/Perf-Trace-Util/README | 59 + .../perl/Perf-Trace-Util/lib/Perf/Trace/Context.pm | 55 + .../perl/Perf-Trace-Util/lib/Perf/Trace/Core.pm | 192 + .../perl/Perf-Trace-Util/lib/Perf/Trace/Util.pm | 94 + tools/perf/scripts/perl/Perf-Trace-Util/typemap | 1 + .../perf/scripts/perl/bin/check-perf-trace-record | 2 + tools/perf/scripts/perl/bin/failed-syscalls-record | 3 + tools/perf/scripts/perl/bin/failed-syscalls-report | 10 + tools/perf/scripts/perl/bin/rw-by-file-record | 3 + tools/perf/scripts/perl/bin/rw-by-file-report | 10 + tools/perf/scripts/perl/bin/rw-by-pid-record | 2 + tools/perf/scripts/perl/bin/rw-by-pid-report | 3 + tools/perf/scripts/perl/bin/rwtop-record | 2 + tools/perf/scripts/perl/bin/rwtop-report | 20 + tools/perf/scripts/perl/bin/wakeup-latency-record | 6 + tools/perf/scripts/perl/bin/wakeup-latency-report | 3 + tools/perf/scripts/perl/check-perf-trace.pl | 106 + tools/perf/scripts/perl/failed-syscalls.pl | 47 + tools/perf/scripts/perl/rw-by-file.pl | 106 + tools/perf/scripts/perl/rw-by-pid.pl | 184 + tools/perf/scripts/perl/rwtop.pl | 203 + tools/perf/scripts/perl/wakeup-latency.pl | 107 + tools/perf/scripts/python/Perf-Trace-Util/Build | 3 + .../perf/scripts/python/Perf-Trace-Util/Context.c | 116 + .../python/Perf-Trace-Util/lib/Perf/Trace/Core.py | 116 + .../Perf-Trace-Util/lib/Perf/Trace/EventClass.py | 97 + .../Perf-Trace-Util/lib/Perf/Trace/SchedGui.py | 184 + .../python/Perf-Trace-Util/lib/Perf/Trace/Util.py | 91 + .../scripts/python/bin/compaction-times-record | 2 + .../scripts/python/bin/compaction-times-report | 4 + .../python/bin/event_analyzing_sample-record | 8 + .../python/bin/event_analyzing_sample-report | 3 + .../scripts/python/bin/export-to-postgresql-record | 8 + .../scripts/python/bin/export-to-postgresql-report | 29 + .../scripts/python/bin/export-to-sqlite-record | 8 + .../scripts/python/bin/export-to-sqlite-report | 29 + .../python/bin/failed-syscalls-by-pid-record | 3 + .../python/bin/failed-syscalls-by-pid-report | 10 + .../scripts/python/bin/futex-contention-record | 2 + .../scripts/python/bin/futex-contention-report | 4 + .../perf/scripts/python/bin/intel-pt-events-record | 13 + .../perf/scripts/python/bin/intel-pt-events-report | 3 + tools/perf/scripts/python/bin/mem-phys-addr-record | 19 + tools/perf/scripts/python/bin/mem-phys-addr-report | 3 + .../perf/scripts/python/bin/net_dropmonitor-record | 2 + .../perf/scripts/python/bin/net_dropmonitor-report | 4 + tools/perf/scripts/python/bin/netdev-times-record | 8 + tools/perf/scripts/python/bin/netdev-times-report | 5 + .../perf/scripts/python/bin/powerpc-hcalls-record | 2 + .../perf/scripts/python/bin/powerpc-hcalls-report | 2 + .../perf/scripts/python/bin/sched-migration-record | 2 + .../perf/scripts/python/bin/sched-migration-report | 3 + tools/perf/scripts/python/bin/sctop-record | 3 + tools/perf/scripts/python/bin/sctop-report | 24 + tools/perf/scripts/python/bin/stackcollapse-record | 8 + tools/perf/scripts/python/bin/stackcollapse-report | 3 + .../python/bin/syscall-counts-by-pid-record | 3 + .../python/bin/syscall-counts-by-pid-report | 10 + .../perf/scripts/python/bin/syscall-counts-record | 3 + .../perf/scripts/python/bin/syscall-counts-report | 10 + tools/perf/scripts/python/call-graph-from-sql.py | 339 + tools/perf/scripts/python/check-perf-trace.py | 82 + tools/perf/scripts/python/compaction-times.py | 311 + .../perf/scripts/python/event_analyzing_sample.py | 190 + tools/perf/scripts/python/export-to-postgresql.py | 734 + tools/perf/scripts/python/export-to-sqlite.py | 455 + .../perf/scripts/python/failed-syscalls-by-pid.py | 78 + tools/perf/scripts/python/futex-contention.py | 50 + tools/perf/scripts/python/intel-pt-events.py | 128 + tools/perf/scripts/python/mem-phys-addr.py | 95 + tools/perf/scripts/python/net_dropmonitor.py | 76 + tools/perf/scripts/python/netdev-times.py | 468 + tools/perf/scripts/python/powerpc-hcalls.py | 200 + tools/perf/scripts/python/sched-migration.py | 464 + tools/perf/scripts/python/sctop.py | 80 + tools/perf/scripts/python/stackcollapse.py | 126 + tools/perf/scripts/python/stat-cpi.py | 78 + tools/perf/scripts/python/syscall-counts-by-pid.py | 74 + tools/perf/scripts/python/syscall-counts.py | 64 + tools/perf/tests/.gitignore | 4 + tools/perf/tests/Build | 87 + tools/perf/tests/attr.c | 198 + tools/perf/tests/attr.py | 392 + tools/perf/tests/attr/README | 64 + tools/perf/tests/attr/base-record | 41 + tools/perf/tests/attr/base-stat | 41 + tools/perf/tests/attr/test-record-C0 | 14 + tools/perf/tests/attr/test-record-basic | 6 + tools/perf/tests/attr/test-record-branch-any | 8 + .../perf/tests/attr/test-record-branch-filter-any | 8 + .../tests/attr/test-record-branch-filter-any_call | 8 + .../tests/attr/test-record-branch-filter-any_ret | 8 + tools/perf/tests/attr/test-record-branch-filter-hv | 8 + .../tests/attr/test-record-branch-filter-ind_call | 8 + tools/perf/tests/attr/test-record-branch-filter-k | 8 + tools/perf/tests/attr/test-record-branch-filter-u | 8 + tools/perf/tests/attr/test-record-count | 9 + tools/perf/tests/attr/test-record-data | 10 + tools/perf/tests/attr/test-record-freq | 7 + tools/perf/tests/attr/test-record-graph-default | 7 + tools/perf/tests/attr/test-record-graph-dwarf | 12 + tools/perf/tests/attr/test-record-graph-fp | 7 + tools/perf/tests/attr/test-record-group | 22 + tools/perf/tests/attr/test-record-group-sampling | 39 + tools/perf/tests/attr/test-record-group1 | 23 + tools/perf/tests/attr/test-record-no-buffering | 9 + tools/perf/tests/attr/test-record-no-inherit | 8 + tools/perf/tests/attr/test-record-no-samples | 7 + tools/perf/tests/attr/test-record-period | 8 + tools/perf/tests/attr/test-record-raw | 7 + tools/perf/tests/attr/test-stat-C0 | 10 + tools/perf/tests/attr/test-stat-basic | 7 + tools/perf/tests/attr/test-stat-default | 70 + tools/perf/tests/attr/test-stat-detailed-1 | 111 + tools/perf/tests/attr/test-stat-detailed-2 | 171 + tools/perf/tests/attr/test-stat-detailed-3 | 191 + tools/perf/tests/attr/test-stat-group | 17 + tools/perf/tests/attr/test-stat-group1 | 17 + tools/perf/tests/attr/test-stat-no-inherit | 8 + tools/perf/tests/backward-ring-buffer.c | 155 + tools/perf/tests/bitmap.c | 52 + tools/perf/tests/bp_account.c | 193 + tools/perf/tests/bp_signal.c | 312 + tools/perf/tests/bp_signal_overflow.c | 134 + tools/perf/tests/bpf-script-example.c | 48 + tools/perf/tests/bpf-script-test-kbuild.c | 20 + tools/perf/tests/bpf-script-test-prologue.c | 46 + tools/perf/tests/bpf-script-test-relocation.c | 50 + tools/perf/tests/bpf.c | 363 + tools/perf/tests/builtin-test.c | 710 + tools/perf/tests/clang.c | 48 + tools/perf/tests/code-reading.c | 741 ++ tools/perf/tests/cpumap.c | 120 + tools/perf/tests/dso-data.c | 385 + tools/perf/tests/dwarf-unwind.c | 213 + tools/perf/tests/event-times.c | 239 + tools/perf/tests/event_update.c | 118 + tools/perf/tests/evsel-roundtrip-name.c | 119 + tools/perf/tests/evsel-tp-sched.c | 90 + tools/perf/tests/expr.c | 65 + tools/perf/tests/fdarray.c | 176 + tools/perf/tests/hists_common.c | 217 + tools/perf/tests/hists_common.h | 76 + tools/perf/tests/hists_cumulate.c | 737 ++ tools/perf/tests/hists_filter.c | 328 + tools/perf/tests/hists_link.c | 342 + tools/perf/tests/hists_output.c | 624 + tools/perf/tests/is_printable_array.c | 38 + tools/perf/tests/keep-tracking.c | 157 + tools/perf/tests/kmod-path.c | 159 + tools/perf/tests/llvm.c | 172 + tools/perf/tests/llvm.h | 31 + tools/perf/tests/make | 368 + tools/perf/tests/mem.c | 56 + tools/perf/tests/mem2node.c | 73 + tools/perf/tests/mmap-basic.c | 162 + tools/perf/tests/mmap-thread-lookup.c | 235 + tools/perf/tests/openat-syscall-all-cpus.c | 127 + tools/perf/tests/openat-syscall-tp-fields.c | 140 + tools/perf/tests/openat-syscall.c | 66 + tools/perf/tests/parse-events.c | 1914 +++ tools/perf/tests/parse-no-sample-id-all.c | 107 + tools/perf/tests/perf-hooks.c | 48 + tools/perf/tests/perf-record.c | 328 + tools/perf/tests/perf-targz-src-pkg | 22 + tools/perf/tests/pmu.c | 178 + tools/perf/tests/python-use.c | 24 + tools/perf/tests/sample-parsing.c | 353 + tools/perf/tests/sdt.c | 118 + tools/perf/tests/shell/lib/probe.sh | 6 + tools/perf/tests/shell/lib/probe_vfs_getname.sh | 24 + tools/perf/tests/shell/probe_vfs_getname.sh | 14 + .../tests/shell/record+probe_libc_inet_pton.sh | 94 + .../tests/shell/record+script_probe_vfs_getname.sh | 41 + tools/perf/tests/shell/trace+probe_vfs_getname.sh | 40 + tools/perf/tests/stat.c | 112 + tools/perf/tests/sw-clock.c | 144 + tools/perf/tests/switch-tracking.c | 580 + tools/perf/tests/task-exit.c | 144 + tools/perf/tests/tests.h | 118 + tools/perf/tests/thread-map.c | 140 + tools/perf/tests/thread-mg-share.c | 99 + tools/perf/tests/topology.c | 141 + tools/perf/tests/unit_number__scnprintf.c | 39 + tools/perf/tests/vmlinux-kallsyms.c | 244 + tools/perf/trace/beauty/Build | 11 + tools/perf/trace/beauty/arch_errno_names.c | 1 + tools/perf/trace/beauty/arch_errno_names.sh | 100 + tools/perf/trace/beauty/beauty.h | 125 + tools/perf/trace/beauty/clone.c | 75 + tools/perf/trace/beauty/drm_ioctl.sh | 14 + tools/perf/trace/beauty/eventfd.c | 37 + tools/perf/trace/beauty/fcntl.c | 100 + tools/perf/trace/beauty/flock.c | 49 + tools/perf/trace/beauty/futex_op.c | 61 + tools/perf/trace/beauty/futex_val3.c | 18 + tools/perf/trace/beauty/ioctl.c | 162 + tools/perf/trace/beauty/kcmp.c | 44 + tools/perf/trace/beauty/kcmp_type.sh | 10 + tools/perf/trace/beauty/kvm_ioctl.sh | 11 + tools/perf/trace/beauty/madvise_behavior.sh | 10 + tools/perf/trace/beauty/mmap.c | 121 + tools/perf/trace/beauty/mode_t.c | 69 + tools/perf/trace/beauty/msg_flags.c | 62 + tools/perf/trace/beauty/open_flags.c | 85 + tools/perf/trace/beauty/perf_event_open.c | 44 + tools/perf/trace/beauty/perf_ioctl.sh | 10 + tools/perf/trace/beauty/pid.c | 20 + tools/perf/trace/beauty/pkey_alloc.c | 50 + .../perf/trace/beauty/pkey_alloc_access_rights.sh | 10 + tools/perf/trace/beauty/prctl.c | 82 + tools/perf/trace/beauty/prctl_option.sh | 17 + tools/perf/trace/beauty/sched_policy.c | 48 + tools/perf/trace/beauty/seccomp.c | 51 + tools/perf/trace/beauty/signum.c | 55 + tools/perf/trace/beauty/sndrv_ctl_ioctl.sh | 8 + tools/perf/trace/beauty/sndrv_pcm_ioctl.sh | 8 + tools/perf/trace/beauty/socket.c | 28 + tools/perf/trace/beauty/socket_ipproto.sh | 11 + tools/perf/trace/beauty/socket_type.c | 61 + tools/perf/trace/beauty/statx.c | 72 + tools/perf/trace/beauty/vhost_virtio_ioctl.sh | 17 + tools/perf/trace/beauty/waitid_options.c | 27 + tools/perf/trace/strace/groups/file | 20 + tools/perf/ui/Build | 14 + tools/perf/ui/browser.c | 793 ++ tools/perf/ui/browser.h | 84 + tools/perf/ui/browsers/Build | 10 + tools/perf/ui/browsers/annotate.c | 940 ++ tools/perf/ui/browsers/header.c | 131 + tools/perf/ui/browsers/hists.c | 3310 +++++ tools/perf/ui/browsers/hists.h | 38 + tools/perf/ui/browsers/map.c | 132 + tools/perf/ui/browsers/map.h | 7 + tools/perf/ui/browsers/scripts.c | 188 + tools/perf/ui/gtk/Build | 9 + tools/perf/ui/gtk/annotate.c | 260 + tools/perf/ui/gtk/browser.c | 88 + tools/perf/ui/gtk/gtk.h | 68 + tools/perf/ui/gtk/helpline.c | 58 + tools/perf/ui/gtk/hists.c | 681 + tools/perf/ui/gtk/progress.c | 60 + tools/perf/ui/gtk/setup.c | 24 + tools/perf/ui/gtk/util.c | 114 + tools/perf/ui/helpline.c | 85 + tools/perf/ui/helpline.h | 31 + tools/perf/ui/hist.c | 822 ++ tools/perf/ui/keysyms.h | 29 + tools/perf/ui/libslang.h | 33 + tools/perf/ui/progress.c | 48 + tools/perf/ui/progress.h | 34 + tools/perf/ui/setup.c | 120 + tools/perf/ui/stdio/hist.c | 850 ++ tools/perf/ui/tui/Build | 4 + tools/perf/ui/tui/helpline.c | 62 + tools/perf/ui/tui/progress.c | 88 + tools/perf/ui/tui/setup.c | 178 + tools/perf/ui/tui/tui.h | 7 + tools/perf/ui/tui/util.c | 257 + tools/perf/ui/ui.h | 34 + tools/perf/ui/util.c | 85 + tools/perf/ui/util.h | 22 + tools/perf/util/Build | 224 + tools/perf/util/PERF-VERSION-GEN | 51 + tools/perf/util/annotate.c | 2878 ++++ tools/perf/util/annotate.h | 403 + tools/perf/util/arm-spe-pkt-decoder.c | 462 + tools/perf/util/arm-spe-pkt-decoder.h | 43 + tools/perf/util/arm-spe.c | 231 + tools/perf/util/arm-spe.h | 31 + tools/perf/util/auxtrace.c | 2166 +++ tools/perf/util/auxtrace.h | 725 + tools/perf/util/block-range.c | 329 + tools/perf/util/block-range.h | 72 + tools/perf/util/bpf-loader.c | 1801 +++ tools/perf/util/bpf-loader.h | 214 + tools/perf/util/bpf-prologue.c | 502 + tools/perf/util/bpf-prologue.h | 37 + tools/perf/util/branch.c | 147 + tools/perf/util/branch.h | 25 + tools/perf/util/build-id.c | 876 ++ tools/perf/util/build-id.h | 59 + tools/perf/util/c++/Build | 2 + tools/perf/util/c++/clang-c.h | 45 + tools/perf/util/c++/clang-test.cpp | 63 + tools/perf/util/c++/clang.cpp | 212 + tools/perf/util/c++/clang.h | 27 + tools/perf/util/cache.h | 31 + tools/perf/util/call-path.c | 122 + tools/perf/util/call-path.h | 77 + tools/perf/util/callchain.c | 1579 +++ tools/perf/util/callchain.h | 302 + tools/perf/util/cgroup.c | 251 + tools/perf/util/cgroup.h | 29 + tools/perf/util/cloexec.c | 104 + tools/perf/util/cloexec.h | 7 + tools/perf/util/color.c | 222 + tools/perf/util/color.h | 48 + tools/perf/util/comm.c | 152 + tools/perf/util/comm.h | 28 + tools/perf/util/compress.h | 15 + tools/perf/util/config.c | 829 ++ tools/perf/util/config.h | 70 + tools/perf/util/counts.c | 55 + tools/perf/util/counts.h | 39 + tools/perf/util/cpumap.c | 735 + tools/perf/util/cpumap.h | 77 + tools/perf/util/cs-etm-decoder/Build | 1 + tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 562 + tools/perf/util/cs-etm-decoder/cs-etm-decoder.h | 108 + tools/perf/util/cs-etm.c | 1507 +++ tools/perf/util/cs-etm.h | 85 + tools/perf/util/ctype.c | 49 + tools/perf/util/data-convert-bt.c | 1677 +++ tools/perf/util/data-convert-bt.h | 11 + tools/perf/util/data-convert.h | 10 + tools/perf/util/data.c | 189 + tools/perf/util/data.h | 66 + tools/perf/util/db-export.c | 507 + tools/perf/util/db-export.h | 109 + tools/perf/util/debug.c | 284 + tools/perf/util/debug.h | 64 + tools/perf/util/demangle-java.c | 202 + tools/perf/util/demangle-java.h | 11 + tools/perf/util/demangle-rust.c | 270 + tools/perf/util/demangle-rust.h | 8 + tools/perf/util/drv_configs.c | 78 + tools/perf/util/drv_configs.h | 26 + tools/perf/util/dso.c | 1541 +++ tools/perf/util/dso.h | 382 + tools/perf/util/dump-insn.c | 15 + tools/perf/util/dump-insn.h | 23 + tools/perf/util/dwarf-aux.c | 1353 ++ tools/perf/util/dwarf-aux.h | 142 + tools/perf/util/dwarf-regs.c | 61 + tools/perf/util/env.c | 177 + tools/perf/util/env.h | 82 + tools/perf/util/event.c | 1718 +++ tools/perf/util/event.h | 833 ++ tools/perf/util/evlist.c | 1816 +++ tools/perf/util/evlist.h | 315 + tools/perf/util/evsel.c | 2954 +++++ tools/perf/util/evsel.h | 484 + tools/perf/util/evsel_fprintf.c | 236 + tools/perf/util/expr.h | 26 + tools/perf/util/expr.y | 236 + tools/perf/util/find-vdso-map.c | 31 + tools/perf/util/genelf.c | 554 + tools/perf/util/genelf.h | 65 + tools/perf/util/genelf_debug.c | 611 + tools/perf/util/generate-cmdlist.sh | 55 + tools/perf/util/get_current_dir_name.c | 18 + tools/perf/util/group.h | 8 + tools/perf/util/header.c | 3946 ++++++ tools/perf/util/header.h | 180 + tools/perf/util/help-unknown-cmd.c | 116 + tools/perf/util/help-unknown-cmd.h | 0 tools/perf/util/hist.c | 2650 ++++ tools/perf/util/hist.h | 527 + tools/perf/util/include/asm/asm-offsets.h | 2 + tools/perf/util/include/asm/cpufeature.h | 10 + tools/perf/util/include/asm/dwarf2.h | 14 + tools/perf/util/include/asm/swab.h | 1 + tools/perf/util/include/asm/system.h | 1 + tools/perf/util/include/asm/uaccess.h | 15 + tools/perf/util/include/dwarf-regs.h | 23 + tools/perf/util/include/linux/ctype.h | 1 + tools/perf/util/include/linux/linkage.h | 14 + tools/perf/util/intel-bts.c | 952 ++ tools/perf/util/intel-bts.h | 43 + tools/perf/util/intel-pt-decoder/Build | 36 + .../util/intel-pt-decoder/gen-insn-attr-x86.awk | 392 + tools/perf/util/intel-pt-decoder/inat.c | 96 + tools/perf/util/intel-pt-decoder/inat.h | 244 + tools/perf/util/intel-pt-decoder/inat_types.h | 29 + tools/perf/util/intel-pt-decoder/insn.c | 606 + tools/perf/util/intel-pt-decoder/insn.h | 244 + .../perf/util/intel-pt-decoder/intel-pt-decoder.c | 2727 ++++ .../perf/util/intel-pt-decoder/intel-pt-decoder.h | 133 + .../util/intel-pt-decoder/intel-pt-insn-decoder.c | 274 + .../util/intel-pt-decoder/intel-pt-insn-decoder.h | 63 + tools/perf/util/intel-pt-decoder/intel-pt-log.c | 156 + tools/perf/util/intel-pt-decoder/intel-pt-log.h | 78 + .../util/intel-pt-decoder/intel-pt-pkt-decoder.c | 638 + .../util/intel-pt-decoder/intel-pt-pkt-decoder.h | 77 + .../perf/util/intel-pt-decoder/x86-opcode-map.txt | 1072 ++ tools/perf/util/intel-pt.c | 2636 ++++ tools/perf/util/intel-pt.h | 56 + tools/perf/util/intlist.c | 146 + tools/perf/util/intlist.h | 78 + tools/perf/util/jit.h | 12 + tools/perf/util/jitdump.c | 793 ++ tools/perf/util/jitdump.h | 139 + tools/perf/util/kvm-stat.h | 147 + tools/perf/util/levenshtein.c | 87 + tools/perf/util/levenshtein.h | 9 + tools/perf/util/libunwind/arm64.c | 41 + tools/perf/util/libunwind/x86_32.c | 44 + tools/perf/util/llvm-utils.c | 579 + tools/perf/util/llvm-utils.h | 69 + tools/perf/util/lzma.c | 123 + tools/perf/util/machine.c | 2607 ++++ tools/perf/util/machine.h | 296 + tools/perf/util/map.c | 920 ++ tools/perf/util/map.h | 255 + tools/perf/util/mem-events.c | 452 + tools/perf/util/mem-events.h | 75 + tools/perf/util/mem2node.c | 135 + tools/perf/util/mem2node.h | 19 + tools/perf/util/memswap.c | 25 + tools/perf/util/memswap.h | 8 + tools/perf/util/metricgroup.c | 540 + tools/perf/util/metricgroup.h | 32 + tools/perf/util/mmap.c | 339 + tools/perf/util/mmap.h | 102 + tools/perf/util/namespaces.c | 265 + tools/perf/util/namespaces.h | 67 + tools/perf/util/ordered-events.c | 322 + tools/perf/util/ordered-events.h | 66 + tools/perf/util/parse-branch-options.c | 106 + tools/perf/util/parse-branch-options.h | 7 + tools/perf/util/parse-events.c | 2768 ++++ tools/perf/util/parse-events.h | 234 + tools/perf/util/parse-events.l | 378 + tools/perf/util/parse-events.y | 714 + tools/perf/util/parse-regs-options.c | 72 + tools/perf/util/parse-regs-options.h | 6 + tools/perf/util/path.c | 93 + tools/perf/util/path.h | 13 + tools/perf/util/perf-hooks-list.h | 3 + tools/perf/util/perf-hooks.c | 90 + tools/perf/util/perf-hooks.h | 40 + tools/perf/util/perf_regs.c | 40 + tools/perf/util/perf_regs.h | 47 + tools/perf/util/pmu.c | 1553 +++ tools/perf/util/pmu.h | 98 + tools/perf/util/pmu.l | 43 + tools/perf/util/pmu.y | 92 + tools/perf/util/print_binary.c | 58 + tools/perf/util/print_binary.h | 37 + tools/perf/util/probe-event.c | 3547 +++++ tools/perf/util/probe-event.h | 193 + tools/perf/util/probe-file.c | 1066 ++ tools/perf/util/probe-file.h | 79 + tools/perf/util/probe-finder.c | 1910 +++ tools/perf/util/probe-finder.h | 122 + tools/perf/util/pstack.c | 84 + tools/perf/util/pstack.h | 16 + tools/perf/util/python-ext-sources | 33 + tools/perf/util/python.c | 1377 ++ tools/perf/util/rb_resort.h | 151 + tools/perf/util/rblist.c | 133 + tools/perf/util/rblist.h | 50 + tools/perf/util/record.c | 326 + tools/perf/util/rwsem.c | 32 + tools/perf/util/rwsem.h | 19 + tools/perf/util/s390-cpumsf-kernel.h | 71 + tools/perf/util/s390-cpumsf.c | 950 ++ tools/perf/util/s390-cpumsf.h | 21 + tools/perf/util/sane_ctype.h | 52 + tools/perf/util/scripting-engines/Build | 6 + .../perf/util/scripting-engines/trace-event-perl.c | 752 ++ .../util/scripting-engines/trace-event-python.c | 1784 +++ tools/perf/util/session.c | 2251 ++++ tools/perf/util/session.h | 132 + tools/perf/util/setns.c | 8 + tools/perf/util/setup.py | 69 + tools/perf/util/smt.c | 44 + tools/perf/util/smt.h | 6 + tools/perf/util/sort.c | 3015 +++++ tools/perf/util/sort.h | 303 + tools/perf/util/srcline.c | 720 + tools/perf/util/srcline.h | 54 + tools/perf/util/stat-shadow.c | 999 ++ tools/perf/util/stat.c | 456 + tools/perf/util/stat.h | 175 + tools/perf/util/strbuf.c | 164 + tools/perf/util/strbuf.h | 95 + tools/perf/util/strfilter.c | 311 + tools/perf/util/strfilter.h | 84 + tools/perf/util/string.c | 444 + tools/perf/util/string2.h | 45 + tools/perf/util/strlist.c | 209 + tools/perf/util/strlist.h | 90 + tools/perf/util/svghelper.c | 809 ++ tools/perf/util/svghelper.h | 37 + tools/perf/util/symbol-elf.c | 2251 ++++ tools/perf/util/symbol-minimal.c | 383 + tools/perf/util/symbol.c | 2257 ++++ tools/perf/util/symbol.h | 401 + tools/perf/util/symbol_fprintf.c | 73 + tools/perf/util/syscalltbl.c | 183 + tools/perf/util/syscalltbl.h | 24 + tools/perf/util/target.c | 152 + tools/perf/util/target.h | 87 + tools/perf/util/term.c | 40 + tools/perf/util/term.h | 11 + tools/perf/util/thread-stack.c | 652 + tools/perf/util/thread-stack.h | 102 + tools/perf/util/thread.c | 416 + tools/perf/util/thread.h | 138 + tools/perf/util/thread_map.c | 489 + tools/perf/util/thread_map.h | 65 + tools/perf/util/time-utils.c | 422 + tools/perf/util/time-utils.h | 30 + tools/perf/util/tool.h | 83 + tools/perf/util/top.c | 117 + tools/perf/util/top.h | 49 + tools/perf/util/trace-event-info.c | 618 + tools/perf/util/trace-event-parse.c | 257 + tools/perf/util/trace-event-read.c | 498 + tools/perf/util/trace-event-scripting.c | 176 + tools/perf/util/trace-event.c | 120 + tools/perf/util/trace-event.h | 105 + tools/perf/util/trigger.h | 96 + tools/perf/util/tsc.c | 31 + tools/perf/util/tsc.h | 32 + tools/perf/util/units.c | 69 + tools/perf/util/units.h | 18 + tools/perf/util/unwind-libdw.c | 256 + tools/perf/util/unwind-libdw.h | 26 + tools/perf/util/unwind-libunwind-local.c | 739 ++ tools/perf/util/unwind-libunwind.c | 84 + tools/perf/util/unwind.h | 85 + tools/perf/util/usage.c | 26 + tools/perf/util/util-cxx.h | 27 + tools/perf/util/util.c | 508 + tools/perf/util/util.h | 87 + tools/perf/util/values.c | 304 + tools/perf/util/values.h | 28 + tools/perf/util/vdso.c | 358 + tools/perf/util/vdso.h | 30 + tools/perf/util/xyarray.c | 33 + tools/perf/util/xyarray.h | 36 + tools/perf/util/zlib.c | 99 + tools/power/acpi/.gitignore | 4 + tools/power/acpi/Makefile | 27 + tools/power/acpi/Makefile.config | 91 + tools/power/acpi/Makefile.rules | 51 + tools/power/acpi/common/cmfsize.c | 68 + tools/power/acpi/common/getopt.c | 205 + tools/power/acpi/man/acpidump.8 | 127 + .../acpi/os_specific/service_layers/oslinuxtbl.c | 1372 ++ .../acpi/os_specific/service_layers/osunixdir.c | 170 + .../acpi/os_specific/service_layers/osunixmap.c | 117 + .../acpi/os_specific/service_layers/osunixxf.c | 1317 ++ tools/power/acpi/tools/acpidbg/Makefile | 25 + tools/power/acpi/tools/acpidbg/acpidbg.c | 444 + tools/power/acpi/tools/acpidump/Makefile | 56 + tools/power/acpi/tools/acpidump/acpidump.h | 85 + tools/power/acpi/tools/acpidump/apdump.c | 402 + tools/power/acpi/tools/acpidump/apfiles.c | 223 + tools/power/acpi/tools/acpidump/apmain.c | 366 + tools/power/acpi/tools/ec/Makefile | 17 + tools/power/acpi/tools/ec/ec_access.c | 238 + tools/power/cpupower/.gitignore | 28 + tools/power/cpupower/Makefile | 334 + tools/power/cpupower/README | 47 + tools/power/cpupower/ToDo | 10 + tools/power/cpupower/bench/Makefile | 43 + tools/power/cpupower/bench/README-BENCH | 124 + tools/power/cpupower/bench/benchmark.c | 194 + tools/power/cpupower/bench/benchmark.h | 29 + tools/power/cpupower/bench/config.h | 36 + tools/power/cpupower/bench/cpufreq-bench_plot.sh | 104 + tools/power/cpupower/bench/cpufreq-bench_script.sh | 101 + tools/power/cpupower/bench/example.cfg | 11 + tools/power/cpupower/bench/main.c | 202 + tools/power/cpupower/bench/parse.c | 238 + tools/power/cpupower/bench/parse.h | 53 + tools/power/cpupower/bench/system.c | 192 + tools/power/cpupower/bench/system.h | 29 + tools/power/cpupower/debug/i386/Makefile | 42 + tools/power/cpupower/debug/i386/centrino-decode.c | 113 + tools/power/cpupower/debug/i386/dump_psb.c | 196 + tools/power/cpupower/debug/i386/intel_gsic.c | 78 + .../power/cpupower/debug/i386/powernow-k8-decode.c | 96 + tools/power/cpupower/debug/kernel/Makefile | 23 + .../power/cpupower/debug/kernel/cpufreq-test_tsc.c | 110 + tools/power/cpupower/debug/x86_64/Makefile | 31 + tools/power/cpupower/lib/cpufreq.c | 716 + tools/power/cpupower/lib/cpufreq.h | 212 + tools/power/cpupower/lib/cpuidle.c | 380 + tools/power/cpupower/lib/cpuidle.h | 24 + tools/power/cpupower/lib/cpupower.c | 192 + tools/power/cpupower/lib/cpupower.h | 36 + tools/power/cpupower/lib/cpupower_intern.h | 6 + tools/power/cpupower/man/cpupower-frequency-info.1 | 77 + tools/power/cpupower/man/cpupower-frequency-set.1 | 52 + tools/power/cpupower/man/cpupower-idle-info.1 | 91 + tools/power/cpupower/man/cpupower-idle-set.1 | 79 + tools/power/cpupower/man/cpupower-info.1 | 19 + tools/power/cpupower/man/cpupower-monitor.1 | 198 + tools/power/cpupower/man/cpupower-set.1 | 65 + tools/power/cpupower/man/cpupower.1 | 72 + tools/power/cpupower/po/cs.po | 944 ++ tools/power/cpupower/po/de.po | 961 ++ tools/power/cpupower/po/fr.po | 947 ++ tools/power/cpupower/po/it.po | 961 ++ tools/power/cpupower/po/pt.po | 957 ++ tools/power/cpupower/utils/builtin.h | 13 + tools/power/cpupower/utils/cpufreq-info.c | 648 + tools/power/cpupower/utils/cpufreq-set.c | 333 + tools/power/cpupower/utils/cpuidle-info.c | 214 + tools/power/cpupower/utils/cpuidle-set.c | 185 + tools/power/cpupower/utils/cpupower-info.c | 106 + tools/power/cpupower/utils/cpupower-set.c | 99 + tools/power/cpupower/utils/cpupower.c | 238 + tools/power/cpupower/utils/helpers/amd.c | 156 + tools/power/cpupower/utils/helpers/bitmask.c | 293 + tools/power/cpupower/utils/helpers/bitmask.h | 34 + tools/power/cpupower/utils/helpers/cpuid.c | 180 + tools/power/cpupower/utils/helpers/helpers.h | 174 + tools/power/cpupower/utils/helpers/misc.c | 43 + tools/power/cpupower/utils/helpers/msr.c | 116 + tools/power/cpupower/utils/helpers/pci.c | 63 + tools/power/cpupower/utils/helpers/sysfs.c | 472 + tools/power/cpupower/utils/helpers/sysfs.h | 39 + tools/power/cpupower/utils/helpers/topology.c | 22 + .../cpupower/utils/idle_monitor/amd_fam14h_idle.c | 335 + .../cpupower/utils/idle_monitor/cpuidle_sysfs.c | 214 + .../cpupower/utils/idle_monitor/cpupower-monitor.c | 469 + .../cpupower/utils/idle_monitor/cpupower-monitor.h | 94 + .../cpupower/utils/idle_monitor/hsw_ext_idle.c | 195 + .../cpupower/utils/idle_monitor/idle_monitors.def | 8 + .../cpupower/utils/idle_monitor/idle_monitors.h | 18 + .../cpupower/utils/idle_monitor/mperf_monitor.c | 340 + tools/power/cpupower/utils/idle_monitor/nhm_idle.c | 216 + tools/power/cpupower/utils/idle_monitor/snb_idle.c | 200 + tools/power/cpupower/utils/version-gen.sh | 36 + tools/power/pm-graph/Makefile | 47 + tools/power/pm-graph/bootgraph.8 | 173 + tools/power/pm-graph/bootgraph.py | 1085 ++ tools/power/pm-graph/config/cgskip.txt | 65 + .../pm-graph/config/custom-timeline-functions.cfg | 205 + tools/power/pm-graph/config/example.cfg | 133 + tools/power/pm-graph/config/freeze-callgraph.cfg | 94 + tools/power/pm-graph/config/freeze-dev.cfg | 93 + tools/power/pm-graph/config/freeze.cfg | 93 + tools/power/pm-graph/config/standby-callgraph.cfg | 94 + tools/power/pm-graph/config/standby-dev.cfg | 93 + tools/power/pm-graph/config/standby.cfg | 93 + tools/power/pm-graph/config/suspend-callgraph.cfg | 98 + tools/power/pm-graph/config/suspend-dev.cfg | 93 + tools/power/pm-graph/config/suspend-x2-proc.cfg | 93 + tools/power/pm-graph/config/suspend.cfg | 93 + tools/power/pm-graph/sleepgraph.8 | 292 + tools/power/pm-graph/sleepgraph.py | 6057 +++++++++ .../x86/intel_pstate_tracer/intel_pstate_tracer.py | 617 + tools/power/x86/turbostat/.gitignore | 1 + tools/power/x86/turbostat/Makefile | 28 + tools/power/x86/turbostat/turbostat.8 | 351 + tools/power/x86/turbostat/turbostat.c | 5620 ++++++++ tools/power/x86/x86_energy_perf_policy/Makefile | 28 + .../x86_energy_perf_policy.8 | 213 + .../x86_energy_perf_policy.c | 1430 ++ tools/scripts/Makefile.arch | 41 + tools/scripts/Makefile.include | 134 + tools/scripts/utilities.mak | 179 + tools/spi/.gitignore | 2 + tools/spi/Build | 2 + tools/spi/Makefile | 64 + tools/spi/spidev_fdx.c | 159 + tools/spi/spidev_test.c | 483 + tools/testing/fault-injection/failcmd.sh | 220 + tools/testing/ktest/compare-ktest-sample.pl | 33 + tools/testing/ktest/config-bisect.pl | 770 ++ tools/testing/ktest/examples/README | 32 + tools/testing/ktest/examples/crosstests.conf | 225 + tools/testing/ktest/examples/include/bisect.conf | 90 + tools/testing/ktest/examples/include/defaults.conf | 157 + .../testing/ktest/examples/include/min-config.conf | 60 + .../testing/ktest/examples/include/patchcheck.conf | 111 + tools/testing/ktest/examples/include/tests.conf | 74 + tools/testing/ktest/examples/kvm.conf | 92 + tools/testing/ktest/examples/snowball.conf | 53 + tools/testing/ktest/examples/test.conf | 62 + tools/testing/ktest/ktest.pl | 4425 +++++++ tools/testing/ktest/sample.conf | 1348 ++ tools/testing/nvdimm/Kbuild | 84 + tools/testing/nvdimm/Makefile | 8 + tools/testing/nvdimm/acpi_nfit_test.c | 8 + tools/testing/nvdimm/config_check.c | 18 + tools/testing/nvdimm/dax-dev.c | 49 + tools/testing/nvdimm/device_dax_test.c | 8 + tools/testing/nvdimm/libnvdimm_test.c | 8 + tools/testing/nvdimm/pmem-dax.c | 57 + tools/testing/nvdimm/pmem_test.c | 8 + tools/testing/nvdimm/test/Kbuild | 9 + tools/testing/nvdimm/test/iomap.c | 403 + tools/testing/nvdimm/test/nfit.c | 2957 +++++ tools/testing/nvdimm/test/nfit_test.h | 249 + tools/testing/nvdimm/watermark.h | 21 + tools/testing/radix-tree/.gitignore | 6 + tools/testing/radix-tree/Makefile | 51 + tools/testing/radix-tree/benchmark.c | 257 + tools/testing/radix-tree/generated/autoconf.h | 1 + tools/testing/radix-tree/idr-test.c | 512 + tools/testing/radix-tree/iteration_check.c | 221 + tools/testing/radix-tree/linux.c | 112 + tools/testing/radix-tree/linux/bug.h | 1 + tools/testing/radix-tree/linux/compiler_types.h | 0 tools/testing/radix-tree/linux/cpu.h | 1 + tools/testing/radix-tree/linux/gfp.h | 33 + tools/testing/radix-tree/linux/idr.h | 1 + tools/testing/radix-tree/linux/init.h | 1 + tools/testing/radix-tree/linux/kernel.h | 20 + tools/testing/radix-tree/linux/kmemleak.h | 1 + tools/testing/radix-tree/linux/percpu.h | 11 + tools/testing/radix-tree/linux/preempt.h | 15 + tools/testing/radix-tree/linux/radix-tree.h | 27 + tools/testing/radix-tree/linux/rcupdate.h | 10 + tools/testing/radix-tree/linux/slab.h | 27 + tools/testing/radix-tree/linux/xarray.h | 2 + tools/testing/radix-tree/main.c | 388 + tools/testing/radix-tree/multiorder.c | 719 + tools/testing/radix-tree/regression.h | 9 + tools/testing/radix-tree/regression1.c | 221 + tools/testing/radix-tree/regression2.c | 123 + tools/testing/radix-tree/regression3.c | 118 + tools/testing/radix-tree/tag_check.c | 380 + tools/testing/radix-tree/test.c | 334 + tools/testing/radix-tree/test.h | 65 + tools/testing/scatterlist/Makefile | 30 + tools/testing/scatterlist/linux/mm.h | 125 + tools/testing/scatterlist/main.c | 79 + tools/testing/selftests/.gitignore | 5 + tools/testing/selftests/Makefile | 167 + tools/testing/selftests/android/Makefile | 38 + tools/testing/selftests/android/config | 5 + tools/testing/selftests/android/ion/.gitignore | 3 + tools/testing/selftests/android/ion/Makefile | 19 + tools/testing/selftests/android/ion/README | 101 + tools/testing/selftests/android/ion/ion.h | 143 + tools/testing/selftests/android/ion/ion_test.sh | 58 + .../testing/selftests/android/ion/ionapp_export.c | 136 + .../testing/selftests/android/ion/ionapp_import.c | 88 + tools/testing/selftests/android/ion/ionmap_test.c | 136 + tools/testing/selftests/android/ion/ionutils.c | 253 + tools/testing/selftests/android/ion/ionutils.h | 55 + tools/testing/selftests/android/ion/ipcsocket.c | 227 + tools/testing/selftests/android/ion/ipcsocket.h | 35 + tools/testing/selftests/android/run.sh | 3 + tools/testing/selftests/bpf/.gitignore | 21 + tools/testing/selftests/bpf/Makefile | 145 + tools/testing/selftests/bpf/bpf_endian.h | 57 + tools/testing/selftests/bpf/bpf_helpers.h | 336 + tools/testing/selftests/bpf/bpf_rand.h | 80 + tools/testing/selftests/bpf/bpf_rlimit.h | 28 + tools/testing/selftests/bpf/bpf_util.h | 61 + tools/testing/selftests/bpf/cgroup_helpers.c | 235 + tools/testing/selftests/bpf/cgroup_helpers.h | 18 + tools/testing/selftests/bpf/config | 20 + tools/testing/selftests/bpf/connect4_prog.c | 45 + tools/testing/selftests/bpf/connect6_prog.c | 61 + tools/testing/selftests/bpf/dev_cgroup.c | 60 + tools/testing/selftests/bpf/get_cgroup_id_kern.c | 40 + tools/testing/selftests/bpf/get_cgroup_id_user.c | 149 + tools/testing/selftests/bpf/gnu/stubs.h | 1 + .../selftests/bpf/include/uapi/linux/types.h | 23 + tools/testing/selftests/bpf/sample_map_ret0.c | 34 + tools/testing/selftests/bpf/sample_ret0.c | 7 + tools/testing/selftests/bpf/sendmsg4_prog.c | 49 + tools/testing/selftests/bpf/sendmsg6_prog.c | 59 + tools/testing/selftests/bpf/socket_cookie_prog.c | 60 + tools/testing/selftests/bpf/sockmap_parse_prog.c | 46 + tools/testing/selftests/bpf/sockmap_tcp_msg_prog.c | 33 + tools/testing/selftests/bpf/sockmap_verdict_prog.c | 73 + tools/testing/selftests/bpf/tcp_client.py | 51 + tools/testing/selftests/bpf/tcp_server.py | 83 + tools/testing/selftests/bpf/test_adjust_tail.c | 30 + tools/testing/selftests/bpf/test_align.c | 719 + tools/testing/selftests/bpf/test_btf.c | 2840 ++++ tools/testing/selftests/bpf/test_btf_haskv.c | 45 + tools/testing/selftests/bpf/test_btf_nokv.c | 43 + tools/testing/selftests/bpf/test_cgroup_storage.c | 131 + tools/testing/selftests/bpf/test_dev_cgroup.c | 96 + tools/testing/selftests/bpf/test_get_stack_rawtp.c | 102 + tools/testing/selftests/bpf/test_iptunnel_common.h | 37 + tools/testing/selftests/bpf/test_kmod.sh | 61 + tools/testing/selftests/bpf/test_l4lb.c | 473 + tools/testing/selftests/bpf/test_l4lb_noinline.c | 473 + tools/testing/selftests/bpf/test_libbpf.sh | 43 + tools/testing/selftests/bpf/test_libbpf_open.c | 152 + tools/testing/selftests/bpf/test_lirc_mode2.sh | 40 + tools/testing/selftests/bpf/test_lirc_mode2_kern.c | 23 + tools/testing/selftests/bpf/test_lirc_mode2_user.c | 149 + tools/testing/selftests/bpf/test_lpm_map.c | 804 ++ tools/testing/selftests/bpf/test_lru_map.c | 646 + tools/testing/selftests/bpf/test_lwt_seg6local.c | 437 + tools/testing/selftests/bpf/test_lwt_seg6local.sh | 149 + tools/testing/selftests/bpf/test_maps.c | 1451 ++ tools/testing/selftests/bpf/test_obj_id.c | 35 + tools/testing/selftests/bpf/test_offload.py | 1288 ++ tools/testing/selftests/bpf/test_pkt_access.c | 65 + tools/testing/selftests/bpf/test_pkt_md_access.c | 46 + tools/testing/selftests/bpf/test_progs.c | 1756 +++ .../testing/selftests/bpf/test_select_reuseport.c | 700 + .../selftests/bpf/test_select_reuseport_common.h | 36 + .../selftests/bpf/test_select_reuseport_kern.c | 180 + tools/testing/selftests/bpf/test_skb_cgroup_id.sh | 62 + .../selftests/bpf/test_skb_cgroup_id_kern.c | 47 + .../selftests/bpf/test_skb_cgroup_id_user.c | 187 + tools/testing/selftests/bpf/test_sock.c | 480 + tools/testing/selftests/bpf/test_sock_addr.c | 1441 ++ tools/testing/selftests/bpf/test_sock_addr.sh | 57 + tools/testing/selftests/bpf/test_socket_cookie.c | 225 + tools/testing/selftests/bpf/test_sockhash_kern.c | 5 + tools/testing/selftests/bpf/test_sockmap.c | 1527 +++ tools/testing/selftests/bpf/test_sockmap_kern.c | 5 + tools/testing/selftests/bpf/test_sockmap_kern.h | 363 + .../selftests/bpf/test_stacktrace_build_id.c | 76 + tools/testing/selftests/bpf/test_stacktrace_map.c | 75 + tools/testing/selftests/bpf/test_tag.c | 202 + tools/testing/selftests/bpf/test_tcp_estats.c | 258 + tools/testing/selftests/bpf/test_tcpbpf.h | 17 + tools/testing/selftests/bpf/test_tcpbpf_kern.c | 121 + tools/testing/selftests/bpf/test_tcpbpf_user.c | 131 + tools/testing/selftests/bpf/test_tracepoint.c | 26 + tools/testing/selftests/bpf/test_tunnel.sh | 731 + tools/testing/selftests/bpf/test_tunnel_kern.c | 713 + tools/testing/selftests/bpf/test_verifier.c | 13243 +++++++++++++++++++ tools/testing/selftests/bpf/test_verifier_log.c | 174 + tools/testing/selftests/bpf/test_xdp.c | 235 + tools/testing/selftests/bpf/test_xdp_meta.c | 53 + tools/testing/selftests/bpf/test_xdp_meta.sh | 52 + tools/testing/selftests/bpf/test_xdp_noinline.c | 833 ++ tools/testing/selftests/bpf/test_xdp_redirect.c | 28 + tools/testing/selftests/bpf/test_xdp_redirect.sh | 61 + tools/testing/selftests/bpf/trace_helpers.c | 214 + tools/testing/selftests/bpf/trace_helpers.h | 25 + tools/testing/selftests/bpf/urandom_read.c | 28 + tools/testing/selftests/breakpoints/.gitignore | 2 + tools/testing/selftests/breakpoints/Makefile | 16 + .../selftests/breakpoints/breakpoint_test.c | 401 + .../selftests/breakpoints/breakpoint_test_arm64.c | 258 + .../breakpoints/step_after_suspend_test.c | 220 + tools/testing/selftests/capabilities/.gitignore | 2 + tools/testing/selftests/capabilities/Makefile | 9 + tools/testing/selftests/capabilities/test_execve.c | 460 + .../testing/selftests/capabilities/validate_cap.c | 80 + tools/testing/selftests/cgroup/.gitignore | 2 + tools/testing/selftests/cgroup/Makefile | 12 + tools/testing/selftests/cgroup/cgroup_util.c | 370 + tools/testing/selftests/cgroup/cgroup_util.h | 43 + tools/testing/selftests/cgroup/test_core.c | 567 + tools/testing/selftests/cgroup/test_memcontrol.c | 1228 ++ tools/testing/selftests/cpu-hotplug/Makefile | 11 + tools/testing/selftests/cpu-hotplug/config | 1 + .../selftests/cpu-hotplug/cpu-on-off-test.sh | 293 + tools/testing/selftests/cpufreq/Makefile | 9 + tools/testing/selftests/cpufreq/config | 15 + tools/testing/selftests/cpufreq/cpu.sh | 85 + tools/testing/selftests/cpufreq/cpufreq.sh | 242 + tools/testing/selftests/cpufreq/governor.sh | 154 + tools/testing/selftests/cpufreq/main.sh | 198 + tools/testing/selftests/cpufreq/module.sh | 244 + tools/testing/selftests/cpufreq/special-tests.sh | 116 + tools/testing/selftests/drivers/gpu/drm_mm.sh | 16 + tools/testing/selftests/drivers/gpu/i915.sh | 16 + .../selftests/drivers/net/mlxsw/mirror_gre.sh | 217 + .../drivers/net/mlxsw/mirror_gre_scale.sh | 197 + .../selftests/drivers/net/mlxsw/qos_dscp_bridge.sh | 189 + .../selftests/drivers/net/mlxsw/qos_dscp_router.sh | 233 + .../selftests/drivers/net/mlxsw/router_scale.sh | 167 + .../drivers/net/mlxsw/spectrum-2/tc_flower.sh | 366 + .../net/mlxsw/spectrum/devlink_lib_spectrum.sh | 119 + .../net/mlxsw/spectrum/devlink_resources.sh | 117 + .../drivers/net/mlxsw/spectrum/mirror_gre_scale.sh | 13 + .../drivers/net/mlxsw/spectrum/resource_scale.sh | 55 + .../drivers/net/mlxsw/spectrum/router_scale.sh | 18 + .../drivers/net/mlxsw/spectrum/tc_flower_scale.sh | 19 + .../selftests/drivers/net/mlxsw/tc_flower_scale.sh | 134 + .../selftests/drivers/usb/usbip/usbip_test.sh | 200 + tools/testing/selftests/efivarfs/.gitignore | 2 + tools/testing/selftests/efivarfs/Makefile | 7 + tools/testing/selftests/efivarfs/config | 1 + tools/testing/selftests/efivarfs/create-read.c | 39 + tools/testing/selftests/efivarfs/efivarfs.sh | 215 + tools/testing/selftests/efivarfs/open-unlink.c | 134 + tools/testing/selftests/exec/.gitignore | 9 + tools/testing/selftests/exec/Makefile | 24 + tools/testing/selftests/exec/execveat.c | 425 + tools/testing/selftests/filesystems/.gitignore | 2 + tools/testing/selftests/filesystems/Makefile | 7 + tools/testing/selftests/filesystems/devpts_pts.c | 316 + tools/testing/selftests/filesystems/dnotify_test.c | 35 + tools/testing/selftests/firmware/Makefile | 12 + tools/testing/selftests/firmware/config | 5 + tools/testing/selftests/firmware/fw_fallback.sh | 283 + tools/testing/selftests/firmware/fw_filesystem.sh | 332 + tools/testing/selftests/firmware/fw_lib.sh | 205 + tools/testing/selftests/firmware/fw_run_tests.sh | 70 + tools/testing/selftests/ftrace/.gitignore | 1 + tools/testing/selftests/ftrace/Makefile | 8 + tools/testing/selftests/ftrace/README | 82 + tools/testing/selftests/ftrace/config | 9 + tools/testing/selftests/ftrace/ftracetest | 330 + tools/testing/selftests/ftrace/samples/fail.tc | 4 + tools/testing/selftests/ftrace/samples/pass.tc | 3 + .../testing/selftests/ftrace/samples/unresolved.tc | 4 + .../selftests/ftrace/samples/unsupported.tc | 3 + tools/testing/selftests/ftrace/samples/untested.tc | 3 + tools/testing/selftests/ftrace/samples/xfail.tc | 3 + tools/testing/selftests/ftrace/settings | 1 + .../selftests/ftrace/test.d/00basic/basic1.tc | 3 + .../selftests/ftrace/test.d/00basic/basic2.tc | 9 + .../selftests/ftrace/test.d/00basic/basic3.tc | 10 + .../selftests/ftrace/test.d/00basic/basic4.tc | 5 + .../selftests/ftrace/test.d/00basic/snapshot.tc | 28 + .../selftests/ftrace/test.d/event/event-enable.tc | 62 + .../selftests/ftrace/test.d/event/event-pid.tc | 74 + .../ftrace/test.d/event/subsystem-enable.tc | 62 + .../ftrace/test.d/event/toplevel-enable.tc | 65 + .../ftrace/test.d/ftrace/fgraph-filter-stack.tc | 92 + .../ftrace/test.d/ftrace/fgraph-filter.tc | 53 + .../ftrace/test.d/ftrace/func-filter-glob.tc | 62 + .../ftrace/test.d/ftrace/func-filter-pid.tc | 118 + .../ftrace/test.d/ftrace/func_event_triggers.tc | 123 + .../ftrace/test.d/ftrace/func_profiler.tc | 81 + .../ftrace/test.d/ftrace/func_set_ftrace_file.tc | 170 + .../test.d/ftrace/func_traceonoff_triggers.tc | 186 + tools/testing/selftests/ftrace/test.d/functions | 100 + .../ftrace/test.d/instances/instance-event.tc | 146 + .../selftests/ftrace/test.d/instances/instance.tc | 86 + .../ftrace/test.d/kprobe/add_and_remove.tc | 13 + .../selftests/ftrace/test.d/kprobe/busy_check.tc | 15 + .../selftests/ftrace/test.d/kprobe/kprobe_args.tc | 18 + .../ftrace/test.d/kprobe/kprobe_args_string.tc | 48 + .../ftrace/test.d/kprobe/kprobe_args_syntax.tc | 107 + .../ftrace/test.d/kprobe/kprobe_args_type.tc | 38 + .../ftrace/test.d/kprobe/kprobe_eventname.tc | 37 + .../ftrace/test.d/kprobe/kprobe_ftrace.tc | 56 + .../ftrace/test.d/kprobe/kprobe_module.tc | 29 + .../ftrace/test.d/kprobe/kretprobe_args.tc | 17 + .../ftrace/test.d/kprobe/kretprobe_maxactive.tc | 41 + .../ftrace/test.d/kprobe/multiple_kprobes.tc | 39 + .../selftests/ftrace/test.d/kprobe/probepoint.tc | 43 + .../ftrace/test.d/preemptirq/irqsoff_tracer.tc | 73 + tools/testing/selftests/ftrace/test.d/template | 10 + .../inter-event/trigger-extended-error-support.tc | 39 + .../inter-event/trigger-field-variable-support.tc | 54 + .../trigger-inter-event-combined-hist.tc | 58 + .../inter-event/trigger-multi-actions-accept.tc | 44 + .../inter-event/trigger-onmatch-action-hist.tc | 50 + .../trigger-onmatch-onmax-action-hist.tc | 50 + .../inter-event/trigger-onmax-action-hist.tc | 48 + .../trigger-synthetic-event-createremove.tc | 54 + .../inter-event/trigger-synthetic-event-syntax.tc | 80 + .../ftrace/test.d/trigger/trigger-eventonoff.tc | 66 + .../ftrace/test.d/trigger/trigger-filter.tc | 61 + .../ftrace/test.d/trigger/trigger-hist-mod.tc | 76 + .../ftrace/test.d/trigger/trigger-hist.tc | 84 + .../ftrace/test.d/trigger/trigger-multihist.tc | 74 + .../ftrace/test.d/trigger/trigger-snapshot.tc | 62 + .../ftrace/test.d/trigger/trigger-stacktrace.tc | 54 + .../test.d/trigger/trigger-trace-marker-hist.tc | 49 + .../trigger/trigger-trace-marker-snapshot.tc | 74 + .../trigger-trace-marker-synthetic-kernel.tc | 68 + .../trigger/trigger-trace-marker-synthetic.tc | 66 + .../ftrace/test.d/trigger/trigger-traceonoff.tc | 59 + tools/testing/selftests/futex/Makefile | 37 + tools/testing/selftests/futex/README | 62 + .../testing/selftests/futex/functional/.gitignore | 7 + tools/testing/selftests/futex/functional/Makefile | 25 + .../selftests/futex/functional/futex_requeue_pi.c | 412 + .../functional/futex_requeue_pi_mismatched_ops.c | 138 + .../functional/futex_requeue_pi_signal_restart.c | 225 + .../functional/futex_wait_private_mapped_file.c | 128 + .../futex/functional/futex_wait_timeout.c | 89 + .../functional/futex_wait_uninitialized_heap.c | 126 + .../futex/functional/futex_wait_wouldblock.c | 81 + tools/testing/selftests/futex/functional/run.sh | 79 + tools/testing/selftests/futex/include/atomic.h | 83 + tools/testing/selftests/futex/include/futextest.h | 266 + tools/testing/selftests/futex/include/logging.h | 152 + tools/testing/selftests/futex/run.sh | 33 + tools/testing/selftests/gen_kselftest_tar.sh | 53 + tools/testing/selftests/gpio/.gitignore | 1 + tools/testing/selftests/gpio/Makefile | 29 + tools/testing/selftests/gpio/config | 2 + tools/testing/selftests/gpio/gpio-mockup-chardev.c | 327 + tools/testing/selftests/gpio/gpio-mockup-sysfs.sh | 135 + tools/testing/selftests/gpio/gpio-mockup.sh | 206 + tools/testing/selftests/ia64/.gitignore | 1 + tools/testing/selftests/ia64/Makefile | 9 + tools/testing/selftests/ia64/aliasing-test.c | 263 + tools/testing/selftests/intel_pstate/.gitignore | 2 + tools/testing/selftests/intel_pstate/Makefile | 16 + tools/testing/selftests/intel_pstate/aperf.c | 83 + tools/testing/selftests/intel_pstate/msr.c | 40 + tools/testing/selftests/intel_pstate/run.sh | 128 + tools/testing/selftests/ipc/.gitignore | 2 + tools/testing/selftests/ipc/Makefile | 18 + tools/testing/selftests/ipc/config | 2 + tools/testing/selftests/ipc/msgque.c | 255 + tools/testing/selftests/kcmp/.gitignore | 2 + tools/testing/selftests/kcmp/Makefile | 8 + tools/testing/selftests/kcmp/kcmp_test.c | 166 + tools/testing/selftests/kmod/Makefile | 11 + tools/testing/selftests/kmod/config | 7 + tools/testing/selftests/kmod/kmod.sh | 623 + tools/testing/selftests/kselftest.h | 183 + tools/testing/selftests/kselftest_harness.h | 779 ++ tools/testing/selftests/kselftest_install.sh | 35 + tools/testing/selftests/kvm/.gitignore | 6 + tools/testing/selftests/kvm/Makefile | 43 + tools/testing/selftests/kvm/config | 3 + tools/testing/selftests/kvm/cr4_cpuid_sync_test.c | 113 + tools/testing/selftests/kvm/dirty_log_test.c | 308 + tools/testing/selftests/kvm/include/kvm_util.h | 194 + tools/testing/selftests/kvm/include/sparsebit.h | 75 + tools/testing/selftests/kvm/include/test_util.h | 44 + tools/testing/selftests/kvm/include/vmx.h | 552 + tools/testing/selftests/kvm/include/x86.h | 1047 ++ tools/testing/selftests/kvm/lib/assert.c | 92 + tools/testing/selftests/kvm/lib/elf.c | 197 + tools/testing/selftests/kvm/lib/io.c | 158 + tools/testing/selftests/kvm/lib/kvm_util.c | 1680 +++ .../testing/selftests/kvm/lib/kvm_util_internal.h | 72 + tools/testing/selftests/kvm/lib/sparsebit.c | 2087 +++ tools/testing/selftests/kvm/lib/vmx.c | 283 + tools/testing/selftests/kvm/lib/x86.c | 893 ++ tools/testing/selftests/kvm/platform_info_test.c | 110 + tools/testing/selftests/kvm/set_sregs_test.c | 54 + tools/testing/selftests/kvm/state_test.c | 196 + tools/testing/selftests/kvm/sync_regs_test.c | 237 + tools/testing/selftests/kvm/vmx_tsc_adjust_test.c | 175 + tools/testing/selftests/lib.mk | 169 + tools/testing/selftests/lib/Makefile | 8 + tools/testing/selftests/lib/bitmap.sh | 19 + tools/testing/selftests/lib/config | 3 + tools/testing/selftests/lib/prime_numbers.sh | 19 + tools/testing/selftests/lib/printf.sh | 19 + tools/testing/selftests/locking/Makefile | 10 + tools/testing/selftests/locking/ww_mutex.sh | 19 + tools/testing/selftests/media_tests/.gitignore | 3 + tools/testing/selftests/media_tests/Makefile | 6 + .../selftests/media_tests/bind_unbind_sample.sh | 13 + .../selftests/media_tests/media_device_open.c | 82 + .../selftests/media_tests/media_device_test.c | 103 + .../selftests/media_tests/open_loop_test.sh | 11 + .../selftests/media_tests/regression_test.txt | 43 + .../selftests/media_tests/video_device_test.c | 101 + tools/testing/selftests/membarrier/.gitignore | 1 + tools/testing/selftests/membarrier/Makefile | 6 + .../testing/selftests/membarrier/membarrier_test.c | 312 + tools/testing/selftests/memfd/.gitignore | 4 + tools/testing/selftests/memfd/Makefile | 20 + tools/testing/selftests/memfd/common.c | 46 + tools/testing/selftests/memfd/common.h | 9 + tools/testing/selftests/memfd/config | 1 + tools/testing/selftests/memfd/fuse_mnt.c | 111 + tools/testing/selftests/memfd/fuse_test.c | 330 + tools/testing/selftests/memfd/memfd_test.c | 970 ++ tools/testing/selftests/memfd/run_fuse_test.sh | 15 + .../testing/selftests/memfd/run_hugetlbfs_test.sh | 68 + tools/testing/selftests/memory-hotplug/Makefile | 11 + tools/testing/selftests/memory-hotplug/config | 5 + .../selftests/memory-hotplug/mem-on-off-test.sh | 291 + tools/testing/selftests/mount/.gitignore | 1 + tools/testing/selftests/mount/Makefile | 9 + tools/testing/selftests/mount/config | 1 + tools/testing/selftests/mount/run_tests.sh | 12 + .../selftests/mount/unprivileged-remount-test.c | 371 + tools/testing/selftests/mqueue/.gitignore | 2 + tools/testing/selftests/mqueue/Makefile | 7 + tools/testing/selftests/mqueue/mq_open_tests.c | 502 + tools/testing/selftests/mqueue/mq_perf_tests.c | 752 ++ tools/testing/selftests/net/.gitignore | 16 + tools/testing/selftests/net/Makefile | 23 + tools/testing/selftests/net/config | 16 + tools/testing/selftests/net/fib-onlink-tests.sh | 467 + tools/testing/selftests/net/fib_rule_tests.sh | 255 + tools/testing/selftests/net/fib_tests.sh | 1439 ++ tools/testing/selftests/net/forwarding/.gitignore | 1 + tools/testing/selftests/net/forwarding/README | 58 + .../net/forwarding/bridge_port_isolation.sh | 151 + .../selftests/net/forwarding/bridge_vlan_aware.sh | 151 + .../net/forwarding/bridge_vlan_unaware.sh | 104 + tools/testing/selftests/net/forwarding/config | 12 + .../selftests/net/forwarding/devlink_lib.sh | 108 + .../net/forwarding/forwarding.config.sample | 35 + .../selftests/net/forwarding/gre_multipath.sh | 257 + tools/testing/selftests/net/forwarding/lib.sh | 964 ++ .../testing/selftests/net/forwarding/mirror_gre.sh | 160 + .../selftests/net/forwarding/mirror_gre_bound.sh | 226 + .../net/forwarding/mirror_gre_bridge_1d.sh | 132 + .../net/forwarding/mirror_gre_bridge_1d_vlan.sh | 132 + .../net/forwarding/mirror_gre_bridge_1q.sh | 129 + .../net/forwarding/mirror_gre_bridge_1q_lag.sh | 283 + .../selftests/net/forwarding/mirror_gre_changes.sh | 271 + .../selftests/net/forwarding/mirror_gre_flower.sh | 137 + .../net/forwarding/mirror_gre_lag_lacp.sh | 285 + .../selftests/net/forwarding/mirror_gre_lib.sh | 130 + .../selftests/net/forwarding/mirror_gre_neigh.sh | 115 + .../selftests/net/forwarding/mirror_gre_nh.sh | 131 + .../net/forwarding/mirror_gre_topo_lib.sh | 94 + .../selftests/net/forwarding/mirror_gre_vlan.sh | 92 + .../net/forwarding/mirror_gre_vlan_bridge_1q.sh | 283 + .../testing/selftests/net/forwarding/mirror_lib.sh | 132 + .../selftests/net/forwarding/mirror_topo_lib.sh | 101 + .../selftests/net/forwarding/mirror_vlan.sh | 131 + tools/testing/selftests/net/forwarding/router.sh | 135 + .../selftests/net/forwarding/router_bridge.sh | 113 + .../selftests/net/forwarding/router_bridge_vlan.sh | 132 + .../selftests/net/forwarding/router_broadcast.sh | 233 + .../selftests/net/forwarding/router_multipath.sh | 342 + .../testing/selftests/net/forwarding/tc_actions.sh | 213 + .../testing/selftests/net/forwarding/tc_chains.sh | 205 + .../testing/selftests/net/forwarding/tc_common.sh | 25 + .../testing/selftests/net/forwarding/tc_flower.sh | 260 + .../selftests/net/forwarding/tc_shblocks.sh | 125 + tools/testing/selftests/net/in_netns.sh | 23 + tools/testing/selftests/net/ip6_gre_headroom.sh | 65 + tools/testing/selftests/net/msg_zerocopy.c | 810 ++ tools/testing/selftests/net/msg_zerocopy.sh | 120 + tools/testing/selftests/net/netdevice.sh | 205 + tools/testing/selftests/net/pmtu.sh | 477 + tools/testing/selftests/net/psock_fanout.c | 486 + tools/testing/selftests/net/psock_lib.h | 158 + tools/testing/selftests/net/psock_snd.c | 397 + tools/testing/selftests/net/psock_snd.sh | 98 + tools/testing/selftests/net/psock_tpacket.c | 864 ++ tools/testing/selftests/net/reuseaddr_conflict.c | 114 + tools/testing/selftests/net/reuseport_bpf.c | 641 + tools/testing/selftests/net/reuseport_bpf_cpu.c | 259 + tools/testing/selftests/net/reuseport_bpf_numa.c | 258 + tools/testing/selftests/net/reuseport_dualstack.c | 210 + tools/testing/selftests/net/rtnetlink.sh | 1023 ++ tools/testing/selftests/net/run_afpackettests | 27 + tools/testing/selftests/net/run_netsocktests | 13 + tools/testing/selftests/net/socket.c | 93 + tools/testing/selftests/net/tcp_inq.c | 189 + tools/testing/selftests/net/tcp_mmap.c | 447 + tools/testing/selftests/net/test_bpf.sh | 11 + tools/testing/selftests/net/tls.c | 741 ++ tools/testing/selftests/net/udpgso.c | 685 + tools/testing/selftests/net/udpgso.sh | 29 + tools/testing/selftests/net/udpgso_bench.sh | 71 + tools/testing/selftests/net/udpgso_bench_rx.c | 265 + tools/testing/selftests/net/udpgso_bench_tx.c | 426 + tools/testing/selftests/netfilter/Makefile | 6 + tools/testing/selftests/netfilter/config | 2 + .../selftests/netfilter/conntrack_icmp_related.sh | 283 + tools/testing/selftests/netfilter/nft_nat.sh | 766 ++ .../selftests/netfilter/nft_trans_stress.sh | 78 + .../selftests/networking/timestamping/.gitignore | 4 + .../selftests/networking/timestamping/Makefile | 13 + .../networking/timestamping/hwtstamp_config.c | 135 + .../networking/timestamping/rxtimestamp.c | 389 + .../networking/timestamping/timestamping.c | 534 + .../networking/timestamping/txtimestamp.c | 564 + tools/testing/selftests/nsfs/.gitignore | 2 + tools/testing/selftests/nsfs/Makefile | 5 + tools/testing/selftests/nsfs/config | 3 + tools/testing/selftests/nsfs/owner.c | 92 + tools/testing/selftests/nsfs/pidns.c | 79 + tools/testing/selftests/ntb/ntb_test.sh | 590 + tools/testing/selftests/powerpc/Makefile | 74 + .../testing/selftests/powerpc/alignment/.gitignore | 2 + tools/testing/selftests/powerpc/alignment/Makefile | 6 + .../powerpc/alignment/alignment_handler.c | 575 + .../powerpc/alignment/copy_first_unaligned.c | 72 + .../selftests/powerpc/benchmarks/.gitignore | 7 + .../testing/selftests/powerpc/benchmarks/Makefile | 18 + .../selftests/powerpc/benchmarks/context_switch.c | 506 + .../selftests/powerpc/benchmarks/exec_target.c | 16 + tools/testing/selftests/powerpc/benchmarks/fork.c | 325 + .../selftests/powerpc/benchmarks/futex_bench.c | 43 + .../selftests/powerpc/benchmarks/gettimeofday.c | 31 + .../selftests/powerpc/benchmarks/mmap_bench.c | 90 + .../selftests/powerpc/benchmarks/null_syscall.c | 157 + .../selftests/powerpc/cache_shape/.gitignore | 1 + .../testing/selftests/powerpc/cache_shape/Makefile | 7 + .../selftests/powerpc/cache_shape/cache_shape.c | 125 + .../testing/selftests/powerpc/copyloops/.gitignore | 13 + tools/testing/selftests/powerpc/copyloops/Makefile | 53 + .../selftests/powerpc/copyloops/asm/asm-compat.h | 0 .../selftests/powerpc/copyloops/asm/export.h | 2 + .../powerpc/copyloops/asm/feature-fixups.h | 0 .../selftests/powerpc/copyloops/asm/ppc_asm.h | 47 + .../selftests/powerpc/copyloops/asm/processor.h | 0 .../powerpc/copyloops/copy_tofrom_user_reference.S | 24 + .../selftests/powerpc/copyloops/copyuser_64.S | 1 + .../selftests/powerpc/copyloops/copyuser_power7.S | 1 + .../selftests/powerpc/copyloops/exc_validate.c | 124 + .../selftests/powerpc/copyloops/memcpy_64.S | 1 + .../selftests/powerpc/copyloops/memcpy_power7.S | 1 + tools/testing/selftests/powerpc/copyloops/stubs.S | 19 + .../testing/selftests/powerpc/copyloops/validate.c | 100 + tools/testing/selftests/powerpc/dscr/.gitignore | 7 + tools/testing/selftests/powerpc/dscr/Makefile | 11 + tools/testing/selftests/powerpc/dscr/dscr.h | 125 + .../selftests/powerpc/dscr/dscr_default_test.c | 127 + .../selftests/powerpc/dscr/dscr_explicit_test.c | 71 + .../powerpc/dscr/dscr_inherit_exec_test.c | 109 + .../selftests/powerpc/dscr/dscr_inherit_test.c | 87 + .../selftests/powerpc/dscr/dscr_sysfs_test.c | 101 + .../powerpc/dscr/dscr_sysfs_thread_test.c | 80 + .../selftests/powerpc/dscr/dscr_user_test.c | 61 + tools/testing/selftests/powerpc/harness.c | 131 + .../testing/selftests/powerpc/include/basic_asm.h | 74 + tools/testing/selftests/powerpc/include/fpu_asm.h | 80 + tools/testing/selftests/powerpc/include/gpr_asm.h | 96 + .../selftests/powerpc/include/instructions.h | 69 + tools/testing/selftests/powerpc/include/reg.h | 146 + tools/testing/selftests/powerpc/include/subunit.h | 52 + tools/testing/selftests/powerpc/include/utils.h | 83 + tools/testing/selftests/powerpc/include/vmx_asm.h | 96 + tools/testing/selftests/powerpc/include/vsx_asm.h | 71 + tools/testing/selftests/powerpc/lib/reg.S | 397 + tools/testing/selftests/powerpc/math/.gitignore | 7 + tools/testing/selftests/powerpc/math/Makefile | 19 + tools/testing/selftests/powerpc/math/fpu_asm.S | 135 + tools/testing/selftests/powerpc/math/fpu_preempt.c | 113 + tools/testing/selftests/powerpc/math/fpu_signal.c | 135 + tools/testing/selftests/powerpc/math/fpu_syscall.c | 90 + tools/testing/selftests/powerpc/math/vmx_asm.S | 152 + tools/testing/selftests/powerpc/math/vmx_preempt.c | 112 + tools/testing/selftests/powerpc/math/vmx_signal.c | 156 + tools/testing/selftests/powerpc/math/vmx_syscall.c | 91 + tools/testing/selftests/powerpc/math/vsx_asm.S | 61 + tools/testing/selftests/powerpc/math/vsx_preempt.c | 147 + tools/testing/selftests/powerpc/mm/.gitignore | 5 + tools/testing/selftests/powerpc/mm/Makefile | 19 + .../selftests/powerpc/mm/hugetlb_vs_thp_test.c | 77 + tools/testing/selftests/powerpc/mm/prot_sao.c | 42 + tools/testing/selftests/powerpc/mm/segv_errors.c | 78 + tools/testing/selftests/powerpc/mm/subpage_prot.c | 236 + tools/testing/selftests/powerpc/mm/tlbie_test.c | 734 + tools/testing/selftests/powerpc/pmu/.gitignore | 3 + tools/testing/selftests/powerpc/pmu/Makefile | 46 + .../selftests/powerpc/pmu/count_instructions.c | 147 + tools/testing/selftests/powerpc/pmu/ebb/.gitignore | 22 + tools/testing/selftests/powerpc/pmu/ebb/Makefile | 28 + .../powerpc/pmu/ebb/back_to_back_ebbs_test.c | 106 + .../testing/selftests/powerpc/pmu/ebb/busy_loop.S | 271 + .../powerpc/pmu/ebb/close_clears_pmcc_test.c | 61 + .../powerpc/pmu/ebb/cpu_event_pinned_vs_ebb_test.c | 95 + .../powerpc/pmu/ebb/cpu_event_vs_ebb_test.c | 91 + .../selftests/powerpc/pmu/ebb/cycles_test.c | 58 + .../powerpc/pmu/ebb/cycles_with_freeze_test.c | 117 + .../powerpc/pmu/ebb/cycles_with_mmcr2_test.c | 91 + tools/testing/selftests/powerpc/pmu/ebb/ebb.c | 485 + tools/testing/selftests/powerpc/pmu/ebb/ebb.h | 78 + .../selftests/powerpc/pmu/ebb/ebb_handler.S | 365 + .../selftests/powerpc/pmu/ebb/ebb_on_child_test.c | 88 + .../powerpc/pmu/ebb/ebb_on_willing_child_test.c | 92 + .../powerpc/pmu/ebb/ebb_vs_cpu_event_test.c | 88 + .../powerpc/pmu/ebb/event_attributes_test.c | 133 + .../powerpc/pmu/ebb/fixed_instruction_loop.S | 43 + .../selftests/powerpc/pmu/ebb/fork_cleanup_test.c | 81 + .../powerpc/pmu/ebb/instruction_count_test.c | 167 + .../powerpc/pmu/ebb/lost_exception_test.c | 102 + .../selftests/powerpc/pmu/ebb/multi_counter_test.c | 86 + .../powerpc/pmu/ebb/multi_ebb_procs_test.c | 109 + .../selftests/powerpc/pmu/ebb/no_handler_test.c | 61 + .../selftests/powerpc/pmu/ebb/pmae_handling_test.c | 106 + .../powerpc/pmu/ebb/pmc56_overflow_test.c | 93 + .../selftests/powerpc/pmu/ebb/reg_access_test.c | 40 + .../pmu/ebb/task_event_pinned_vs_ebb_test.c | 93 + .../powerpc/pmu/ebb/task_event_vs_ebb_test.c | 85 + tools/testing/selftests/powerpc/pmu/ebb/trace.c | 300 + tools/testing/selftests/powerpc/pmu/ebb/trace.h | 41 + tools/testing/selftests/powerpc/pmu/event.c | 131 + tools/testing/selftests/powerpc/pmu/event.h | 43 + tools/testing/selftests/powerpc/pmu/l3_bank_test.c | 48 + tools/testing/selftests/powerpc/pmu/lib.c | 227 + tools/testing/selftests/powerpc/pmu/lib.h | 40 + tools/testing/selftests/powerpc/pmu/loop.S | 43 + .../selftests/powerpc/pmu/per_event_excludes.c | 114 + .../selftests/powerpc/primitives/.gitignore | 1 + .../testing/selftests/powerpc/primitives/Makefile | 8 + .../selftests/powerpc/primitives/asm/asm-compat.h | 1 + .../selftests/powerpc/primitives/asm/asm-const.h | 1 + .../powerpc/primitives/asm/feature-fixups.h | 1 + .../selftests/powerpc/primitives/asm/firmware.h | 0 .../selftests/powerpc/primitives/asm/ppc-opcode.h | 0 .../selftests/powerpc/primitives/asm/ppc_asm.h | 1 + .../selftests/powerpc/primitives/asm/processor.h | 0 .../selftests/powerpc/primitives/linux/stringify.h | 0 .../powerpc/primitives/load_unaligned_zeropad.c | 159 + .../selftests/powerpc/primitives/word-at-a-time.h | 1 + tools/testing/selftests/powerpc/ptrace/.gitignore | 12 + tools/testing/selftests/powerpc/ptrace/Makefile | 15 + tools/testing/selftests/powerpc/ptrace/child.h | 139 + tools/testing/selftests/powerpc/ptrace/core-pkey.c | 462 + .../selftests/powerpc/ptrace/perf-hwbreak.c | 195 + .../testing/selftests/powerpc/ptrace/ptrace-gpr.c | 123 + .../testing/selftests/powerpc/ptrace/ptrace-gpr.h | 74 + .../selftests/powerpc/ptrace/ptrace-hwbreak.c | 342 + .../testing/selftests/powerpc/ptrace/ptrace-pkey.c | 330 + .../testing/selftests/powerpc/ptrace/ptrace-tar.c | 135 + .../testing/selftests/powerpc/ptrace/ptrace-tar.h | 50 + .../selftests/powerpc/ptrace/ptrace-tm-gpr.c | 158 + .../selftests/powerpc/ptrace/ptrace-tm-spd-gpr.c | 169 + .../selftests/powerpc/ptrace/ptrace-tm-spd-tar.c | 174 + .../selftests/powerpc/ptrace/ptrace-tm-spd-vsx.c | 184 + .../selftests/powerpc/ptrace/ptrace-tm-spr.c | 167 + .../selftests/powerpc/ptrace/ptrace-tm-tar.c | 160 + .../selftests/powerpc/ptrace/ptrace-tm-vsx.c | 167 + .../testing/selftests/powerpc/ptrace/ptrace-vsx.c | 117 + .../testing/selftests/powerpc/ptrace/ptrace-vsx.h | 127 + tools/testing/selftests/powerpc/ptrace/ptrace.h | 749 ++ tools/testing/selftests/powerpc/scripts/hmi.sh | 89 + tools/testing/selftests/powerpc/signal/.gitignore | 2 + tools/testing/selftests/powerpc/signal/Makefile | 10 + tools/testing/selftests/powerpc/signal/signal.S | 50 + tools/testing/selftests/powerpc/signal/signal.c | 111 + tools/testing/selftests/powerpc/signal/signal_tm.c | 110 + .../selftests/powerpc/stringloops/.gitignore | 1 + .../testing/selftests/powerpc/stringloops/Makefile | 35 + .../selftests/powerpc/stringloops/asm/cache.h | 1 + .../selftests/powerpc/stringloops/asm/export.h | 1 + .../selftests/powerpc/stringloops/asm/ppc-opcode.h | 39 + .../selftests/powerpc/stringloops/asm/ppc_asm.h | 33 + .../testing/selftests/powerpc/stringloops/memcmp.c | 159 + .../selftests/powerpc/stringloops/memcmp_32.S | 1 + .../selftests/powerpc/stringloops/memcmp_64.S | 1 + .../testing/selftests/powerpc/stringloops/string.c | 21 + .../testing/selftests/powerpc/stringloops/strlen.c | 127 + .../selftests/powerpc/stringloops/strlen_32.S | 1 + .../selftests/powerpc/switch_endian/.gitignore | 2 + .../selftests/powerpc/switch_endian/Makefile | 18 + .../selftests/powerpc/switch_endian/check.S | 101 + .../selftests/powerpc/switch_endian/common.h | 7 + .../powerpc/switch_endian/switch_endian_test.S | 82 + .../testing/selftests/powerpc/syscalls/.gitignore | 1 + tools/testing/selftests/powerpc/syscalls/Makefile | 8 + tools/testing/selftests/powerpc/syscalls/ipc.h | 48 + .../selftests/powerpc/syscalls/ipc_unmuxed.c | 61 + tools/testing/selftests/powerpc/tm/.gitignore | 17 + tools/testing/selftests/powerpc/tm/Makefile | 26 + tools/testing/selftests/powerpc/tm/tm-exec.c | 70 + tools/testing/selftests/powerpc/tm/tm-fork.c | 42 + .../testing/selftests/powerpc/tm/tm-resched-dscr.c | 100 + .../powerpc/tm/tm-signal-context-chk-fpu.c | 92 + .../powerpc/tm/tm-signal-context-chk-gpr.c | 90 + .../powerpc/tm/tm-signal-context-chk-vmx.c | 110 + .../powerpc/tm/tm-signal-context-chk-vsx.c | 125 + .../selftests/powerpc/tm/tm-signal-msr-resv.c | 74 + .../testing/selftests/powerpc/tm/tm-signal-stack.c | 76 + tools/testing/selftests/powerpc/tm/tm-signal.S | 114 + tools/testing/selftests/powerpc/tm/tm-sigreturn.c | 93 + .../testing/selftests/powerpc/tm/tm-syscall-asm.S | 28 + tools/testing/selftests/powerpc/tm/tm-syscall.c | 106 + tools/testing/selftests/powerpc/tm/tm-tar.c | 91 + tools/testing/selftests/powerpc/tm/tm-tmspr.c | 150 + tools/testing/selftests/powerpc/tm/tm-trap.c | 331 + .../testing/selftests/powerpc/tm/tm-unavailable.c | 407 + .../testing/selftests/powerpc/tm/tm-vmx-unavail.c | 118 + tools/testing/selftests/powerpc/tm/tm-vmxcopy.c | 104 + tools/testing/selftests/powerpc/tm/tm.h | 96 + tools/testing/selftests/powerpc/utils.c | 136 + tools/testing/selftests/powerpc/vphn/.gitignore | 1 + tools/testing/selftests/powerpc/vphn/Makefile | 9 + tools/testing/selftests/powerpc/vphn/test-vphn.c | 411 + tools/testing/selftests/powerpc/vphn/vphn.c | 1 + tools/testing/selftests/powerpc/vphn/vphn.h | 1 + tools/testing/selftests/prctl/.gitignore | 3 + tools/testing/selftests/prctl/Makefile | 16 + .../prctl/disable-tsc-ctxt-sw-stress-test.c | 98 + .../prctl/disable-tsc-on-off-stress-test.c | 97 + tools/testing/selftests/prctl/disable-tsc-test.c | 96 + tools/testing/selftests/proc/.gitignore | 14 + tools/testing/selftests/proc/Makefile | 20 + tools/testing/selftests/proc/config | 1 + tools/testing/selftests/proc/fd-001-lookup.c | 168 + tools/testing/selftests/proc/fd-002-posix-eq.c | 57 + tools/testing/selftests/proc/fd-003-kthread.c | 178 + tools/testing/selftests/proc/proc-loadavg-001.c | 82 + .../selftests/proc/proc-self-map-files-001.c | 82 + .../selftests/proc/proc-self-map-files-002.c | 90 + tools/testing/selftests/proc/proc-self-syscall.c | 59 + tools/testing/selftests/proc/proc-self-wchan.c | 40 + tools/testing/selftests/proc/proc-uptime-001.c | 45 + tools/testing/selftests/proc/proc-uptime-002.c | 78 + tools/testing/selftests/proc/proc-uptime.h | 60 + tools/testing/selftests/proc/proc.h | 51 + tools/testing/selftests/proc/read.c | 132 + tools/testing/selftests/proc/self.c | 39 + tools/testing/selftests/proc/setns-dcache.c | 129 + tools/testing/selftests/proc/thread-self.c | 64 + tools/testing/selftests/pstore/.gitignore | 2 + tools/testing/selftests/pstore/Makefile | 14 + tools/testing/selftests/pstore/common_tests | 83 + tools/testing/selftests/pstore/config | 5 + tools/testing/selftests/pstore/pstore_crash_test | 30 + .../selftests/pstore/pstore_post_reboot_tests | 80 + tools/testing/selftests/pstore/pstore_tests | 30 + tools/testing/selftests/ptp/.gitignore | 1 + tools/testing/selftests/ptp/Makefile | 10 + tools/testing/selftests/ptp/testptp.c | 521 + tools/testing/selftests/ptp/testptp.mk | 33 + tools/testing/selftests/ptrace/.gitignore | 1 + tools/testing/selftests/ptrace/Makefile | 5 + tools/testing/selftests/ptrace/peeksiginfo.c | 219 + tools/testing/selftests/rcutorture/.gitignore | 4 + .../selftests/rcutorture/bin/configNR_CPUS.sh | 45 + .../selftests/rcutorture/bin/config_override.sh | 61 + .../selftests/rcutorture/bin/configcheck.sh | 54 + .../testing/selftests/rcutorture/bin/configinit.sh | 72 + tools/testing/selftests/rcutorture/bin/cpus2use.sh | 41 + .../testing/selftests/rcutorture/bin/functions.sh | 279 + tools/testing/selftests/rcutorture/bin/jitter.sh | 90 + .../testing/selftests/rcutorture/bin/kvm-build.sh | 60 + .../selftests/rcutorture/bin/kvm-find-errors.sh | 56 + .../selftests/rcutorture/bin/kvm-recheck-lock.sh | 51 + .../selftests/rcutorture/bin/kvm-recheck-rcu.sh | 74 + .../rcutorture/bin/kvm-recheck-rcuperf-ftrace.sh | 122 + .../rcutorture/bin/kvm-recheck-rcuperf.sh | 96 + .../selftests/rcutorture/bin/kvm-recheck.sh | 73 + .../selftests/rcutorture/bin/kvm-test-1-run.sh | 271 + tools/testing/selftests/rcutorture/bin/kvm.sh | 471 + .../selftests/rcutorture/bin/parse-build.sh | 62 + .../selftests/rcutorture/bin/parse-console.sh | 176 + .../selftests/rcutorture/configs/lock/BUSTED | 6 + .../selftests/rcutorture/configs/lock/BUSTED.boot | 1 + .../selftests/rcutorture/configs/lock/CFLIST | 7 + .../selftests/rcutorture/configs/lock/CFcommon | 2 + .../selftests/rcutorture/configs/lock/LOCK01 | 6 + .../selftests/rcutorture/configs/lock/LOCK02 | 6 + .../selftests/rcutorture/configs/lock/LOCK02.boot | 1 + .../selftests/rcutorture/configs/lock/LOCK03 | 6 + .../selftests/rcutorture/configs/lock/LOCK03.boot | 1 + .../selftests/rcutorture/configs/lock/LOCK04 | 6 + .../selftests/rcutorture/configs/lock/LOCK04.boot | 1 + .../selftests/rcutorture/configs/lock/LOCK05 | 6 + .../selftests/rcutorture/configs/lock/LOCK05.boot | 1 + .../selftests/rcutorture/configs/lock/LOCK06 | 6 + .../selftests/rcutorture/configs/lock/LOCK06.boot | 1 + .../selftests/rcutorture/configs/lock/LOCK07 | 6 + .../selftests/rcutorture/configs/lock/LOCK07.boot | 1 + .../rcutorture/configs/lock/ver_functions.sh | 42 + .../selftests/rcutorture/configs/rcu/BUSTED | 7 + .../selftests/rcutorture/configs/rcu/BUSTED.boot | 1 + .../selftests/rcutorture/configs/rcu/CFLIST | 18 + .../selftests/rcutorture/configs/rcu/CFcommon | 2 + .../selftests/rcutorture/configs/rcu/SRCU-N | 8 + .../selftests/rcutorture/configs/rcu/SRCU-N.boot | 1 + .../selftests/rcutorture/configs/rcu/SRCU-P | 12 + .../selftests/rcutorture/configs/rcu/SRCU-P.boot | 1 + .../selftests/rcutorture/configs/rcu/SRCU-t | 10 + .../selftests/rcutorture/configs/rcu/SRCU-t.boot | 1 + .../selftests/rcutorture/configs/rcu/SRCU-u | 10 + .../selftests/rcutorture/configs/rcu/SRCU-u.boot | 1 + .../selftests/rcutorture/configs/rcu/TASKS01 | 10 + .../selftests/rcutorture/configs/rcu/TASKS01.boot | 1 + .../selftests/rcutorture/configs/rcu/TASKS02 | 4 + .../selftests/rcutorture/configs/rcu/TASKS02.boot | 1 + .../selftests/rcutorture/configs/rcu/TASKS03 | 12 + .../selftests/rcutorture/configs/rcu/TASKS03.boot | 1 + .../selftests/rcutorture/configs/rcu/TINY01 | 13 + .../selftests/rcutorture/configs/rcu/TINY02 | 14 + .../selftests/rcutorture/configs/rcu/TINY02.boot | 3 + .../selftests/rcutorture/configs/rcu/TREE01 | 18 + .../selftests/rcutorture/configs/rcu/TREE01.boot | 5 + .../selftests/rcutorture/configs/rcu/TREE02 | 23 + .../selftests/rcutorture/configs/rcu/TREE03 | 18 + .../selftests/rcutorture/configs/rcu/TREE03.boot | 5 + .../selftests/rcutorture/configs/rcu/TREE04 | 20 + .../selftests/rcutorture/configs/rcu/TREE04.boot | 1 + .../selftests/rcutorture/configs/rcu/TREE05 | 20 + .../selftests/rcutorture/configs/rcu/TREE05.boot | 5 + .../selftests/rcutorture/configs/rcu/TREE06 | 23 + .../selftests/rcutorture/configs/rcu/TREE06.boot | 7 + .../selftests/rcutorture/configs/rcu/TREE07 | 17 + .../selftests/rcutorture/configs/rcu/TREE07.boot | 1 + .../selftests/rcutorture/configs/rcu/TREE08 | 23 + .../selftests/rcutorture/configs/rcu/TREE08.boot | 5 + .../selftests/rcutorture/configs/rcu/TREE09 | 18 + .../rcutorture/configs/rcu/ver_functions.sh | 56 + .../selftests/rcutorture/configs/rcuperf/CFLIST | 1 + .../selftests/rcutorture/configs/rcuperf/CFcommon | 2 + .../selftests/rcutorture/configs/rcuperf/TINY | 16 + .../selftests/rcutorture/configs/rcuperf/TREE | 19 + .../selftests/rcutorture/configs/rcuperf/TREE54 | 22 + .../rcutorture/configs/rcuperf/ver_functions.sh | 29 + .../testing/selftests/rcutorture/doc/TINY_RCU.txt | 38 + .../selftests/rcutorture/doc/TREE_RCU-kconfig.txt | 81 + tools/testing/selftests/rcutorture/doc/initrd.txt | 113 + .../selftests/rcutorture/doc/rcu-test-image.txt | 42 + .../rcutorture/formal/srcu-cbmc/.gitignore | 1 + .../selftests/rcutorture/formal/srcu-cbmc/Makefile | 17 + .../formal/srcu-cbmc/empty_includes/linux/delay.h | 0 .../formal/srcu-cbmc/empty_includes/linux/export.h | 0 .../formal/srcu-cbmc/empty_includes/linux/mutex.h | 0 .../formal/srcu-cbmc/empty_includes/linux/percpu.h | 0 .../srcu-cbmc/empty_includes/linux/preempt.h | 0 .../srcu-cbmc/empty_includes/linux/rcupdate.h | 0 .../formal/srcu-cbmc/empty_includes/linux/sched.h | 0 .../formal/srcu-cbmc/empty_includes/linux/smp.h | 0 .../srcu-cbmc/empty_includes/linux/workqueue.h | 0 .../srcu-cbmc/empty_includes/uapi/linux/types.h | 0 .../formal/srcu-cbmc/include/linux/.gitignore | 1 + .../formal/srcu-cbmc/include/linux/kconfig.h | 1 + .../formal/srcu-cbmc/include/linux/types.h | 156 + .../rcutorture/formal/srcu-cbmc/modify_srcu.awk | 376 + .../rcutorture/formal/srcu-cbmc/src/assume.h | 17 + .../rcutorture/formal/srcu-cbmc/src/barriers.h | 41 + .../rcutorture/formal/srcu-cbmc/src/bug_on.h | 14 + .../formal/srcu-cbmc/src/combined_source.c | 14 + .../rcutorture/formal/srcu-cbmc/src/config.h | 28 + .../rcutorture/formal/srcu-cbmc/src/include_srcu.c | 32 + .../rcutorture/formal/srcu-cbmc/src/int_typedefs.h | 34 + .../rcutorture/formal/srcu-cbmc/src/locks.h | 221 + .../rcutorture/formal/srcu-cbmc/src/misc.c | 12 + .../rcutorture/formal/srcu-cbmc/src/misc.h | 58 + .../rcutorture/formal/srcu-cbmc/src/percpu.h | 93 + .../rcutorture/formal/srcu-cbmc/src/preempt.c | 79 + .../rcutorture/formal/srcu-cbmc/src/preempt.h | 59 + .../formal/srcu-cbmc/src/simple_sync_srcu.c | 51 + .../rcutorture/formal/srcu-cbmc/src/workqueues.h | 103 + .../srcu-cbmc/tests/store_buffering/.gitignore | 1 + .../srcu-cbmc/tests/store_buffering/Makefile | 12 + .../tests/store_buffering/assert_end.fail | 1 + .../srcu-cbmc/tests/store_buffering/force.fail | 1 + .../srcu-cbmc/tests/store_buffering/force2.fail | 1 + .../srcu-cbmc/tests/store_buffering/force3.fail | 1 + .../srcu-cbmc/tests/store_buffering/main.pass | 0 .../formal/srcu-cbmc/tests/store_buffering/test.c | 73 + .../formal/srcu-cbmc/tests/test_script.sh | 103 + tools/testing/selftests/rseq/.gitignore | 6 + tools/testing/selftests/rseq/Makefile | 30 + .../testing/selftests/rseq/basic_percpu_ops_test.c | 312 + tools/testing/selftests/rseq/basic_test.c | 56 + tools/testing/selftests/rseq/param_test.c | 1331 ++ tools/testing/selftests/rseq/rseq-arm.h | 716 + tools/testing/selftests/rseq/rseq-arm64.h | 594 + tools/testing/selftests/rseq/rseq-mips.h | 725 + tools/testing/selftests/rseq/rseq-ppc.h | 671 + tools/testing/selftests/rseq/rseq-s390.h | 513 + tools/testing/selftests/rseq/rseq-skip.h | 65 + tools/testing/selftests/rseq/rseq-x86.h | 1132 ++ tools/testing/selftests/rseq/rseq.c | 117 + tools/testing/selftests/rseq/rseq.h | 163 + tools/testing/selftests/rseq/run_param_test.sh | 121 + tools/testing/selftests/rseq/settings | 1 + tools/testing/selftests/rtc/.gitignore | 2 + tools/testing/selftests/rtc/Makefile | 9 + tools/testing/selftests/rtc/rtctest.c | 337 + tools/testing/selftests/rtc/setdate.c | 86 + tools/testing/selftests/seccomp/.gitignore | 2 + tools/testing/selftests/seccomp/Makefile | 17 + tools/testing/selftests/seccomp/config | 2 + .../testing/selftests/seccomp/seccomp_benchmark.c | 99 + tools/testing/selftests/seccomp/seccomp_bpf.c | 2997 +++++ tools/testing/selftests/sigaltstack/.gitignore | 1 + tools/testing/selftests/sigaltstack/Makefile | 5 + tools/testing/selftests/sigaltstack/sas.c | 191 + tools/testing/selftests/size/.gitignore | 1 + tools/testing/selftests/size/Makefile | 5 + tools/testing/selftests/size/get_size.c | 117 + tools/testing/selftests/sparc64/Makefile | 50 + tools/testing/selftests/sparc64/drivers/.gitignore | 1 + tools/testing/selftests/sparc64/drivers/Makefile | 15 + tools/testing/selftests/sparc64/drivers/adi-test.c | 721 + .../selftests/sparc64/drivers/drivers_test.sh | 30 + tools/testing/selftests/sparc64/run.sh | 3 + tools/testing/selftests/splice/.gitignore | 1 + tools/testing/selftests/splice/Makefile | 5 + .../selftests/splice/default_file_splice_read.c | 9 + .../selftests/splice/default_file_splice_read.sh | 8 + tools/testing/selftests/static_keys/Makefile | 8 + tools/testing/selftests/static_keys/config | 1 + .../selftests/static_keys/test_static_keys.sh | 30 + tools/testing/selftests/sync/.gitignore | 1 + tools/testing/selftests/sync/Makefile | 38 + tools/testing/selftests/sync/config | 4 + tools/testing/selftests/sync/sw_sync.h | 46 + tools/testing/selftests/sync/sync.c | 221 + tools/testing/selftests/sync/sync.h | 40 + tools/testing/selftests/sync/sync_alloc.c | 74 + tools/testing/selftests/sync/sync_fence.c | 132 + tools/testing/selftests/sync/sync_merge.c | 60 + .../testing/selftests/sync/sync_stress_consumer.c | 185 + tools/testing/selftests/sync/sync_stress_merge.c | 115 + .../selftests/sync/sync_stress_parallelism.c | 111 + tools/testing/selftests/sync/sync_test.c | 113 + tools/testing/selftests/sync/sync_wait.c | 91 + tools/testing/selftests/sync/synctest.h | 67 + tools/testing/selftests/sysctl/Makefile | 12 + tools/testing/selftests/sysctl/config | 1 + tools/testing/selftests/sysctl/sysctl.sh | 780 ++ tools/testing/selftests/tc-testing/.gitignore | 2 + tools/testing/selftests/tc-testing/README | 247 + tools/testing/selftests/tc-testing/TODO.txt | 31 + tools/testing/selftests/tc-testing/TdcPlugin.py | 74 + tools/testing/selftests/tc-testing/bpf/Makefile | 29 + tools/testing/selftests/tc-testing/bpf/action.c | 23 + tools/testing/selftests/tc-testing/config | 48 + .../tc-testing/creating-plugins/AddingPlugins.txt | 104 + .../creating-testcases/AddingTestCases.txt | 100 + .../tc-testing/creating-testcases/example.json | 55 + .../tc-testing/creating-testcases/template.json | 51 + .../selftests/tc-testing/plugin-lib/README-PLUGINS | 27 + .../selftests/tc-testing/plugin-lib/nsPlugin.py | 141 + .../selftests/tc-testing/plugin-lib/rootPlugin.py | 19 + .../tc-testing/plugin-lib/valgrindPlugin.py | 142 + .../selftests/tc-testing/plugins/__init__.py | 0 .../selftests/tc-testing/tc-tests/actions/bpf.json | 294 + .../tc-testing/tc-tests/actions/connmark.json | 291 + .../tc-testing/tc-tests/actions/csum.json | 504 + .../tc-testing/tc-tests/actions/gact.json | 540 + .../selftests/tc-testing/tc-tests/actions/ife.json | 1064 ++ .../tc-testing/tc-tests/actions/mirred.json | 438 + .../selftests/tc-testing/tc-tests/actions/nat.json | 593 + .../tc-testing/tc-tests/actions/police.json | 719 + .../tc-testing/tc-tests/actions/sample.json | 612 + .../tc-testing/tc-tests/actions/simple.json | 130 + .../tc-testing/tc-tests/actions/skbedit.json | 488 + .../tc-testing/tc-tests/actions/skbmod.json | 396 + .../tc-testing/tc-tests/actions/tunnel_key.json | 888 ++ .../tc-testing/tc-tests/actions/vlan.json | 692 + .../selftests/tc-testing/tc-tests/filters/fw.json | 1049 ++ .../tc-testing/tc-tests/filters/tests.json | 42 + tools/testing/selftests/tc-testing/tdc.py | 663 + tools/testing/selftests/tc-testing/tdc_batch.py | 62 + tools/testing/selftests/tc-testing/tdc_config.py | 36 + .../tc-testing/tdc_config_local_template.py | 23 + tools/testing/selftests/tc-testing/tdc_helper.py | 67 + tools/testing/selftests/timers/.gitignore | 21 + tools/testing/selftests/timers/Makefile | 23 + tools/testing/selftests/timers/adjtick.c | 211 + .../testing/selftests/timers/alarmtimer-suspend.c | 178 + tools/testing/selftests/timers/change_skew.c | 96 + .../testing/selftests/timers/clocksource-switch.c | 168 + tools/testing/selftests/timers/freq-step.c | 271 + .../testing/selftests/timers/inconsistency-check.c | 193 + tools/testing/selftests/timers/leap-a-day.c | 378 + tools/testing/selftests/timers/leapcrash.c | 108 + tools/testing/selftests/timers/mqueue-lat.c | 114 + tools/testing/selftests/timers/nanosleep.c | 165 + tools/testing/selftests/timers/nsleep-lat.c | 180 + tools/testing/selftests/timers/posix_timers.c | 222 + tools/testing/selftests/timers/raw_skew.c | 148 + tools/testing/selftests/timers/rtcpie.c | 142 + tools/testing/selftests/timers/set-2038.c | 133 + tools/testing/selftests/timers/set-tai.c | 69 + tools/testing/selftests/timers/set-timer-lat.c | 283 + tools/testing/selftests/timers/set-tz.c | 110 + tools/testing/selftests/timers/skew_consistency.c | 78 + tools/testing/selftests/timers/threadtest.c | 193 + tools/testing/selftests/timers/valid-adjtimex.c | 330 + tools/testing/selftests/uevent/Makefile | 17 + tools/testing/selftests/uevent/config | 2 + tools/testing/selftests/uevent/uevent_filtering.c | 486 + tools/testing/selftests/user/Makefile | 8 + tools/testing/selftests/user/config | 1 + tools/testing/selftests/user/test_user_copy.sh | 18 + tools/testing/selftests/vDSO/.gitignore | 2 + tools/testing/selftests/vDSO/Makefile | 26 + tools/testing/selftests/vDSO/parse_vdso.c | 269 + .../selftests/vDSO/vdso_standalone_test_x86.c | 128 + tools/testing/selftests/vDSO/vdso_test.c | 68 + tools/testing/selftests/vm/.gitignore | 15 + tools/testing/selftests/vm/Makefile | 34 + tools/testing/selftests/vm/compaction_test.c | 230 + tools/testing/selftests/vm/config | 2 + tools/testing/selftests/vm/gup_benchmark.c | 93 + tools/testing/selftests/vm/hugepage-mmap.c | 93 + tools/testing/selftests/vm/hugepage-shm.c | 101 + tools/testing/selftests/vm/map_hugetlb.c | 84 + tools/testing/selftests/vm/map_populate.c | 113 + tools/testing/selftests/vm/mlock-random-test.c | 294 + tools/testing/selftests/vm/mlock2-tests.c | 520 + tools/testing/selftests/vm/mlock2.h | 63 + tools/testing/selftests/vm/on-fault-limit.c | 48 + tools/testing/selftests/vm/run_vmtests | 214 + tools/testing/selftests/vm/thuge-gen.c | 257 + tools/testing/selftests/vm/transhuge-stress.c | 144 + tools/testing/selftests/vm/userfaultfd.c | 1333 ++ tools/testing/selftests/vm/va_128TBswitch.c | 297 + tools/testing/selftests/vm/virtual_address_range.c | 139 + tools/testing/selftests/watchdog/.gitignore | 1 + tools/testing/selftests/watchdog/Makefile | 4 + tools/testing/selftests/watchdog/watchdog-test.c | 167 + tools/testing/selftests/x86/.gitignore | 15 + tools/testing/selftests/x86/Makefile | 105 + tools/testing/selftests/x86/check_cc.sh | 16 + .../selftests/x86/check_initial_reg_state.c | 109 + tools/testing/selftests/x86/entry_from_vm86.c | 349 + tools/testing/selftests/x86/fsgsbase.c | 427 + tools/testing/selftests/x86/ioperm.c | 171 + tools/testing/selftests/x86/iopl.c | 136 + tools/testing/selftests/x86/ldt_gdt.c | 927 ++ tools/testing/selftests/x86/mov_ss_trap.c | 285 + tools/testing/selftests/x86/mpx-debug.h | 15 + tools/testing/selftests/x86/mpx-dig.c | 499 + tools/testing/selftests/x86/mpx-hw.h | 124 + tools/testing/selftests/x86/mpx-mini-test.c | 1616 +++ tools/testing/selftests/x86/mpx-mm.h | 10 + tools/testing/selftests/x86/pkey-helpers.h | 219 + tools/testing/selftests/x86/protection_keys.c | 1508 +++ tools/testing/selftests/x86/ptrace_syscall.c | 430 + .../testing/selftests/x86/raw_syscall_helper_32.S | 47 + tools/testing/selftests/x86/sigreturn.c | 871 ++ tools/testing/selftests/x86/single_step_syscall.c | 187 + tools/testing/selftests/x86/syscall_arg_fault.c | 130 + tools/testing/selftests/x86/syscall_nt.c | 96 + tools/testing/selftests/x86/sysret_rip.c | 195 + tools/testing/selftests/x86/sysret_ss_attrs.c | 112 + tools/testing/selftests/x86/test_FCMOV.c | 94 + tools/testing/selftests/x86/test_FCOMI.c | 332 + tools/testing/selftests/x86/test_FISTTP.c | 138 + tools/testing/selftests/x86/test_mremap_vdso.c | 115 + tools/testing/selftests/x86/test_syscall_vdso.c | 408 + tools/testing/selftests/x86/test_vdso.c | 337 + tools/testing/selftests/x86/test_vsyscall.c | 506 + tools/testing/selftests/x86/thunks.S | 67 + tools/testing/selftests/x86/thunks_32.S | 55 + .../testing/selftests/x86/trivial_32bit_program.c | 18 + .../testing/selftests/x86/trivial_64bit_program.c | 18 + tools/testing/selftests/x86/trivial_program.c | 10 + tools/testing/selftests/x86/unwind_vdso.c | 211 + tools/testing/selftests/x86/vdso_restorer.c | 88 + tools/testing/selftests/zram/Makefile | 9 + tools/testing/selftests/zram/README | 40 + tools/testing/selftests/zram/config | 2 + tools/testing/selftests/zram/zram.sh | 18 + tools/testing/selftests/zram/zram01.sh | 84 + tools/testing/selftests/zram/zram02.sh | 53 + tools/testing/selftests/zram/zram_lib.sh | 278 + tools/testing/vsock/.gitignore | 2 + tools/testing/vsock/Makefile | 9 + tools/testing/vsock/README | 36 + tools/testing/vsock/control.c | 219 + tools/testing/vsock/control.h | 13 + tools/testing/vsock/timeout.c | 64 + tools/testing/vsock/timeout.h | 14 + tools/testing/vsock/vsock_diag_test.c | 681 + tools/thermal/tmon/.gitignore | 1 + tools/thermal/tmon/Makefile | 58 + tools/thermal/tmon/README | 50 + tools/thermal/tmon/pid.c | 131 + tools/thermal/tmon/sysfs.c | 598 + tools/thermal/tmon/tmon.8 | 145 + tools/thermal/tmon/tmon.c | 385 + tools/thermal/tmon/tmon.h | 204 + tools/thermal/tmon/tui.c | 665 + tools/time/udelay_test.sh | 66 + tools/usb/.gitignore | 2 + tools/usb/Makefile | 14 + .../multibuff/device_app/aio_multibuff.c | 380 + .../ffs-aio-example/multibuff/host_app/Makefile | 14 + .../usb/ffs-aio-example/multibuff/host_app/test.c | 175 + .../ffs-aio-example/simple/device_app/aio_simple.c | 368 + tools/usb/ffs-aio-example/simple/host_app/Makefile | 13 + tools/usb/ffs-aio-example/simple/host_app/test.c | 178 + tools/usb/ffs-test.c | 694 + tools/usb/hcd-tests.sh | 276 + tools/usb/testusb.c | 541 + tools/usb/usbip/.gitignore | 32 + tools/usb/usbip/AUTHORS | 3 + tools/usb/usbip/COPYING | 340 + tools/usb/usbip/INSTALL | 237 + tools/usb/usbip/Makefile.am | 8 + tools/usb/usbip/README | 257 + tools/usb/usbip/autogen.sh | 9 + tools/usb/usbip/cleanup.sh | 13 + tools/usb/usbip/configure.ac | 111 + tools/usb/usbip/doc/usbip.8 | 95 + tools/usb/usbip/doc/usbipd.8 | 91 + tools/usb/usbip/libsrc/Makefile.am | 11 + tools/usb/usbip/libsrc/list.h | 137 + tools/usb/usbip/libsrc/names.c | 504 + tools/usb/usbip/libsrc/names.h | 41 + tools/usb/usbip/libsrc/sysfs_utils.c | 32 + tools/usb/usbip/libsrc/sysfs_utils.h | 9 + tools/usb/usbip/libsrc/usbip_common.c | 316 + tools/usb/usbip/libsrc/usbip_common.h | 152 + tools/usb/usbip/libsrc/usbip_device_driver.c | 168 + tools/usb/usbip/libsrc/usbip_device_driver.h | 34 + tools/usb/usbip/libsrc/usbip_host_common.c | 294 + tools/usb/usbip/libsrc/usbip_host_common.h | 104 + tools/usb/usbip/libsrc/usbip_host_driver.c | 65 + tools/usb/usbip/libsrc/usbip_host_driver.h | 32 + tools/usb/usbip/libsrc/vhci_driver.c | 467 + tools/usb/usbip/libsrc/vhci_driver.h | 67 + tools/usb/usbip/src/Makefile.am | 12 + tools/usb/usbip/src/usbip.c | 203 + tools/usb/usbip/src/usbip.h | 40 + tools/usb/usbip/src/usbip_attach.c | 255 + tools/usb/usbip/src/usbip_bind.c | 223 + tools/usb/usbip/src/usbip_detach.c | 136 + tools/usb/usbip/src/usbip_list.c | 384 + tools/usb/usbip/src/usbip_network.c | 315 + tools/usb/usbip/src/usbip_network.h | 178 + tools/usb/usbip/src/usbip_port.c | 66 + tools/usb/usbip/src/usbip_unbind.c | 141 + tools/usb/usbip/src/usbipd.c | 698 + tools/usb/usbip/src/utils.c | 55 + tools/usb/usbip/src/utils.h | 25 + tools/usb/usbip/vudc/vudc_server_example.sh | 107 + tools/virtio/.gitignore | 3 + tools/virtio/Makefile | 15 + tools/virtio/asm/barrier.h | 21 + tools/virtio/linux/bug.h | 11 + tools/virtio/linux/compiler.h | 10 + tools/virtio/linux/device.h | 2 + tools/virtio/linux/dma-mapping.h | 32 + tools/virtio/linux/err.h | 27 + tools/virtio/linux/export.h | 3 + tools/virtio/linux/hrtimer.h | 0 tools/virtio/linux/irqreturn.h | 1 + tools/virtio/linux/kernel.h | 144 + tools/virtio/linux/kmemleak.h | 3 + tools/virtio/linux/module.h | 7 + tools/virtio/linux/printk.h | 4 + tools/virtio/linux/ratelimit.h | 4 + tools/virtio/linux/scatterlist.h | 172 + tools/virtio/linux/slab.h | 7 + tools/virtio/linux/thread_info.h | 1 + tools/virtio/linux/uaccess.h | 52 + tools/virtio/linux/uio.h | 3 + tools/virtio/linux/virtio.h | 68 + tools/virtio/linux/virtio_byteorder.h | 9 + tools/virtio/linux/virtio_config.h | 92 + tools/virtio/linux/virtio_ring.h | 1 + tools/virtio/linux/vringh.h | 1 + tools/virtio/ringtest/Makefile | 31 + tools/virtio/ringtest/README | 6 + tools/virtio/ringtest/main.c | 391 + tools/virtio/ringtest/main.h | 194 + tools/virtio/ringtest/noring.c | 72 + tools/virtio/ringtest/ptr_ring.c | 210 + tools/virtio/ringtest/ring.c | 270 + tools/virtio/ringtest/run-on-all.sh | 26 + tools/virtio/ringtest/virtio_ring_0_9.c | 333 + tools/virtio/ringtest/virtio_ring_inorder.c | 2 + tools/virtio/ringtest/virtio_ring_poll.c | 2 + tools/virtio/uapi/linux/uio.h | 1 + tools/virtio/uapi/linux/virtio_config.h | 1 + tools/virtio/uapi/linux/virtio_ring.h | 5 + tools/virtio/uapi/linux/virtio_types.h | 1 + tools/virtio/vhost_test/Makefile | 2 + tools/virtio/vhost_test/vhost_test.c | 1 + tools/virtio/virtio-trace/Makefile | 14 + tools/virtio/virtio-trace/README | 118 + tools/virtio/virtio-trace/trace-agent-ctl.c | 137 + tools/virtio/virtio-trace/trace-agent-rw.c | 192 + tools/virtio/virtio-trace/trace-agent.c | 270 + tools/virtio/virtio-trace/trace-agent.h | 76 + tools/virtio/virtio_test.c | 303 + tools/virtio/vringh_test.c | 751 ++ tools/vm/.gitignore | 2 + tools/vm/Makefile | 32 + tools/vm/page-types.c | 1384 ++ tools/vm/page_owner_sort.c | 150 + tools/vm/slabinfo-gnuplot.sh | 275 + tools/vm/slabinfo.c | 1483 +++ tools/wmi/Makefile | 17 + tools/wmi/dell-smbios-example.c | 210 + 2901 files changed, 644103 insertions(+) create mode 100644 tools/Makefile create mode 100644 tools/accounting/.gitignore create mode 100644 tools/accounting/Makefile create mode 100644 tools/accounting/getdelays.c create mode 100644 tools/arch/alpha/include/asm/barrier.h create mode 100644 tools/arch/alpha/include/uapi/asm/bitsperlong.h create mode 100644 tools/arch/alpha/include/uapi/asm/errno.h create mode 100644 tools/arch/alpha/include/uapi/asm/mman.h create mode 100644 tools/arch/arc/include/uapi/asm/mman.h create mode 100644 tools/arch/arm/include/asm/barrier.h create mode 100644 tools/arch/arm/include/uapi/asm/kvm.h create mode 100644 tools/arch/arm/include/uapi/asm/mman.h create mode 100644 tools/arch/arm/include/uapi/asm/perf_regs.h create mode 100644 tools/arch/arm64/include/asm/barrier.h create mode 100644 tools/arch/arm64/include/uapi/asm/bitsperlong.h create mode 100644 tools/arch/arm64/include/uapi/asm/bpf_perf_event.h create mode 100644 tools/arch/arm64/include/uapi/asm/kvm.h create mode 100644 tools/arch/arm64/include/uapi/asm/mman.h create mode 100644 tools/arch/arm64/include/uapi/asm/perf_regs.h create mode 100644 tools/arch/arm64/include/uapi/asm/unistd.h create mode 100644 tools/arch/h8300/include/asm/bitsperlong.h create mode 100644 tools/arch/h8300/include/uapi/asm/mman.h create mode 100644 tools/arch/hexagon/include/uapi/asm/bitsperlong.h create mode 100644 tools/arch/hexagon/include/uapi/asm/mman.h create mode 100644 tools/arch/ia64/include/asm/barrier.h create mode 100644 tools/arch/ia64/include/uapi/asm/bitsperlong.h create mode 100644 tools/arch/ia64/include/uapi/asm/mman.h create mode 100644 tools/arch/microblaze/include/uapi/asm/bitsperlong.h create mode 100644 tools/arch/microblaze/include/uapi/asm/mman.h create mode 100644 tools/arch/mips/include/asm/barrier.h create mode 100644 tools/arch/mips/include/asm/errno.h create mode 100644 tools/arch/mips/include/uapi/asm/bitsperlong.h create mode 100644 tools/arch/mips/include/uapi/asm/errno.h create mode 100644 tools/arch/mips/include/uapi/asm/kvm.h create mode 100644 tools/arch/mips/include/uapi/asm/mman.h create mode 100644 tools/arch/parisc/include/uapi/asm/bitsperlong.h create mode 100644 tools/arch/parisc/include/uapi/asm/errno.h create mode 100644 tools/arch/parisc/include/uapi/asm/mman.h create mode 100644 tools/arch/powerpc/include/asm/barrier.h create mode 100644 tools/arch/powerpc/include/uapi/asm/bitsperlong.h create mode 100644 tools/arch/powerpc/include/uapi/asm/errno.h create mode 100644 tools/arch/powerpc/include/uapi/asm/kvm.h create mode 100644 tools/arch/powerpc/include/uapi/asm/mman.h create mode 100644 tools/arch/powerpc/include/uapi/asm/perf_regs.h create mode 100644 tools/arch/powerpc/include/uapi/asm/unistd.h create mode 100644 tools/arch/riscv/include/uapi/asm/bitsperlong.h create mode 100644 tools/arch/s390/include/asm/barrier.h create mode 100644 tools/arch/s390/include/uapi/asm/bitsperlong.h create mode 100644 tools/arch/s390/include/uapi/asm/bpf_perf_event.h create mode 100644 tools/arch/s390/include/uapi/asm/kvm.h create mode 100644 tools/arch/s390/include/uapi/asm/kvm_perf.h create mode 100644 tools/arch/s390/include/uapi/asm/mman.h create mode 100644 tools/arch/s390/include/uapi/asm/perf_regs.h create mode 100644 tools/arch/s390/include/uapi/asm/ptrace.h create mode 100644 tools/arch/s390/include/uapi/asm/sie.h create mode 100644 tools/arch/sh/include/asm/barrier.h create mode 100644 tools/arch/sh/include/uapi/asm/mman.h create mode 100644 tools/arch/sparc/include/asm/barrier.h create mode 100644 tools/arch/sparc/include/asm/barrier_32.h create mode 100644 tools/arch/sparc/include/asm/barrier_64.h create mode 100644 tools/arch/sparc/include/uapi/asm/bitsperlong.h create mode 100644 tools/arch/sparc/include/uapi/asm/errno.h create mode 100644 tools/arch/sparc/include/uapi/asm/mman.h create mode 100644 tools/arch/x86/include/asm/atomic.h create mode 100644 tools/arch/x86/include/asm/barrier.h create mode 100644 tools/arch/x86/include/asm/cmpxchg.h create mode 100644 tools/arch/x86/include/asm/cpufeatures.h create mode 100644 tools/arch/x86/include/asm/disabled-features.h create mode 100644 tools/arch/x86/include/asm/mcsafe_test.h create mode 100644 tools/arch/x86/include/asm/required-features.h create mode 100644 tools/arch/x86/include/asm/rmwcc.h create mode 100644 tools/arch/x86/include/asm/unistd_32.h create mode 100644 tools/arch/x86/include/asm/unistd_64.h create mode 100644 tools/arch/x86/include/uapi/asm/bitsperlong.h create mode 100644 tools/arch/x86/include/uapi/asm/errno.h create mode 100644 tools/arch/x86/include/uapi/asm/kvm.h create mode 100644 tools/arch/x86/include/uapi/asm/kvm_perf.h create mode 100644 tools/arch/x86/include/uapi/asm/mman.h create mode 100644 tools/arch/x86/include/uapi/asm/perf_regs.h create mode 100644 tools/arch/x86/include/uapi/asm/svm.h create mode 100644 tools/arch/x86/include/uapi/asm/unistd.h create mode 100644 tools/arch/x86/include/uapi/asm/vmx.h create mode 100644 tools/arch/x86/lib/memcpy_64.S create mode 100644 tools/arch/x86/lib/memset_64.S create mode 100644 tools/arch/xtensa/include/asm/barrier.h create mode 100644 tools/arch/xtensa/include/uapi/asm/mman.h create mode 100644 tools/bpf/.gitignore create mode 100644 tools/bpf/Makefile create mode 100644 tools/bpf/Makefile.helpers create mode 100644 tools/bpf/bpf_asm.c create mode 100644 tools/bpf/bpf_dbg.c create mode 100644 tools/bpf/bpf_exp.l create mode 100644 tools/bpf/bpf_exp.y create mode 100644 tools/bpf/bpf_jit_disasm.c create mode 100644 tools/bpf/bpftool/.gitignore create mode 100644 tools/bpf/bpftool/Documentation/Makefile create mode 100644 tools/bpf/bpftool/Documentation/bpftool-cgroup.rst create mode 100644 tools/bpf/bpftool/Documentation/bpftool-map.rst create mode 100644 tools/bpf/bpftool/Documentation/bpftool-perf.rst create mode 100644 tools/bpf/bpftool/Documentation/bpftool-prog.rst create mode 100644 tools/bpf/bpftool/Documentation/bpftool.rst create mode 100644 tools/bpf/bpftool/Makefile create mode 100644 tools/bpf/bpftool/bash-completion/bpftool create mode 100644 tools/bpf/bpftool/btf_dumper.c create mode 100644 tools/bpf/bpftool/cfg.c create mode 100644 tools/bpf/bpftool/cfg.h create mode 100644 tools/bpf/bpftool/cgroup.c create mode 100644 tools/bpf/bpftool/common.c create mode 100644 tools/bpf/bpftool/jit_disasm.c create mode 100644 tools/bpf/bpftool/json_writer.c create mode 100644 tools/bpf/bpftool/json_writer.h create mode 100644 tools/bpf/bpftool/main.c create mode 100644 tools/bpf/bpftool/main.h create mode 100644 tools/bpf/bpftool/map.c create mode 100644 tools/bpf/bpftool/map_perf_ring.c create mode 100644 tools/bpf/bpftool/perf.c create mode 100644 tools/bpf/bpftool/prog.c create mode 100644 tools/bpf/bpftool/xlated_dumper.c create mode 100644 tools/bpf/bpftool/xlated_dumper.h create mode 100644 tools/build/.gitignore create mode 100644 tools/build/Build create mode 100644 tools/build/Build.include create mode 100644 tools/build/Documentation/Build.txt create mode 100644 tools/build/Makefile create mode 100644 tools/build/Makefile.build create mode 100644 tools/build/Makefile.feature create mode 100644 tools/build/Makefile.include create mode 100644 tools/build/feature/.gitignore create mode 100644 tools/build/feature/Makefile create mode 100644 tools/build/feature/test-all.c create mode 100644 tools/build/feature/test-backtrace.c create mode 100644 tools/build/feature/test-bionic.c create mode 100644 tools/build/feature/test-bpf.c create mode 100644 tools/build/feature/test-clang.cpp create mode 100644 tools/build/feature/test-compile.c create mode 100644 tools/build/feature/test-cplus-demangle.c create mode 100644 tools/build/feature/test-cxx.cpp create mode 100644 tools/build/feature/test-disassembler-four-args.c create mode 100644 tools/build/feature/test-dwarf.c create mode 100644 tools/build/feature/test-dwarf_getlocations.c create mode 100644 tools/build/feature/test-eventfd.c create mode 100644 tools/build/feature/test-fortify-source.c create mode 100644 tools/build/feature/test-get_cpuid.c create mode 100644 tools/build/feature/test-get_current_dir_name.c create mode 100644 tools/build/feature/test-gettid.c create mode 100644 tools/build/feature/test-glibc.c create mode 100644 tools/build/feature/test-gtk2-infobar.c create mode 100644 tools/build/feature/test-gtk2.c create mode 100644 tools/build/feature/test-hello.c create mode 100644 tools/build/feature/test-jvmti.c create mode 100644 tools/build/feature/test-libaudit.c create mode 100644 tools/build/feature/test-libbabeltrace.c create mode 100644 tools/build/feature/test-libbfd.c create mode 100644 tools/build/feature/test-libcrypto.c create mode 100644 tools/build/feature/test-libdw-dwarf-unwind.c create mode 100644 tools/build/feature/test-libelf-gelf_getnote.c create mode 100644 tools/build/feature/test-libelf-getphdrnum.c create mode 100644 tools/build/feature/test-libelf-getshdrstrndx.c create mode 100644 tools/build/feature/test-libelf-mmap.c create mode 100644 tools/build/feature/test-libelf.c create mode 100644 tools/build/feature/test-libnuma.c create mode 100644 tools/build/feature/test-libopencsd.c create mode 100644 tools/build/feature/test-libperl.c create mode 100644 tools/build/feature/test-libpython.c create mode 100644 tools/build/feature/test-libslang.c create mode 100644 tools/build/feature/test-libunwind-aarch64.c create mode 100644 tools/build/feature/test-libunwind-arm.c create mode 100644 tools/build/feature/test-libunwind-debug-frame-aarch64.c create mode 100644 tools/build/feature/test-libunwind-debug-frame-arm.c create mode 100644 tools/build/feature/test-libunwind-debug-frame.c create mode 100644 tools/build/feature/test-libunwind-x86.c create mode 100644 tools/build/feature/test-libunwind-x86_64.c create mode 100644 tools/build/feature/test-libunwind.c create mode 100644 tools/build/feature/test-llvm-version.cpp create mode 100644 tools/build/feature/test-llvm.cpp create mode 100644 tools/build/feature/test-lzma.c create mode 100644 tools/build/feature/test-numa_num_possible_cpus.c create mode 100644 tools/build/feature/test-pthread-attr-setaffinity-np.c create mode 100644 tools/build/feature/test-pthread-barrier.c create mode 100644 tools/build/feature/test-reallocarray.c create mode 100644 tools/build/feature/test-sched_getcpu.c create mode 100644 tools/build/feature/test-sdt.c create mode 100644 tools/build/feature/test-setns.c create mode 100644 tools/build/feature/test-stackprotector-all.c create mode 100644 tools/build/feature/test-sync-compare-and-swap.c create mode 100644 tools/build/feature/test-timerfd.c create mode 100644 tools/build/feature/test-zlib.c create mode 100644 tools/build/fixdep.c create mode 100644 tools/build/tests/ex/Build create mode 100644 tools/build/tests/ex/Makefile create mode 100644 tools/build/tests/ex/a.c create mode 100644 tools/build/tests/ex/arch/Build create mode 100644 tools/build/tests/ex/arch/e.c create mode 100644 tools/build/tests/ex/arch/f.c create mode 100644 tools/build/tests/ex/b.c create mode 100644 tools/build/tests/ex/c.c create mode 100644 tools/build/tests/ex/d.c create mode 100644 tools/build/tests/ex/empty/Build create mode 100644 tools/build/tests/ex/empty2/README create mode 100644 tools/build/tests/ex/ex.c create mode 100644 tools/build/tests/ex/inc.c create mode 100755 tools/build/tests/run.sh create mode 100644 tools/cgroup/.gitignore create mode 100644 tools/cgroup/Makefile create mode 100644 tools/cgroup/cgroup_event_listener.c create mode 100644 tools/firewire/Makefile create mode 100644 tools/firewire/decode-fcp.c create mode 100644 tools/firewire/list.h create mode 100644 tools/firewire/nosy-dump.c create mode 100644 tools/firewire/nosy-dump.h create mode 100644 tools/gpio/.gitignore create mode 100644 tools/gpio/Build create mode 100644 tools/gpio/Makefile create mode 100644 tools/gpio/gpio-event-mon.c create mode 100644 tools/gpio/gpio-hammer.c create mode 100644 tools/gpio/gpio-utils.c create mode 100644 tools/gpio/gpio-utils.h create mode 100644 tools/gpio/lsgpio.c create mode 100644 tools/hv/Makefile create mode 100644 tools/hv/hv_fcopy_daemon.c create mode 100755 tools/hv/hv_get_dhcp_info.sh create mode 100755 tools/hv/hv_get_dns_info.sh create mode 100644 tools/hv/hv_kvp_daemon.c create mode 100755 tools/hv/hv_set_ifconfig.sh create mode 100644 tools/hv/hv_vss_daemon.c create mode 100644 tools/hv/lsvmbus create mode 100644 tools/iio/Build create mode 100644 tools/iio/Makefile create mode 100644 tools/iio/iio_event_monitor.c create mode 100644 tools/iio/iio_generic_buffer.c create mode 100644 tools/iio/iio_utils.c create mode 100644 tools/iio/iio_utils.h create mode 100644 tools/iio/lsiio.c create mode 100644 tools/include/asm-generic/atomic-gcc.h create mode 100644 tools/include/asm-generic/barrier.h create mode 100644 tools/include/asm-generic/bitops.h create mode 100644 tools/include/asm-generic/bitops/__ffs.h create mode 100644 tools/include/asm-generic/bitops/__ffz.h create mode 100644 tools/include/asm-generic/bitops/__fls.h create mode 100644 tools/include/asm-generic/bitops/arch_hweight.h create mode 100644 tools/include/asm-generic/bitops/atomic.h create mode 100644 tools/include/asm-generic/bitops/const_hweight.h create mode 100644 tools/include/asm-generic/bitops/find.h create mode 100644 tools/include/asm-generic/bitops/fls.h create mode 100644 tools/include/asm-generic/bitops/fls64.h create mode 100644 tools/include/asm-generic/bitops/hweight.h create mode 100644 tools/include/asm-generic/bitsperlong.h create mode 100644 tools/include/asm-generic/hugetlb_encode.h create mode 100644 tools/include/asm/alternative-asm.h create mode 100644 tools/include/asm/atomic.h create mode 100644 tools/include/asm/barrier.h create mode 100644 tools/include/asm/bug.h create mode 100644 tools/include/asm/export.h create mode 100644 tools/include/asm/sections.h create mode 100644 tools/include/linux/atomic.h create mode 100644 tools/include/linux/bitmap.h create mode 100644 tools/include/linux/bitops.h create mode 100644 tools/include/linux/bits.h create mode 100644 tools/include/linux/bug.h create mode 100644 tools/include/linux/compiler-gcc.h create mode 100644 tools/include/linux/compiler.h create mode 100644 tools/include/linux/coresight-pmu.h create mode 100644 tools/include/linux/debug_locks.h create mode 100644 tools/include/linux/delay.h create mode 100644 tools/include/linux/err.h create mode 100644 tools/include/linux/export.h create mode 100644 tools/include/linux/filter.h create mode 100644 tools/include/linux/ftrace.h create mode 100644 tools/include/linux/gfp.h create mode 100644 tools/include/linux/hardirq.h create mode 100644 tools/include/linux/hash.h create mode 100644 tools/include/linux/hashtable.h create mode 100644 tools/include/linux/interrupt.h create mode 100644 tools/include/linux/irqflags.h create mode 100644 tools/include/linux/jhash.h create mode 100644 tools/include/linux/kallsyms.h create mode 100644 tools/include/linux/kern_levels.h create mode 100644 tools/include/linux/kernel.h create mode 100644 tools/include/linux/linkage.h create mode 100644 tools/include/linux/list.h create mode 100644 tools/include/linux/lockdep.h create mode 100644 tools/include/linux/log2.h create mode 100644 tools/include/linux/module.h create mode 100644 tools/include/linux/mutex.h create mode 100644 tools/include/linux/nmi.h create mode 100644 tools/include/linux/overflow.h create mode 100644 tools/include/linux/poison.h create mode 100644 tools/include/linux/proc_fs.h create mode 100644 tools/include/linux/rbtree.h create mode 100644 tools/include/linux/rbtree_augmented.h create mode 100644 tools/include/linux/rcu.h create mode 100644 tools/include/linux/refcount.h create mode 100644 tools/include/linux/sched/clock.h create mode 100644 tools/include/linux/sched/mm.h create mode 100644 tools/include/linux/sched/task.h create mode 100644 tools/include/linux/seq_file.h create mode 100644 tools/include/linux/spinlock.h create mode 100644 tools/include/linux/stacktrace.h create mode 100644 tools/include/linux/string.h create mode 100644 tools/include/linux/stringify.h create mode 100644 tools/include/linux/time64.h create mode 100644 tools/include/linux/types.h create mode 100644 tools/include/linux/unaligned/packed_struct.h create mode 100644 tools/include/tools/be_byteshift.h create mode 100644 tools/include/tools/config.h create mode 100644 tools/include/tools/endian.h create mode 100644 tools/include/tools/le_byteshift.h create mode 100644 tools/include/tools/libc_compat.h create mode 100644 tools/include/trace/events/lock.h create mode 100644 tools/include/uapi/asm-generic/bitsperlong.h create mode 100644 tools/include/uapi/asm-generic/bpf_perf_event.h create mode 100644 tools/include/uapi/asm-generic/errno-base.h create mode 100644 tools/include/uapi/asm-generic/errno.h create mode 100644 tools/include/uapi/asm-generic/fcntl.h create mode 100644 tools/include/uapi/asm-generic/ioctls.h create mode 100644 tools/include/uapi/asm-generic/mman-common.h create mode 100644 tools/include/uapi/asm-generic/mman.h create mode 100644 tools/include/uapi/asm-generic/unistd.h create mode 100644 tools/include/uapi/asm/bitsperlong.h create mode 100644 tools/include/uapi/asm/bpf_perf_event.h create mode 100644 tools/include/uapi/asm/errno.h create mode 100644 tools/include/uapi/drm/drm.h create mode 100644 tools/include/uapi/drm/i915_drm.h create mode 100644 tools/include/uapi/linux/bpf.h create mode 100644 tools/include/uapi/linux/bpf_common.h create mode 100644 tools/include/uapi/linux/bpf_perf_event.h create mode 100644 tools/include/uapi/linux/btf.h create mode 100644 tools/include/uapi/linux/erspan.h create mode 100644 tools/include/uapi/linux/fcntl.h create mode 100644 tools/include/uapi/linux/hw_breakpoint.h create mode 100644 tools/include/uapi/linux/if_link.h create mode 100644 tools/include/uapi/linux/in.h create mode 100644 tools/include/uapi/linux/kcmp.h create mode 100644 tools/include/uapi/linux/kvm.h create mode 100644 tools/include/uapi/linux/lirc.h create mode 100644 tools/include/uapi/linux/mman.h create mode 100644 tools/include/uapi/linux/netlink.h create mode 100644 tools/include/uapi/linux/perf_event.h create mode 100644 tools/include/uapi/linux/prctl.h create mode 100644 tools/include/uapi/linux/sched.h create mode 100644 tools/include/uapi/linux/seg6.h create mode 100644 tools/include/uapi/linux/seg6_local.h create mode 100644 tools/include/uapi/linux/stat.h create mode 100644 tools/include/uapi/linux/vhost.h create mode 100644 tools/include/uapi/sound/asound.h create mode 100644 tools/kvm/kvm_stat/Makefile create mode 100755 tools/kvm/kvm_stat/kvm_stat create mode 100644 tools/kvm/kvm_stat/kvm_stat.txt create mode 100644 tools/laptop/dslm/.gitignore create mode 100644 tools/laptop/dslm/Makefile create mode 100644 tools/laptop/dslm/dslm.c create mode 100644 tools/laptop/freefall/Makefile create mode 100644 tools/laptop/freefall/freefall.c create mode 100644 tools/leds/.gitignore create mode 100644 tools/leds/Makefile create mode 100644 tools/leds/led_hw_brightness_mon.c create mode 100644 tools/leds/uledmon.c create mode 100644 tools/lib/api/Build create mode 100644 tools/lib/api/Makefile create mode 100644 tools/lib/api/cpu.c create mode 100644 tools/lib/api/cpu.h create mode 100644 tools/lib/api/debug-internal.h create mode 100644 tools/lib/api/debug.c create mode 100644 tools/lib/api/debug.h create mode 100644 tools/lib/api/fd/Build create mode 100644 tools/lib/api/fd/array.c create mode 100644 tools/lib/api/fd/array.h create mode 100644 tools/lib/api/fs/Build create mode 100644 tools/lib/api/fs/fs.c create mode 100644 tools/lib/api/fs/fs.h create mode 100644 tools/lib/api/fs/tracing_path.c create mode 100644 tools/lib/api/fs/tracing_path.h create mode 100644 tools/lib/bitmap.c create mode 100644 tools/lib/bpf/.gitignore create mode 100644 tools/lib/bpf/Build create mode 100644 tools/lib/bpf/Makefile create mode 100644 tools/lib/bpf/bpf.c create mode 100644 tools/lib/bpf/bpf.h create mode 100644 tools/lib/bpf/btf.c create mode 100644 tools/lib/bpf/btf.h create mode 100644 tools/lib/bpf/libbpf.c create mode 100644 tools/lib/bpf/libbpf.h create mode 100644 tools/lib/bpf/libbpf_errno.c create mode 100644 tools/lib/bpf/nlattr.c create mode 100644 tools/lib/bpf/nlattr.h create mode 100644 tools/lib/bpf/str_error.c create mode 100644 tools/lib/bpf/str_error.h create mode 100644 tools/lib/find_bit.c create mode 100644 tools/lib/hweight.c create mode 100644 tools/lib/lockdep/.gitignore create mode 100644 tools/lib/lockdep/Build create mode 100644 tools/lib/lockdep/Makefile create mode 100644 tools/lib/lockdep/common.c create mode 100644 tools/lib/lockdep/include/liblockdep/common.h create mode 100644 tools/lib/lockdep/include/liblockdep/mutex.h create mode 100644 tools/lib/lockdep/include/liblockdep/rwlock.h create mode 100755 tools/lib/lockdep/lockdep create mode 100644 tools/lib/lockdep/lockdep.c create mode 100644 tools/lib/lockdep/lockdep_internals.h create mode 100644 tools/lib/lockdep/lockdep_states.h create mode 100644 tools/lib/lockdep/preload.c create mode 100644 tools/lib/lockdep/rbtree.c create mode 100755 tools/lib/lockdep/run_tests.sh create mode 100644 tools/lib/lockdep/tests/AA.c create mode 100644 tools/lib/lockdep/tests/ABA.c create mode 100644 tools/lib/lockdep/tests/ABBA.c create mode 100644 tools/lib/lockdep/tests/ABBA_2threads.c create mode 100644 tools/lib/lockdep/tests/ABBCCA.c create mode 100644 tools/lib/lockdep/tests/ABBCCDDA.c create mode 100644 tools/lib/lockdep/tests/ABCABC.c create mode 100644 tools/lib/lockdep/tests/ABCDBCDA.c create mode 100644 tools/lib/lockdep/tests/ABCDBDDA.c create mode 100644 tools/lib/lockdep/tests/WW.c create mode 100644 tools/lib/lockdep/tests/common.h create mode 100644 tools/lib/lockdep/tests/unlock_balance.c create mode 100644 tools/lib/rbtree.c create mode 100644 tools/lib/str_error_r.c create mode 100644 tools/lib/string.c create mode 100644 tools/lib/subcmd/Build create mode 100644 tools/lib/subcmd/Makefile create mode 100644 tools/lib/subcmd/exec-cmd.c create mode 100644 tools/lib/subcmd/exec-cmd.h create mode 100644 tools/lib/subcmd/help.c create mode 100644 tools/lib/subcmd/help.h create mode 100644 tools/lib/subcmd/pager.c create mode 100644 tools/lib/subcmd/pager.h create mode 100644 tools/lib/subcmd/parse-options.c create mode 100644 tools/lib/subcmd/parse-options.h create mode 100644 tools/lib/subcmd/run-command.c create mode 100644 tools/lib/subcmd/run-command.h create mode 100644 tools/lib/subcmd/sigchain.c create mode 100644 tools/lib/subcmd/sigchain.h create mode 100644 tools/lib/subcmd/subcmd-config.c create mode 100644 tools/lib/subcmd/subcmd-config.h create mode 100644 tools/lib/subcmd/subcmd-util.h create mode 100644 tools/lib/symbol/kallsyms.c create mode 100644 tools/lib/symbol/kallsyms.h create mode 100644 tools/lib/traceevent/.gitignore create mode 100644 tools/lib/traceevent/Build create mode 100644 tools/lib/traceevent/Makefile create mode 100644 tools/lib/traceevent/event-parse.c create mode 100644 tools/lib/traceevent/event-parse.h create mode 100644 tools/lib/traceevent/event-plugin.c create mode 100644 tools/lib/traceevent/event-utils.h create mode 100644 tools/lib/traceevent/kbuffer-parse.c create mode 100644 tools/lib/traceevent/kbuffer.h create mode 100644 tools/lib/traceevent/parse-filter.c create mode 100644 tools/lib/traceevent/parse-utils.c create mode 100644 tools/lib/traceevent/plugin_cfg80211.c create mode 100644 tools/lib/traceevent/plugin_function.c create mode 100644 tools/lib/traceevent/plugin_hrtimer.c create mode 100644 tools/lib/traceevent/plugin_jbd2.c create mode 100644 tools/lib/traceevent/plugin_kmem.c create mode 100644 tools/lib/traceevent/plugin_kvm.c create mode 100644 tools/lib/traceevent/plugin_mac80211.c create mode 100644 tools/lib/traceevent/plugin_sched_switch.c create mode 100644 tools/lib/traceevent/plugin_scsi.c create mode 100644 tools/lib/traceevent/plugin_xen.c create mode 100644 tools/lib/traceevent/trace-seq.c create mode 100644 tools/lib/vsprintf.c create mode 100644 tools/memory-model/Documentation/cheatsheet.txt create mode 100644 tools/memory-model/Documentation/explanation.txt create mode 100644 tools/memory-model/Documentation/recipes.txt create mode 100644 tools/memory-model/Documentation/references.txt create mode 100644 tools/memory-model/README create mode 100644 tools/memory-model/linux-kernel.bell create mode 100644 tools/memory-model/linux-kernel.cat create mode 100644 tools/memory-model/linux-kernel.cfg create mode 100644 tools/memory-model/linux-kernel.def create mode 100644 tools/memory-model/litmus-tests/.gitignore create mode 100644 tools/memory-model/litmus-tests/CoRR+poonceonce+Once.litmus create mode 100644 tools/memory-model/litmus-tests/CoRW+poonceonce+Once.litmus create mode 100644 tools/memory-model/litmus-tests/CoWR+poonceonce+Once.litmus create mode 100644 tools/memory-model/litmus-tests/CoWW+poonceonce.litmus create mode 100644 tools/memory-model/litmus-tests/IRIW+fencembonceonces+OnceOnce.litmus create mode 100644 tools/memory-model/litmus-tests/IRIW+poonceonces+OnceOnce.litmus create mode 100644 tools/memory-model/litmus-tests/ISA2+pooncelock+pooncelock+pombonce.litmus create mode 100644 tools/memory-model/litmus-tests/ISA2+poonceonces.litmus create mode 100644 tools/memory-model/litmus-tests/ISA2+pooncerelease+poacquirerelease+poacquireonce.litmus create mode 100644 tools/memory-model/litmus-tests/LB+fencembonceonce+ctrlonceonce.litmus create mode 100644 tools/memory-model/litmus-tests/LB+poacquireonce+pooncerelease.litmus create mode 100644 tools/memory-model/litmus-tests/LB+poonceonces.litmus create mode 100644 tools/memory-model/litmus-tests/MP+fencewmbonceonce+fencermbonceonce.litmus create mode 100644 tools/memory-model/litmus-tests/MP+onceassign+derefonce.litmus create mode 100644 tools/memory-model/litmus-tests/MP+polockmbonce+poacquiresilsil.litmus create mode 100644 tools/memory-model/litmus-tests/MP+polockonce+poacquiresilsil.litmus create mode 100644 tools/memory-model/litmus-tests/MP+polocks.litmus create mode 100644 tools/memory-model/litmus-tests/MP+poonceonces.litmus create mode 100644 tools/memory-model/litmus-tests/MP+pooncerelease+poacquireonce.litmus create mode 100644 tools/memory-model/litmus-tests/MP+porevlocks.litmus create mode 100644 tools/memory-model/litmus-tests/R+fencembonceonces.litmus create mode 100644 tools/memory-model/litmus-tests/R+poonceonces.litmus create mode 100644 tools/memory-model/litmus-tests/README create mode 100644 tools/memory-model/litmus-tests/S+fencewmbonceonce+poacquireonce.litmus create mode 100644 tools/memory-model/litmus-tests/S+poonceonces.litmus create mode 100644 tools/memory-model/litmus-tests/SB+fencembonceonces.litmus create mode 100644 tools/memory-model/litmus-tests/SB+poonceonces.litmus create mode 100644 tools/memory-model/litmus-tests/SB+rfionceonce-poonceonces.litmus create mode 100644 tools/memory-model/litmus-tests/WRC+poonceonces+Once.litmus create mode 100644 tools/memory-model/litmus-tests/WRC+pooncerelease+fencermbonceonce+Once.litmus create mode 100644 tools/memory-model/litmus-tests/Z6.0+pooncelock+poonceLock+pombonce.litmus create mode 100644 tools/memory-model/litmus-tests/Z6.0+pooncelock+pooncelock+pombonce.litmus create mode 100644 tools/memory-model/litmus-tests/Z6.0+pooncerelease+poacquirerelease+fencembonceonce.litmus create mode 100644 tools/memory-model/lock.cat create mode 100755 tools/memory-model/scripts/checkalllitmus.sh create mode 100755 tools/memory-model/scripts/checklitmus.sh create mode 100755 tools/nfsd/inject_fault.sh create mode 100644 tools/objtool/.gitignore create mode 100644 tools/objtool/Build create mode 100644 tools/objtool/Documentation/stack-validation.txt create mode 100644 tools/objtool/Makefile create mode 100644 tools/objtool/arch.h create mode 100644 tools/objtool/arch/x86/Build create mode 100644 tools/objtool/arch/x86/decode.c create mode 100644 tools/objtool/arch/x86/include/asm/inat.h create mode 100644 tools/objtool/arch/x86/include/asm/inat_types.h create mode 100644 tools/objtool/arch/x86/include/asm/insn.h create mode 100644 tools/objtool/arch/x86/include/asm/orc_types.h create mode 100644 tools/objtool/arch/x86/lib/inat.c create mode 100644 tools/objtool/arch/x86/lib/insn.c create mode 100644 tools/objtool/arch/x86/lib/x86-opcode-map.txt create mode 100644 tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk create mode 100644 tools/objtool/builtin-check.c create mode 100644 tools/objtool/builtin-orc.c create mode 100644 tools/objtool/builtin.h create mode 100644 tools/objtool/cfi.h create mode 100644 tools/objtool/check.c create mode 100644 tools/objtool/check.h create mode 100644 tools/objtool/elf.c create mode 100644 tools/objtool/elf.h create mode 100644 tools/objtool/objtool.c create mode 100644 tools/objtool/orc.h create mode 100644 tools/objtool/orc_dump.c create mode 100644 tools/objtool/orc_gen.c create mode 100644 tools/objtool/special.c create mode 100644 tools/objtool/special.h create mode 100755 tools/objtool/sync-check.sh create mode 100644 tools/objtool/warn.h create mode 100644 tools/pci/pcitest.c create mode 100644 tools/pci/pcitest.sh create mode 100644 tools/pcmcia/.gitignore create mode 100644 tools/pcmcia/Makefile create mode 100644 tools/pcmcia/crc32hash.c create mode 100644 tools/perf/.gitignore create mode 100644 tools/perf/Build create mode 100644 tools/perf/CREDITS create mode 100644 tools/perf/Documentation/Build.txt create mode 100644 tools/perf/Documentation/Makefile create mode 100644 tools/perf/Documentation/android.txt create mode 100644 tools/perf/Documentation/asciidoc.conf create mode 100644 tools/perf/Documentation/asciidoctor-extensions.rb create mode 100644 tools/perf/Documentation/callchain-overhead-calculation.txt create mode 100644 tools/perf/Documentation/examples.txt create mode 100644 tools/perf/Documentation/intel-bts.txt create mode 100644 tools/perf/Documentation/intel-pt.txt create mode 100644 tools/perf/Documentation/itrace.txt create mode 100644 tools/perf/Documentation/jit-interface.txt create mode 100644 tools/perf/Documentation/jitdump-specification.txt create mode 100644 tools/perf/Documentation/manpage-1.72.xsl create mode 100644 tools/perf/Documentation/manpage-base.xsl create mode 100644 tools/perf/Documentation/manpage-bold-literal.xsl create mode 100644 tools/perf/Documentation/manpage-normal.xsl create mode 100644 tools/perf/Documentation/manpage-suppress-sp.xsl create mode 100644 tools/perf/Documentation/perf-annotate.txt create mode 100644 tools/perf/Documentation/perf-archive.txt create mode 100644 tools/perf/Documentation/perf-bench.txt create mode 100644 tools/perf/Documentation/perf-buildid-cache.txt create mode 100644 tools/perf/Documentation/perf-buildid-list.txt create mode 100644 tools/perf/Documentation/perf-c2c.txt create mode 100644 tools/perf/Documentation/perf-config.txt create mode 100644 tools/perf/Documentation/perf-data.txt create mode 100644 tools/perf/Documentation/perf-diff.txt create mode 100644 tools/perf/Documentation/perf-evlist.txt create mode 100644 tools/perf/Documentation/perf-ftrace.txt create mode 100644 tools/perf/Documentation/perf-help.txt create mode 100644 tools/perf/Documentation/perf-inject.txt create mode 100644 tools/perf/Documentation/perf-kallsyms.txt create mode 100644 tools/perf/Documentation/perf-kmem.txt create mode 100644 tools/perf/Documentation/perf-kvm.txt create mode 100644 tools/perf/Documentation/perf-list.txt create mode 100644 tools/perf/Documentation/perf-lock.txt create mode 100644 tools/perf/Documentation/perf-mem.txt create mode 100644 tools/perf/Documentation/perf-probe.txt create mode 100644 tools/perf/Documentation/perf-record.txt create mode 100644 tools/perf/Documentation/perf-report.txt create mode 100644 tools/perf/Documentation/perf-sched.txt create mode 100644 tools/perf/Documentation/perf-script-perl.txt create mode 100644 tools/perf/Documentation/perf-script-python.txt create mode 100644 tools/perf/Documentation/perf-script.txt create mode 100644 tools/perf/Documentation/perf-stat.txt create mode 100644 tools/perf/Documentation/perf-test.txt create mode 100644 tools/perf/Documentation/perf-timechart.txt create mode 100644 tools/perf/Documentation/perf-top.txt create mode 100644 tools/perf/Documentation/perf-trace.txt create mode 100644 tools/perf/Documentation/perf-version.txt create mode 100644 tools/perf/Documentation/perf.data-file-format.txt create mode 100644 tools/perf/Documentation/perf.txt create mode 100644 tools/perf/Documentation/perfconfig.example create mode 100644 tools/perf/Documentation/tips.txt create mode 100644 tools/perf/MANIFEST create mode 100644 tools/perf/Makefile create mode 100644 tools/perf/Makefile.config create mode 100644 tools/perf/Makefile.perf create mode 100644 tools/perf/arch/Build create mode 100644 tools/perf/arch/alpha/Build create mode 100644 tools/perf/arch/arm/Build create mode 100644 tools/perf/arch/arm/Makefile create mode 100644 tools/perf/arch/arm/annotate/instructions.c create mode 100644 tools/perf/arch/arm/include/arch-tests.h create mode 100644 tools/perf/arch/arm/include/dwarf-regs-table.h create mode 100644 tools/perf/arch/arm/include/perf_regs.h create mode 100644 tools/perf/arch/arm/tests/Build create mode 100644 tools/perf/arch/arm/tests/arch-tests.c create mode 100644 tools/perf/arch/arm/tests/dwarf-unwind.c create mode 100644 tools/perf/arch/arm/tests/regs_load.S create mode 100644 tools/perf/arch/arm/util/Build create mode 100644 tools/perf/arch/arm/util/auxtrace.c create mode 100644 tools/perf/arch/arm/util/cs-etm.c create mode 100644 tools/perf/arch/arm/util/cs-etm.h create mode 100644 tools/perf/arch/arm/util/dwarf-regs.c create mode 100644 tools/perf/arch/arm/util/pmu.c create mode 100644 tools/perf/arch/arm/util/unwind-libdw.c create mode 100644 tools/perf/arch/arm/util/unwind-libunwind.c create mode 100644 tools/perf/arch/arm64/Build create mode 100644 tools/perf/arch/arm64/Makefile create mode 100644 tools/perf/arch/arm64/annotate/instructions.c create mode 100755 tools/perf/arch/arm64/entry/syscalls/mksyscalltbl create mode 100644 tools/perf/arch/arm64/include/arch-tests.h create mode 100644 tools/perf/arch/arm64/include/dwarf-regs-table.h create mode 100644 tools/perf/arch/arm64/include/perf_regs.h create mode 100644 tools/perf/arch/arm64/tests/Build create mode 100644 tools/perf/arch/arm64/tests/arch-tests.c create mode 100644 tools/perf/arch/arm64/tests/dwarf-unwind.c create mode 100644 tools/perf/arch/arm64/tests/regs_load.S create mode 100644 tools/perf/arch/arm64/util/Build create mode 100644 tools/perf/arch/arm64/util/arm-spe.c create mode 100644 tools/perf/arch/arm64/util/dwarf-regs.c create mode 100644 tools/perf/arch/arm64/util/header.c create mode 100644 tools/perf/arch/arm64/util/sym-handling.c create mode 100644 tools/perf/arch/arm64/util/unwind-libdw.c create mode 100644 tools/perf/arch/arm64/util/unwind-libunwind.c create mode 100644 tools/perf/arch/common.c create mode 100644 tools/perf/arch/common.h create mode 100644 tools/perf/arch/mips/Build create mode 100644 tools/perf/arch/parisc/Build create mode 100644 tools/perf/arch/powerpc/Build create mode 100644 tools/perf/arch/powerpc/Makefile create mode 100644 tools/perf/arch/powerpc/annotate/instructions.c create mode 100755 tools/perf/arch/powerpc/entry/syscalls/mksyscalltbl create mode 100644 tools/perf/arch/powerpc/include/arch-tests.h create mode 100644 tools/perf/arch/powerpc/include/dwarf-regs-table.h create mode 100644 tools/perf/arch/powerpc/include/perf_regs.h create mode 100644 tools/perf/arch/powerpc/tests/Build create mode 100644 tools/perf/arch/powerpc/tests/arch-tests.c create mode 100644 tools/perf/arch/powerpc/tests/dwarf-unwind.c create mode 100644 tools/perf/arch/powerpc/tests/regs_load.S create mode 100644 tools/perf/arch/powerpc/util/Build create mode 100644 tools/perf/arch/powerpc/util/book3s_hcalls.h create mode 100644 tools/perf/arch/powerpc/util/book3s_hv_exits.h create mode 100644 tools/perf/arch/powerpc/util/dwarf-regs.c create mode 100644 tools/perf/arch/powerpc/util/header.c create mode 100644 tools/perf/arch/powerpc/util/kvm-stat.c create mode 100644 tools/perf/arch/powerpc/util/perf_regs.c create mode 100644 tools/perf/arch/powerpc/util/skip-callchain-idx.c create mode 100644 tools/perf/arch/powerpc/util/sym-handling.c create mode 100644 tools/perf/arch/powerpc/util/unwind-libdw.c create mode 100644 tools/perf/arch/powerpc/util/unwind-libunwind.c create mode 100644 tools/perf/arch/s390/Build create mode 100644 tools/perf/arch/s390/Makefile create mode 100644 tools/perf/arch/s390/annotate/instructions.c create mode 100755 tools/perf/arch/s390/entry/syscalls/mksyscalltbl create mode 100644 tools/perf/arch/s390/entry/syscalls/syscall.tbl create mode 100644 tools/perf/arch/s390/include/dwarf-regs-table.h create mode 100644 tools/perf/arch/s390/include/perf_regs.h create mode 100644 tools/perf/arch/s390/util/Build create mode 100644 tools/perf/arch/s390/util/auxtrace.c create mode 100644 tools/perf/arch/s390/util/dwarf-regs.c create mode 100644 tools/perf/arch/s390/util/header.c create mode 100644 tools/perf/arch/s390/util/kvm-stat.c create mode 100644 tools/perf/arch/s390/util/machine.c create mode 100644 tools/perf/arch/s390/util/unwind-libdw.c create mode 100644 tools/perf/arch/sh/Build create mode 100644 tools/perf/arch/sh/Makefile create mode 100644 tools/perf/arch/sh/include/dwarf-regs-table.h create mode 100644 tools/perf/arch/sh/util/Build create mode 100644 tools/perf/arch/sh/util/dwarf-regs.c create mode 100644 tools/perf/arch/sparc/Build create mode 100644 tools/perf/arch/sparc/Makefile create mode 100644 tools/perf/arch/sparc/include/dwarf-regs-table.h create mode 100644 tools/perf/arch/sparc/util/Build create mode 100644 tools/perf/arch/sparc/util/dwarf-regs.c create mode 100644 tools/perf/arch/x86/Build create mode 100644 tools/perf/arch/x86/Makefile create mode 100644 tools/perf/arch/x86/annotate/instructions.c create mode 100644 tools/perf/arch/x86/entry/syscalls/syscall_64.tbl create mode 100755 tools/perf/arch/x86/entry/syscalls/syscalltbl.sh create mode 100644 tools/perf/arch/x86/include/arch-tests.h create mode 100644 tools/perf/arch/x86/include/dwarf-regs-table.h create mode 100644 tools/perf/arch/x86/include/perf_regs.h create mode 100644 tools/perf/arch/x86/tests/Build create mode 100644 tools/perf/arch/x86/tests/arch-tests.c create mode 100644 tools/perf/arch/x86/tests/bp-modify.c create mode 100644 tools/perf/arch/x86/tests/dwarf-unwind.c create mode 100644 tools/perf/arch/x86/tests/gen-insn-x86-dat.awk create mode 100755 tools/perf/arch/x86/tests/gen-insn-x86-dat.sh create mode 100644 tools/perf/arch/x86/tests/insn-x86-dat-32.c create mode 100644 tools/perf/arch/x86/tests/insn-x86-dat-64.c create mode 100644 tools/perf/arch/x86/tests/insn-x86-dat-src.c create mode 100644 tools/perf/arch/x86/tests/insn-x86.c create mode 100644 tools/perf/arch/x86/tests/intel-cqm.c create mode 100644 tools/perf/arch/x86/tests/perf-time-to-tsc.c create mode 100644 tools/perf/arch/x86/tests/rdpmc.c create mode 100644 tools/perf/arch/x86/tests/regs_load.S create mode 100644 tools/perf/arch/x86/util/Build create mode 100644 tools/perf/arch/x86/util/auxtrace.c create mode 100644 tools/perf/arch/x86/util/dwarf-regs.c create mode 100644 tools/perf/arch/x86/util/event.c create mode 100644 tools/perf/arch/x86/util/group.c create mode 100644 tools/perf/arch/x86/util/header.c create mode 100644 tools/perf/arch/x86/util/intel-bts.c create mode 100644 tools/perf/arch/x86/util/intel-pt.c create mode 100644 tools/perf/arch/x86/util/kvm-stat.c create mode 100644 tools/perf/arch/x86/util/machine.c create mode 100644 tools/perf/arch/x86/util/perf_regs.c create mode 100644 tools/perf/arch/x86/util/pmu.c create mode 100644 tools/perf/arch/x86/util/tsc.c create mode 100644 tools/perf/arch/x86/util/unwind-libdw.c create mode 100644 tools/perf/arch/x86/util/unwind-libunwind.c create mode 100644 tools/perf/arch/xtensa/Build create mode 100644 tools/perf/arch/xtensa/Makefile create mode 100644 tools/perf/arch/xtensa/include/dwarf-regs-table.h create mode 100644 tools/perf/arch/xtensa/util/Build create mode 100644 tools/perf/arch/xtensa/util/dwarf-regs.c create mode 100644 tools/perf/bench/Build create mode 100644 tools/perf/bench/bench.h create mode 100644 tools/perf/bench/futex-hash.c create mode 100644 tools/perf/bench/futex-lock-pi.c create mode 100644 tools/perf/bench/futex-requeue.c create mode 100644 tools/perf/bench/futex-wake-parallel.c create mode 100644 tools/perf/bench/futex-wake.c create mode 100644 tools/perf/bench/futex.h create mode 100644 tools/perf/bench/mem-functions.c create mode 100644 tools/perf/bench/mem-memcpy-arch.h create mode 100644 tools/perf/bench/mem-memcpy-x86-64-asm-def.h create mode 100644 tools/perf/bench/mem-memcpy-x86-64-asm.S create mode 100644 tools/perf/bench/mem-memcpy-x86-64-lib.c create mode 100644 tools/perf/bench/mem-memset-arch.h create mode 100644 tools/perf/bench/mem-memset-x86-64-asm-def.h create mode 100644 tools/perf/bench/mem-memset-x86-64-asm.S create mode 100644 tools/perf/bench/numa.c create mode 100644 tools/perf/bench/sched-messaging.c create mode 100644 tools/perf/bench/sched-pipe.c create mode 100644 tools/perf/builtin-annotate.c create mode 100644 tools/perf/builtin-bench.c create mode 100644 tools/perf/builtin-buildid-cache.c create mode 100644 tools/perf/builtin-buildid-list.c create mode 100644 tools/perf/builtin-c2c.c create mode 100644 tools/perf/builtin-config.c create mode 100644 tools/perf/builtin-data.c create mode 100644 tools/perf/builtin-diff.c create mode 100644 tools/perf/builtin-evlist.c create mode 100644 tools/perf/builtin-ftrace.c create mode 100644 tools/perf/builtin-help.c create mode 100644 tools/perf/builtin-inject.c create mode 100644 tools/perf/builtin-kallsyms.c create mode 100644 tools/perf/builtin-kmem.c create mode 100644 tools/perf/builtin-kvm.c create mode 100644 tools/perf/builtin-list.c create mode 100644 tools/perf/builtin-lock.c create mode 100644 tools/perf/builtin-mem.c create mode 100644 tools/perf/builtin-probe.c create mode 100644 tools/perf/builtin-record.c create mode 100644 tools/perf/builtin-report.c create mode 100644 tools/perf/builtin-sched.c create mode 100644 tools/perf/builtin-script.c create mode 100644 tools/perf/builtin-stat.c create mode 100644 tools/perf/builtin-timechart.c create mode 100644 tools/perf/builtin-top.c create mode 100644 tools/perf/builtin-trace.c create mode 100644 tools/perf/builtin-version.c create mode 100644 tools/perf/builtin.h create mode 100755 tools/perf/check-headers.sh create mode 100644 tools/perf/command-list.txt create mode 100644 tools/perf/design.txt create mode 100644 tools/perf/examples/bpf/5sec.c create mode 100644 tools/perf/examples/bpf/augmented_syscalls.c create mode 100644 tools/perf/examples/bpf/empty.c create mode 100644 tools/perf/examples/bpf/hello.c create mode 100644 tools/perf/examples/bpf/sys_enter_openat.c create mode 100644 tools/perf/include/bpf/bpf.h create mode 100644 tools/perf/include/bpf/stdio.h create mode 100644 tools/perf/jvmti/Build create mode 100644 tools/perf/jvmti/jvmti_agent.c create mode 100644 tools/perf/jvmti/jvmti_agent.h create mode 100644 tools/perf/jvmti/libjvmti.c create mode 100644 tools/perf/perf-archive.sh create mode 100644 tools/perf/perf-completion.sh create mode 100644 tools/perf/perf-read-vdso.c create mode 100644 tools/perf/perf-sys.h create mode 100644 tools/perf/perf-with-kcore.sh create mode 100644 tools/perf/perf.c create mode 100644 tools/perf/perf.h create mode 100644 tools/perf/pmu-events/Build create mode 100644 tools/perf/pmu-events/README create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/core-imp-def.json create mode 100644 tools/perf/pmu-events/arch/arm64/arm/cortex-a53/branch.json create mode 100644 tools/perf/pmu-events/arch/arm64/arm/cortex-a53/bus.json create mode 100644 tools/perf/pmu-events/arch/arm64/arm/cortex-a53/cache.json create mode 100644 tools/perf/pmu-events/arch/arm64/arm/cortex-a53/memory.json create mode 100644 tools/perf/pmu-events/arch/arm64/arm/cortex-a53/other.json create mode 100644 tools/perf/pmu-events/arch/arm64/arm/cortex-a53/pipeline.json create mode 100644 tools/perf/pmu-events/arch/arm64/armv8-recommended.json create mode 100644 tools/perf/pmu-events/arch/arm64/cavium/thunderx2/core-imp-def.json create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/core-imp-def.json create mode 100644 tools/perf/pmu-events/arch/arm64/mapfile.csv create mode 100644 tools/perf/pmu-events/arch/powerpc/mapfile.csv create mode 100644 tools/perf/pmu-events/arch/powerpc/power8/cache.json create mode 100644 tools/perf/pmu-events/arch/powerpc/power8/floating-point.json create mode 100644 tools/perf/pmu-events/arch/powerpc/power8/frontend.json create mode 100644 tools/perf/pmu-events/arch/powerpc/power8/marked.json create mode 100644 tools/perf/pmu-events/arch/powerpc/power8/memory.json create mode 100644 tools/perf/pmu-events/arch/powerpc/power8/other.json create mode 100644 tools/perf/pmu-events/arch/powerpc/power8/pipeline.json create mode 100644 tools/perf/pmu-events/arch/powerpc/power8/pmc.json create mode 100644 tools/perf/pmu-events/arch/powerpc/power8/translation.json create mode 100644 tools/perf/pmu-events/arch/powerpc/power9/cache.json create mode 100644 tools/perf/pmu-events/arch/powerpc/power9/floating-point.json create mode 100644 tools/perf/pmu-events/arch/powerpc/power9/frontend.json create mode 100644 tools/perf/pmu-events/arch/powerpc/power9/marked.json create mode 100644 tools/perf/pmu-events/arch/powerpc/power9/memory.json create mode 100644 tools/perf/pmu-events/arch/powerpc/power9/other.json create mode 100644 tools/perf/pmu-events/arch/powerpc/power9/pipeline.json create mode 100644 tools/perf/pmu-events/arch/powerpc/power9/pmc.json create mode 100644 tools/perf/pmu-events/arch/powerpc/power9/translation.json create mode 100644 tools/perf/pmu-events/arch/s390/cf_z10/basic.json create mode 100644 tools/perf/pmu-events/arch/s390/cf_z10/crypto.json create mode 100644 tools/perf/pmu-events/arch/s390/cf_z10/extended.json create mode 100644 tools/perf/pmu-events/arch/s390/cf_z13/basic.json create mode 100644 tools/perf/pmu-events/arch/s390/cf_z13/crypto.json create mode 100644 tools/perf/pmu-events/arch/s390/cf_z13/extended.json create mode 100644 tools/perf/pmu-events/arch/s390/cf_z13/transaction.json create mode 100644 tools/perf/pmu-events/arch/s390/cf_z14/basic.json create mode 100644 tools/perf/pmu-events/arch/s390/cf_z14/crypto.json create mode 100644 tools/perf/pmu-events/arch/s390/cf_z14/extended.json create mode 100644 tools/perf/pmu-events/arch/s390/cf_z14/transaction.json create mode 100644 tools/perf/pmu-events/arch/s390/cf_z196/basic.json create mode 100644 tools/perf/pmu-events/arch/s390/cf_z196/crypto.json create mode 100644 tools/perf/pmu-events/arch/s390/cf_z196/extended.json create mode 100644 tools/perf/pmu-events/arch/s390/cf_zec12/basic.json create mode 100644 tools/perf/pmu-events/arch/s390/cf_zec12/crypto.json create mode 100644 tools/perf/pmu-events/arch/s390/cf_zec12/extended.json create mode 100644 tools/perf/pmu-events/arch/s390/cf_zec12/transaction.json create mode 100644 tools/perf/pmu-events/arch/s390/mapfile.csv create mode 100644 tools/perf/pmu-events/arch/x86/bonnell/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/bonnell/floating-point.json create mode 100644 tools/perf/pmu-events/arch/x86/bonnell/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/bonnell/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/bonnell/other.json create mode 100644 tools/perf/pmu-events/arch/x86/bonnell/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/bonnell/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwell/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwell/floating-point.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwell/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwell/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwell/other.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwell/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwell/uncore.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwell/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellde/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellde/floating-point.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellde/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellde/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellde/other.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellde/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellde/uncore-cache.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellde/uncore-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellde/uncore-power.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellde/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellx/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellx/floating-point.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellx/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellx/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellx/other.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellx/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellx/uncore-cache.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellx/uncore-interconnect.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellx/uncore-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellx/uncore-power.json create mode 100644 tools/perf/pmu-events/arch/x86/broadwellx/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/goldmont/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/goldmont/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/goldmont/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/goldmont/other.json create mode 100644 tools/perf/pmu-events/arch/x86/goldmont/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/goldmont/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/goldmontplus/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/goldmontplus/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/goldmontplus/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/goldmontplus/other.json create mode 100644 tools/perf/pmu-events/arch/x86/goldmontplus/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/goldmontplus/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/haswell/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/haswell/floating-point.json create mode 100644 tools/perf/pmu-events/arch/x86/haswell/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json create mode 100644 tools/perf/pmu-events/arch/x86/haswell/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/haswell/other.json create mode 100644 tools/perf/pmu-events/arch/x86/haswell/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/haswell/uncore.json create mode 100644 tools/perf/pmu-events/arch/x86/haswell/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/haswellx/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/haswellx/floating-point.json create mode 100644 tools/perf/pmu-events/arch/x86/haswellx/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json create mode 100644 tools/perf/pmu-events/arch/x86/haswellx/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/haswellx/other.json create mode 100644 tools/perf/pmu-events/arch/x86/haswellx/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/haswellx/uncore-cache.json create mode 100644 tools/perf/pmu-events/arch/x86/haswellx/uncore-interconnect.json create mode 100644 tools/perf/pmu-events/arch/x86/haswellx/uncore-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/haswellx/uncore-power.json create mode 100644 tools/perf/pmu-events/arch/x86/haswellx/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/ivybridge/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/ivybridge/floating-point.json create mode 100644 tools/perf/pmu-events/arch/x86/ivybridge/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json create mode 100644 tools/perf/pmu-events/arch/x86/ivybridge/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/ivybridge/other.json create mode 100644 tools/perf/pmu-events/arch/x86/ivybridge/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/ivybridge/uncore.json create mode 100644 tools/perf/pmu-events/arch/x86/ivybridge/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/ivytown/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/ivytown/floating-point.json create mode 100644 tools/perf/pmu-events/arch/x86/ivytown/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json create mode 100644 tools/perf/pmu-events/arch/x86/ivytown/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/ivytown/other.json create mode 100644 tools/perf/pmu-events/arch/x86/ivytown/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/ivytown/uncore-cache.json create mode 100644 tools/perf/pmu-events/arch/x86/ivytown/uncore-interconnect.json create mode 100644 tools/perf/pmu-events/arch/x86/ivytown/uncore-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/ivytown/uncore-power.json create mode 100644 tools/perf/pmu-events/arch/x86/ivytown/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/jaketown/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/jaketown/floating-point.json create mode 100644 tools/perf/pmu-events/arch/x86/jaketown/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json create mode 100644 tools/perf/pmu-events/arch/x86/jaketown/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/jaketown/other.json create mode 100644 tools/perf/pmu-events/arch/x86/jaketown/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/jaketown/uncore-cache.json create mode 100644 tools/perf/pmu-events/arch/x86/jaketown/uncore-interconnect.json create mode 100644 tools/perf/pmu-events/arch/x86/jaketown/uncore-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/jaketown/uncore-power.json create mode 100644 tools/perf/pmu-events/arch/x86/jaketown/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/knightslanding/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/knightslanding/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/knightslanding/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/knightslanding/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/knightslanding/uncore-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/knightslanding/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/mapfile.csv create mode 100644 tools/perf/pmu-events/arch/x86/nehalemep/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/nehalemep/floating-point.json create mode 100644 tools/perf/pmu-events/arch/x86/nehalemep/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/nehalemep/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/nehalemep/other.json create mode 100644 tools/perf/pmu-events/arch/x86/nehalemep/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/nehalemep/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/nehalemex/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/nehalemex/floating-point.json create mode 100644 tools/perf/pmu-events/arch/x86/nehalemex/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/nehalemex/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/nehalemex/other.json create mode 100644 tools/perf/pmu-events/arch/x86/nehalemex/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/nehalemex/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/sandybridge/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/sandybridge/floating-point.json create mode 100644 tools/perf/pmu-events/arch/x86/sandybridge/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/sandybridge/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/sandybridge/other.json create mode 100644 tools/perf/pmu-events/arch/x86/sandybridge/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json create mode 100644 tools/perf/pmu-events/arch/x86/sandybridge/uncore.json create mode 100644 tools/perf/pmu-events/arch/x86/sandybridge/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/silvermont/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/silvermont/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/silvermont/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/silvermont/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/silvermont/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/skylake/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/skylake/floating-point.json create mode 100644 tools/perf/pmu-events/arch/x86/skylake/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/skylake/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/skylake/other.json create mode 100644 tools/perf/pmu-events/arch/x86/skylake/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json create mode 100644 tools/perf/pmu-events/arch/x86/skylake/uncore.json create mode 100644 tools/perf/pmu-events/arch/x86/skylake/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/skylakex/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/skylakex/floating-point.json create mode 100644 tools/perf/pmu-events/arch/x86/skylakex/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/skylakex/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/skylakex/other.json create mode 100644 tools/perf/pmu-events/arch/x86/skylakex/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json create mode 100644 tools/perf/pmu-events/arch/x86/skylakex/uncore-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/skylakex/uncore-other.json create mode 100644 tools/perf/pmu-events/arch/x86/skylakex/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereep-dp/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereep-dp/floating-point.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereep-dp/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereep-dp/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereep-dp/other.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereep-dp/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereep-dp/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereep-sp/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereep-sp/floating-point.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereep-sp/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereep-sp/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereep-sp/other.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereep-sp/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereep-sp/virtual-memory.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereex/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereex/floating-point.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereex/frontend.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereex/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereex/other.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereex/pipeline.json create mode 100644 tools/perf/pmu-events/arch/x86/westmereex/virtual-memory.json create mode 100644 tools/perf/pmu-events/jevents.c create mode 100644 tools/perf/pmu-events/jevents.h create mode 100644 tools/perf/pmu-events/jsmn.c create mode 100644 tools/perf/pmu-events/jsmn.h create mode 100644 tools/perf/pmu-events/json.c create mode 100644 tools/perf/pmu-events/json.h create mode 100644 tools/perf/pmu-events/pmu-events.h create mode 100755 tools/perf/python/tracepoint.py create mode 100755 tools/perf/python/twatch.py create mode 100644 tools/perf/scripts/Build create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/Build create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/Context.c create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/Context.xs create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/Makefile.PL create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/README create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Context.pm create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Core.pm create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/Util.pm create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/typemap create mode 100644 tools/perf/scripts/perl/bin/check-perf-trace-record create mode 100644 tools/perf/scripts/perl/bin/failed-syscalls-record create mode 100644 tools/perf/scripts/perl/bin/failed-syscalls-report create mode 100644 tools/perf/scripts/perl/bin/rw-by-file-record create mode 100644 tools/perf/scripts/perl/bin/rw-by-file-report create mode 100644 tools/perf/scripts/perl/bin/rw-by-pid-record create mode 100644 tools/perf/scripts/perl/bin/rw-by-pid-report create mode 100644 tools/perf/scripts/perl/bin/rwtop-record create mode 100644 tools/perf/scripts/perl/bin/rwtop-report create mode 100644 tools/perf/scripts/perl/bin/wakeup-latency-record create mode 100644 tools/perf/scripts/perl/bin/wakeup-latency-report create mode 100644 tools/perf/scripts/perl/check-perf-trace.pl create mode 100644 tools/perf/scripts/perl/failed-syscalls.pl create mode 100644 tools/perf/scripts/perl/rw-by-file.pl create mode 100644 tools/perf/scripts/perl/rw-by-pid.pl create mode 100644 tools/perf/scripts/perl/rwtop.pl create mode 100644 tools/perf/scripts/perl/wakeup-latency.pl create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/Build create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/Context.c create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py create mode 100755 tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/EventClass.py create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/SchedGui.py create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py create mode 100644 tools/perf/scripts/python/bin/compaction-times-record create mode 100644 tools/perf/scripts/python/bin/compaction-times-report create mode 100644 tools/perf/scripts/python/bin/event_analyzing_sample-record create mode 100644 tools/perf/scripts/python/bin/event_analyzing_sample-report create mode 100644 tools/perf/scripts/python/bin/export-to-postgresql-record create mode 100644 tools/perf/scripts/python/bin/export-to-postgresql-report create mode 100644 tools/perf/scripts/python/bin/export-to-sqlite-record create mode 100644 tools/perf/scripts/python/bin/export-to-sqlite-report create mode 100644 tools/perf/scripts/python/bin/failed-syscalls-by-pid-record create mode 100644 tools/perf/scripts/python/bin/failed-syscalls-by-pid-report create mode 100644 tools/perf/scripts/python/bin/futex-contention-record create mode 100644 tools/perf/scripts/python/bin/futex-contention-report create mode 100644 tools/perf/scripts/python/bin/intel-pt-events-record create mode 100644 tools/perf/scripts/python/bin/intel-pt-events-report create mode 100644 tools/perf/scripts/python/bin/mem-phys-addr-record create mode 100644 tools/perf/scripts/python/bin/mem-phys-addr-report create mode 100755 tools/perf/scripts/python/bin/net_dropmonitor-record create mode 100755 tools/perf/scripts/python/bin/net_dropmonitor-report create mode 100644 tools/perf/scripts/python/bin/netdev-times-record create mode 100644 tools/perf/scripts/python/bin/netdev-times-report create mode 100644 tools/perf/scripts/python/bin/powerpc-hcalls-record create mode 100644 tools/perf/scripts/python/bin/powerpc-hcalls-report create mode 100644 tools/perf/scripts/python/bin/sched-migration-record create mode 100644 tools/perf/scripts/python/bin/sched-migration-report create mode 100644 tools/perf/scripts/python/bin/sctop-record create mode 100644 tools/perf/scripts/python/bin/sctop-report create mode 100755 tools/perf/scripts/python/bin/stackcollapse-record create mode 100755 tools/perf/scripts/python/bin/stackcollapse-report create mode 100644 tools/perf/scripts/python/bin/syscall-counts-by-pid-record create mode 100644 tools/perf/scripts/python/bin/syscall-counts-by-pid-report create mode 100644 tools/perf/scripts/python/bin/syscall-counts-record create mode 100644 tools/perf/scripts/python/bin/syscall-counts-report create mode 100644 tools/perf/scripts/python/call-graph-from-sql.py create mode 100644 tools/perf/scripts/python/check-perf-trace.py create mode 100644 tools/perf/scripts/python/compaction-times.py create mode 100644 tools/perf/scripts/python/event_analyzing_sample.py create mode 100644 tools/perf/scripts/python/export-to-postgresql.py create mode 100644 tools/perf/scripts/python/export-to-sqlite.py create mode 100644 tools/perf/scripts/python/failed-syscalls-by-pid.py create mode 100644 tools/perf/scripts/python/futex-contention.py create mode 100644 tools/perf/scripts/python/intel-pt-events.py create mode 100644 tools/perf/scripts/python/mem-phys-addr.py create mode 100755 tools/perf/scripts/python/net_dropmonitor.py create mode 100644 tools/perf/scripts/python/netdev-times.py create mode 100644 tools/perf/scripts/python/powerpc-hcalls.py create mode 100644 tools/perf/scripts/python/sched-migration.py create mode 100644 tools/perf/scripts/python/sctop.py create mode 100755 tools/perf/scripts/python/stackcollapse.py create mode 100644 tools/perf/scripts/python/stat-cpi.py create mode 100644 tools/perf/scripts/python/syscall-counts-by-pid.py create mode 100644 tools/perf/scripts/python/syscall-counts.py create mode 100644 tools/perf/tests/.gitignore create mode 100644 tools/perf/tests/Build create mode 100644 tools/perf/tests/attr.c create mode 100644 tools/perf/tests/attr.py create mode 100644 tools/perf/tests/attr/README create mode 100644 tools/perf/tests/attr/base-record create mode 100644 tools/perf/tests/attr/base-stat create mode 100644 tools/perf/tests/attr/test-record-C0 create mode 100644 tools/perf/tests/attr/test-record-basic create mode 100644 tools/perf/tests/attr/test-record-branch-any create mode 100644 tools/perf/tests/attr/test-record-branch-filter-any create mode 100644 tools/perf/tests/attr/test-record-branch-filter-any_call create mode 100644 tools/perf/tests/attr/test-record-branch-filter-any_ret create mode 100644 tools/perf/tests/attr/test-record-branch-filter-hv create mode 100644 tools/perf/tests/attr/test-record-branch-filter-ind_call create mode 100644 tools/perf/tests/attr/test-record-branch-filter-k create mode 100644 tools/perf/tests/attr/test-record-branch-filter-u create mode 100644 tools/perf/tests/attr/test-record-count create mode 100644 tools/perf/tests/attr/test-record-data create mode 100644 tools/perf/tests/attr/test-record-freq create mode 100644 tools/perf/tests/attr/test-record-graph-default create mode 100644 tools/perf/tests/attr/test-record-graph-dwarf create mode 100644 tools/perf/tests/attr/test-record-graph-fp create mode 100644 tools/perf/tests/attr/test-record-group create mode 100644 tools/perf/tests/attr/test-record-group-sampling create mode 100644 tools/perf/tests/attr/test-record-group1 create mode 100644 tools/perf/tests/attr/test-record-no-buffering create mode 100644 tools/perf/tests/attr/test-record-no-inherit create mode 100644 tools/perf/tests/attr/test-record-no-samples create mode 100644 tools/perf/tests/attr/test-record-period create mode 100644 tools/perf/tests/attr/test-record-raw create mode 100644 tools/perf/tests/attr/test-stat-C0 create mode 100644 tools/perf/tests/attr/test-stat-basic create mode 100644 tools/perf/tests/attr/test-stat-default create mode 100644 tools/perf/tests/attr/test-stat-detailed-1 create mode 100644 tools/perf/tests/attr/test-stat-detailed-2 create mode 100644 tools/perf/tests/attr/test-stat-detailed-3 create mode 100644 tools/perf/tests/attr/test-stat-group create mode 100644 tools/perf/tests/attr/test-stat-group1 create mode 100644 tools/perf/tests/attr/test-stat-no-inherit create mode 100644 tools/perf/tests/backward-ring-buffer.c create mode 100644 tools/perf/tests/bitmap.c create mode 100644 tools/perf/tests/bp_account.c create mode 100644 tools/perf/tests/bp_signal.c create mode 100644 tools/perf/tests/bp_signal_overflow.c create mode 100644 tools/perf/tests/bpf-script-example.c create mode 100644 tools/perf/tests/bpf-script-test-kbuild.c create mode 100644 tools/perf/tests/bpf-script-test-prologue.c create mode 100644 tools/perf/tests/bpf-script-test-relocation.c create mode 100644 tools/perf/tests/bpf.c create mode 100644 tools/perf/tests/builtin-test.c create mode 100644 tools/perf/tests/clang.c create mode 100644 tools/perf/tests/code-reading.c create mode 100644 tools/perf/tests/cpumap.c create mode 100644 tools/perf/tests/dso-data.c create mode 100644 tools/perf/tests/dwarf-unwind.c create mode 100644 tools/perf/tests/event-times.c create mode 100644 tools/perf/tests/event_update.c create mode 100644 tools/perf/tests/evsel-roundtrip-name.c create mode 100644 tools/perf/tests/evsel-tp-sched.c create mode 100644 tools/perf/tests/expr.c create mode 100644 tools/perf/tests/fdarray.c create mode 100644 tools/perf/tests/hists_common.c create mode 100644 tools/perf/tests/hists_common.h create mode 100644 tools/perf/tests/hists_cumulate.c create mode 100644 tools/perf/tests/hists_filter.c create mode 100644 tools/perf/tests/hists_link.c create mode 100644 tools/perf/tests/hists_output.c create mode 100644 tools/perf/tests/is_printable_array.c create mode 100644 tools/perf/tests/keep-tracking.c create mode 100644 tools/perf/tests/kmod-path.c create mode 100644 tools/perf/tests/llvm.c create mode 100644 tools/perf/tests/llvm.h create mode 100644 tools/perf/tests/make create mode 100644 tools/perf/tests/mem.c create mode 100644 tools/perf/tests/mem2node.c create mode 100644 tools/perf/tests/mmap-basic.c create mode 100644 tools/perf/tests/mmap-thread-lookup.c create mode 100644 tools/perf/tests/openat-syscall-all-cpus.c create mode 100644 tools/perf/tests/openat-syscall-tp-fields.c create mode 100644 tools/perf/tests/openat-syscall.c create mode 100644 tools/perf/tests/parse-events.c create mode 100644 tools/perf/tests/parse-no-sample-id-all.c create mode 100644 tools/perf/tests/perf-hooks.c create mode 100644 tools/perf/tests/perf-record.c create mode 100755 tools/perf/tests/perf-targz-src-pkg create mode 100644 tools/perf/tests/pmu.c create mode 100644 tools/perf/tests/python-use.c create mode 100644 tools/perf/tests/sample-parsing.c create mode 100644 tools/perf/tests/sdt.c create mode 100644 tools/perf/tests/shell/lib/probe.sh create mode 100644 tools/perf/tests/shell/lib/probe_vfs_getname.sh create mode 100755 tools/perf/tests/shell/probe_vfs_getname.sh create mode 100755 tools/perf/tests/shell/record+probe_libc_inet_pton.sh create mode 100755 tools/perf/tests/shell/record+script_probe_vfs_getname.sh create mode 100755 tools/perf/tests/shell/trace+probe_vfs_getname.sh create mode 100644 tools/perf/tests/stat.c create mode 100644 tools/perf/tests/sw-clock.c create mode 100644 tools/perf/tests/switch-tracking.c create mode 100644 tools/perf/tests/task-exit.c create mode 100644 tools/perf/tests/tests.h create mode 100644 tools/perf/tests/thread-map.c create mode 100644 tools/perf/tests/thread-mg-share.c create mode 100644 tools/perf/tests/topology.c create mode 100644 tools/perf/tests/unit_number__scnprintf.c create mode 100644 tools/perf/tests/vmlinux-kallsyms.c create mode 100644 tools/perf/trace/beauty/Build create mode 100644 tools/perf/trace/beauty/arch_errno_names.c create mode 100755 tools/perf/trace/beauty/arch_errno_names.sh create mode 100644 tools/perf/trace/beauty/beauty.h create mode 100644 tools/perf/trace/beauty/clone.c create mode 100755 tools/perf/trace/beauty/drm_ioctl.sh create mode 100644 tools/perf/trace/beauty/eventfd.c create mode 100644 tools/perf/trace/beauty/fcntl.c create mode 100644 tools/perf/trace/beauty/flock.c create mode 100644 tools/perf/trace/beauty/futex_op.c create mode 100644 tools/perf/trace/beauty/futex_val3.c create mode 100644 tools/perf/trace/beauty/ioctl.c create mode 100644 tools/perf/trace/beauty/kcmp.c create mode 100755 tools/perf/trace/beauty/kcmp_type.sh create mode 100755 tools/perf/trace/beauty/kvm_ioctl.sh create mode 100755 tools/perf/trace/beauty/madvise_behavior.sh create mode 100644 tools/perf/trace/beauty/mmap.c create mode 100644 tools/perf/trace/beauty/mode_t.c create mode 100644 tools/perf/trace/beauty/msg_flags.c create mode 100644 tools/perf/trace/beauty/open_flags.c create mode 100644 tools/perf/trace/beauty/perf_event_open.c create mode 100755 tools/perf/trace/beauty/perf_ioctl.sh create mode 100644 tools/perf/trace/beauty/pid.c create mode 100644 tools/perf/trace/beauty/pkey_alloc.c create mode 100755 tools/perf/trace/beauty/pkey_alloc_access_rights.sh create mode 100644 tools/perf/trace/beauty/prctl.c create mode 100755 tools/perf/trace/beauty/prctl_option.sh create mode 100644 tools/perf/trace/beauty/sched_policy.c create mode 100644 tools/perf/trace/beauty/seccomp.c create mode 100644 tools/perf/trace/beauty/signum.c create mode 100755 tools/perf/trace/beauty/sndrv_ctl_ioctl.sh create mode 100755 tools/perf/trace/beauty/sndrv_pcm_ioctl.sh create mode 100644 tools/perf/trace/beauty/socket.c create mode 100755 tools/perf/trace/beauty/socket_ipproto.sh create mode 100644 tools/perf/trace/beauty/socket_type.c create mode 100644 tools/perf/trace/beauty/statx.c create mode 100755 tools/perf/trace/beauty/vhost_virtio_ioctl.sh create mode 100644 tools/perf/trace/beauty/waitid_options.c create mode 100644 tools/perf/trace/strace/groups/file create mode 100644 tools/perf/ui/Build create mode 100644 tools/perf/ui/browser.c create mode 100644 tools/perf/ui/browser.h create mode 100644 tools/perf/ui/browsers/Build create mode 100644 tools/perf/ui/browsers/annotate.c create mode 100644 tools/perf/ui/browsers/header.c create mode 100644 tools/perf/ui/browsers/hists.c create mode 100644 tools/perf/ui/browsers/hists.h create mode 100644 tools/perf/ui/browsers/map.c create mode 100644 tools/perf/ui/browsers/map.h create mode 100644 tools/perf/ui/browsers/scripts.c create mode 100644 tools/perf/ui/gtk/Build create mode 100644 tools/perf/ui/gtk/annotate.c create mode 100644 tools/perf/ui/gtk/browser.c create mode 100644 tools/perf/ui/gtk/gtk.h create mode 100644 tools/perf/ui/gtk/helpline.c create mode 100644 tools/perf/ui/gtk/hists.c create mode 100644 tools/perf/ui/gtk/progress.c create mode 100644 tools/perf/ui/gtk/setup.c create mode 100644 tools/perf/ui/gtk/util.c create mode 100644 tools/perf/ui/helpline.c create mode 100644 tools/perf/ui/helpline.h create mode 100644 tools/perf/ui/hist.c create mode 100644 tools/perf/ui/keysyms.h create mode 100644 tools/perf/ui/libslang.h create mode 100644 tools/perf/ui/progress.c create mode 100644 tools/perf/ui/progress.h create mode 100644 tools/perf/ui/setup.c create mode 100644 tools/perf/ui/stdio/hist.c create mode 100644 tools/perf/ui/tui/Build create mode 100644 tools/perf/ui/tui/helpline.c create mode 100644 tools/perf/ui/tui/progress.c create mode 100644 tools/perf/ui/tui/setup.c create mode 100644 tools/perf/ui/tui/tui.h create mode 100644 tools/perf/ui/tui/util.c create mode 100644 tools/perf/ui/ui.h create mode 100644 tools/perf/ui/util.c create mode 100644 tools/perf/ui/util.h create mode 100644 tools/perf/util/Build create mode 100755 tools/perf/util/PERF-VERSION-GEN create mode 100644 tools/perf/util/annotate.c create mode 100644 tools/perf/util/annotate.h create mode 100644 tools/perf/util/arm-spe-pkt-decoder.c create mode 100644 tools/perf/util/arm-spe-pkt-decoder.h create mode 100644 tools/perf/util/arm-spe.c create mode 100644 tools/perf/util/arm-spe.h create mode 100644 tools/perf/util/auxtrace.c create mode 100644 tools/perf/util/auxtrace.h create mode 100644 tools/perf/util/block-range.c create mode 100644 tools/perf/util/block-range.h create mode 100644 tools/perf/util/bpf-loader.c create mode 100644 tools/perf/util/bpf-loader.h create mode 100644 tools/perf/util/bpf-prologue.c create mode 100644 tools/perf/util/bpf-prologue.h create mode 100644 tools/perf/util/branch.c create mode 100644 tools/perf/util/branch.h create mode 100644 tools/perf/util/build-id.c create mode 100644 tools/perf/util/build-id.h create mode 100644 tools/perf/util/c++/Build create mode 100644 tools/perf/util/c++/clang-c.h create mode 100644 tools/perf/util/c++/clang-test.cpp create mode 100644 tools/perf/util/c++/clang.cpp create mode 100644 tools/perf/util/c++/clang.h create mode 100644 tools/perf/util/cache.h create mode 100644 tools/perf/util/call-path.c create mode 100644 tools/perf/util/call-path.h create mode 100644 tools/perf/util/callchain.c create mode 100644 tools/perf/util/callchain.h create mode 100644 tools/perf/util/cgroup.c create mode 100644 tools/perf/util/cgroup.h create mode 100644 tools/perf/util/cloexec.c create mode 100644 tools/perf/util/cloexec.h create mode 100644 tools/perf/util/color.c create mode 100644 tools/perf/util/color.h create mode 100644 tools/perf/util/comm.c create mode 100644 tools/perf/util/comm.h create mode 100644 tools/perf/util/compress.h create mode 100644 tools/perf/util/config.c create mode 100644 tools/perf/util/config.h create mode 100644 tools/perf/util/counts.c create mode 100644 tools/perf/util/counts.h create mode 100644 tools/perf/util/cpumap.c create mode 100644 tools/perf/util/cpumap.h create mode 100644 tools/perf/util/cs-etm-decoder/Build create mode 100644 tools/perf/util/cs-etm-decoder/cs-etm-decoder.c create mode 100644 tools/perf/util/cs-etm-decoder/cs-etm-decoder.h create mode 100644 tools/perf/util/cs-etm.c create mode 100644 tools/perf/util/cs-etm.h create mode 100644 tools/perf/util/ctype.c create mode 100644 tools/perf/util/data-convert-bt.c create mode 100644 tools/perf/util/data-convert-bt.h create mode 100644 tools/perf/util/data-convert.h create mode 100644 tools/perf/util/data.c create mode 100644 tools/perf/util/data.h create mode 100644 tools/perf/util/db-export.c create mode 100644 tools/perf/util/db-export.h create mode 100644 tools/perf/util/debug.c create mode 100644 tools/perf/util/debug.h create mode 100644 tools/perf/util/demangle-java.c create mode 100644 tools/perf/util/demangle-java.h create mode 100644 tools/perf/util/demangle-rust.c create mode 100644 tools/perf/util/demangle-rust.h create mode 100644 tools/perf/util/drv_configs.c create mode 100644 tools/perf/util/drv_configs.h create mode 100644 tools/perf/util/dso.c create mode 100644 tools/perf/util/dso.h create mode 100644 tools/perf/util/dump-insn.c create mode 100644 tools/perf/util/dump-insn.h create mode 100644 tools/perf/util/dwarf-aux.c create mode 100644 tools/perf/util/dwarf-aux.h create mode 100644 tools/perf/util/dwarf-regs.c create mode 100644 tools/perf/util/env.c create mode 100644 tools/perf/util/env.h create mode 100644 tools/perf/util/event.c create mode 100644 tools/perf/util/event.h create mode 100644 tools/perf/util/evlist.c create mode 100644 tools/perf/util/evlist.h create mode 100644 tools/perf/util/evsel.c create mode 100644 tools/perf/util/evsel.h create mode 100644 tools/perf/util/evsel_fprintf.c create mode 100644 tools/perf/util/expr.h create mode 100644 tools/perf/util/expr.y create mode 100644 tools/perf/util/find-vdso-map.c create mode 100644 tools/perf/util/genelf.c create mode 100644 tools/perf/util/genelf.h create mode 100644 tools/perf/util/genelf_debug.c create mode 100755 tools/perf/util/generate-cmdlist.sh create mode 100644 tools/perf/util/get_current_dir_name.c create mode 100644 tools/perf/util/group.h create mode 100644 tools/perf/util/header.c create mode 100644 tools/perf/util/header.h create mode 100644 tools/perf/util/help-unknown-cmd.c create mode 100644 tools/perf/util/help-unknown-cmd.h create mode 100644 tools/perf/util/hist.c create mode 100644 tools/perf/util/hist.h create mode 100644 tools/perf/util/include/asm/asm-offsets.h create mode 100644 tools/perf/util/include/asm/cpufeature.h create mode 100644 tools/perf/util/include/asm/dwarf2.h create mode 100644 tools/perf/util/include/asm/swab.h create mode 100644 tools/perf/util/include/asm/system.h create mode 100644 tools/perf/util/include/asm/uaccess.h create mode 100644 tools/perf/util/include/dwarf-regs.h create mode 100644 tools/perf/util/include/linux/ctype.h create mode 100644 tools/perf/util/include/linux/linkage.h create mode 100644 tools/perf/util/intel-bts.c create mode 100644 tools/perf/util/intel-bts.h create mode 100644 tools/perf/util/intel-pt-decoder/Build create mode 100644 tools/perf/util/intel-pt-decoder/gen-insn-attr-x86.awk create mode 100644 tools/perf/util/intel-pt-decoder/inat.c create mode 100644 tools/perf/util/intel-pt-decoder/inat.h create mode 100644 tools/perf/util/intel-pt-decoder/inat_types.h create mode 100644 tools/perf/util/intel-pt-decoder/insn.c create mode 100644 tools/perf/util/intel-pt-decoder/insn.h create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-decoder.c create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-decoder.h create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.h create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-log.c create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-log.h create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.h create mode 100644 tools/perf/util/intel-pt-decoder/x86-opcode-map.txt create mode 100644 tools/perf/util/intel-pt.c create mode 100644 tools/perf/util/intel-pt.h create mode 100644 tools/perf/util/intlist.c create mode 100644 tools/perf/util/intlist.h create mode 100644 tools/perf/util/jit.h create mode 100644 tools/perf/util/jitdump.c create mode 100644 tools/perf/util/jitdump.h create mode 100644 tools/perf/util/kvm-stat.h create mode 100644 tools/perf/util/levenshtein.c create mode 100644 tools/perf/util/levenshtein.h create mode 100644 tools/perf/util/libunwind/arm64.c create mode 100644 tools/perf/util/libunwind/x86_32.c create mode 100644 tools/perf/util/llvm-utils.c create mode 100644 tools/perf/util/llvm-utils.h create mode 100644 tools/perf/util/lzma.c create mode 100644 tools/perf/util/machine.c create mode 100644 tools/perf/util/machine.h create mode 100644 tools/perf/util/map.c create mode 100644 tools/perf/util/map.h create mode 100644 tools/perf/util/mem-events.c create mode 100644 tools/perf/util/mem-events.h create mode 100644 tools/perf/util/mem2node.c create mode 100644 tools/perf/util/mem2node.h create mode 100644 tools/perf/util/memswap.c create mode 100644 tools/perf/util/memswap.h create mode 100644 tools/perf/util/metricgroup.c create mode 100644 tools/perf/util/metricgroup.h create mode 100644 tools/perf/util/mmap.c create mode 100644 tools/perf/util/mmap.h create mode 100644 tools/perf/util/namespaces.c create mode 100644 tools/perf/util/namespaces.h create mode 100644 tools/perf/util/ordered-events.c create mode 100644 tools/perf/util/ordered-events.h create mode 100644 tools/perf/util/parse-branch-options.c create mode 100644 tools/perf/util/parse-branch-options.h create mode 100644 tools/perf/util/parse-events.c create mode 100644 tools/perf/util/parse-events.h create mode 100644 tools/perf/util/parse-events.l create mode 100644 tools/perf/util/parse-events.y create mode 100644 tools/perf/util/parse-regs-options.c create mode 100644 tools/perf/util/parse-regs-options.h create mode 100644 tools/perf/util/path.c create mode 100644 tools/perf/util/path.h create mode 100644 tools/perf/util/perf-hooks-list.h create mode 100644 tools/perf/util/perf-hooks.c create mode 100644 tools/perf/util/perf-hooks.h create mode 100644 tools/perf/util/perf_regs.c create mode 100644 tools/perf/util/perf_regs.h create mode 100644 tools/perf/util/pmu.c create mode 100644 tools/perf/util/pmu.h create mode 100644 tools/perf/util/pmu.l create mode 100644 tools/perf/util/pmu.y create mode 100644 tools/perf/util/print_binary.c create mode 100644 tools/perf/util/print_binary.h create mode 100644 tools/perf/util/probe-event.c create mode 100644 tools/perf/util/probe-event.h create mode 100644 tools/perf/util/probe-file.c create mode 100644 tools/perf/util/probe-file.h create mode 100644 tools/perf/util/probe-finder.c create mode 100644 tools/perf/util/probe-finder.h create mode 100644 tools/perf/util/pstack.c create mode 100644 tools/perf/util/pstack.h create mode 100644 tools/perf/util/python-ext-sources create mode 100644 tools/perf/util/python.c create mode 100644 tools/perf/util/rb_resort.h create mode 100644 tools/perf/util/rblist.c create mode 100644 tools/perf/util/rblist.h create mode 100644 tools/perf/util/record.c create mode 100644 tools/perf/util/rwsem.c create mode 100644 tools/perf/util/rwsem.h create mode 100644 tools/perf/util/s390-cpumsf-kernel.h create mode 100644 tools/perf/util/s390-cpumsf.c create mode 100644 tools/perf/util/s390-cpumsf.h create mode 100644 tools/perf/util/sane_ctype.h create mode 100644 tools/perf/util/scripting-engines/Build create mode 100644 tools/perf/util/scripting-engines/trace-event-perl.c create mode 100644 tools/perf/util/scripting-engines/trace-event-python.c create mode 100644 tools/perf/util/session.c create mode 100644 tools/perf/util/session.h create mode 100644 tools/perf/util/setns.c create mode 100644 tools/perf/util/setup.py create mode 100644 tools/perf/util/smt.c create mode 100644 tools/perf/util/smt.h create mode 100644 tools/perf/util/sort.c create mode 100644 tools/perf/util/sort.h create mode 100644 tools/perf/util/srcline.c create mode 100644 tools/perf/util/srcline.h create mode 100644 tools/perf/util/stat-shadow.c create mode 100644 tools/perf/util/stat.c create mode 100644 tools/perf/util/stat.h create mode 100644 tools/perf/util/strbuf.c create mode 100644 tools/perf/util/strbuf.h create mode 100644 tools/perf/util/strfilter.c create mode 100644 tools/perf/util/strfilter.h create mode 100644 tools/perf/util/string.c create mode 100644 tools/perf/util/string2.h create mode 100644 tools/perf/util/strlist.c create mode 100644 tools/perf/util/strlist.h create mode 100644 tools/perf/util/svghelper.c create mode 100644 tools/perf/util/svghelper.h create mode 100644 tools/perf/util/symbol-elf.c create mode 100644 tools/perf/util/symbol-minimal.c create mode 100644 tools/perf/util/symbol.c create mode 100644 tools/perf/util/symbol.h create mode 100644 tools/perf/util/symbol_fprintf.c create mode 100644 tools/perf/util/syscalltbl.c create mode 100644 tools/perf/util/syscalltbl.h create mode 100644 tools/perf/util/target.c create mode 100644 tools/perf/util/target.h create mode 100644 tools/perf/util/term.c create mode 100644 tools/perf/util/term.h create mode 100644 tools/perf/util/thread-stack.c create mode 100644 tools/perf/util/thread-stack.h create mode 100644 tools/perf/util/thread.c create mode 100644 tools/perf/util/thread.h create mode 100644 tools/perf/util/thread_map.c create mode 100644 tools/perf/util/thread_map.h create mode 100644 tools/perf/util/time-utils.c create mode 100644 tools/perf/util/time-utils.h create mode 100644 tools/perf/util/tool.h create mode 100644 tools/perf/util/top.c create mode 100644 tools/perf/util/top.h create mode 100644 tools/perf/util/trace-event-info.c create mode 100644 tools/perf/util/trace-event-parse.c create mode 100644 tools/perf/util/trace-event-read.c create mode 100644 tools/perf/util/trace-event-scripting.c create mode 100644 tools/perf/util/trace-event.c create mode 100644 tools/perf/util/trace-event.h create mode 100644 tools/perf/util/trigger.h create mode 100644 tools/perf/util/tsc.c create mode 100644 tools/perf/util/tsc.h create mode 100644 tools/perf/util/units.c create mode 100644 tools/perf/util/units.h create mode 100644 tools/perf/util/unwind-libdw.c create mode 100644 tools/perf/util/unwind-libdw.h create mode 100644 tools/perf/util/unwind-libunwind-local.c create mode 100644 tools/perf/util/unwind-libunwind.c create mode 100644 tools/perf/util/unwind.h create mode 100644 tools/perf/util/usage.c create mode 100644 tools/perf/util/util-cxx.h create mode 100644 tools/perf/util/util.c create mode 100644 tools/perf/util/util.h create mode 100644 tools/perf/util/values.c create mode 100644 tools/perf/util/values.h create mode 100644 tools/perf/util/vdso.c create mode 100644 tools/perf/util/vdso.h create mode 100644 tools/perf/util/xyarray.c create mode 100644 tools/perf/util/xyarray.h create mode 100644 tools/perf/util/zlib.c create mode 100644 tools/power/acpi/.gitignore create mode 100644 tools/power/acpi/Makefile create mode 100644 tools/power/acpi/Makefile.config create mode 100644 tools/power/acpi/Makefile.rules create mode 100644 tools/power/acpi/common/cmfsize.c create mode 100644 tools/power/acpi/common/getopt.c create mode 100644 tools/power/acpi/man/acpidump.8 create mode 100644 tools/power/acpi/os_specific/service_layers/oslinuxtbl.c create mode 100644 tools/power/acpi/os_specific/service_layers/osunixdir.c create mode 100644 tools/power/acpi/os_specific/service_layers/osunixmap.c create mode 100644 tools/power/acpi/os_specific/service_layers/osunixxf.c create mode 100644 tools/power/acpi/tools/acpidbg/Makefile create mode 100644 tools/power/acpi/tools/acpidbg/acpidbg.c create mode 100644 tools/power/acpi/tools/acpidump/Makefile create mode 100644 tools/power/acpi/tools/acpidump/acpidump.h create mode 100644 tools/power/acpi/tools/acpidump/apdump.c create mode 100644 tools/power/acpi/tools/acpidump/apfiles.c create mode 100644 tools/power/acpi/tools/acpidump/apmain.c create mode 100644 tools/power/acpi/tools/ec/Makefile create mode 100644 tools/power/acpi/tools/ec/ec_access.c create mode 100644 tools/power/cpupower/.gitignore create mode 100644 tools/power/cpupower/Makefile create mode 100644 tools/power/cpupower/README create mode 100644 tools/power/cpupower/ToDo create mode 100644 tools/power/cpupower/bench/Makefile create mode 100644 tools/power/cpupower/bench/README-BENCH create mode 100644 tools/power/cpupower/bench/benchmark.c create mode 100644 tools/power/cpupower/bench/benchmark.h create mode 100644 tools/power/cpupower/bench/config.h create mode 100644 tools/power/cpupower/bench/cpufreq-bench_plot.sh create mode 100644 tools/power/cpupower/bench/cpufreq-bench_script.sh create mode 100644 tools/power/cpupower/bench/example.cfg create mode 100644 tools/power/cpupower/bench/main.c create mode 100644 tools/power/cpupower/bench/parse.c create mode 100644 tools/power/cpupower/bench/parse.h create mode 100644 tools/power/cpupower/bench/system.c create mode 100644 tools/power/cpupower/bench/system.h create mode 100644 tools/power/cpupower/debug/i386/Makefile create mode 100644 tools/power/cpupower/debug/i386/centrino-decode.c create mode 100644 tools/power/cpupower/debug/i386/dump_psb.c create mode 100644 tools/power/cpupower/debug/i386/intel_gsic.c create mode 100644 tools/power/cpupower/debug/i386/powernow-k8-decode.c create mode 100644 tools/power/cpupower/debug/kernel/Makefile create mode 100644 tools/power/cpupower/debug/kernel/cpufreq-test_tsc.c create mode 100644 tools/power/cpupower/debug/x86_64/Makefile create mode 100644 tools/power/cpupower/lib/cpufreq.c create mode 100644 tools/power/cpupower/lib/cpufreq.h create mode 100644 tools/power/cpupower/lib/cpuidle.c create mode 100644 tools/power/cpupower/lib/cpuidle.h create mode 100644 tools/power/cpupower/lib/cpupower.c create mode 100644 tools/power/cpupower/lib/cpupower.h create mode 100644 tools/power/cpupower/lib/cpupower_intern.h create mode 100644 tools/power/cpupower/man/cpupower-frequency-info.1 create mode 100644 tools/power/cpupower/man/cpupower-frequency-set.1 create mode 100644 tools/power/cpupower/man/cpupower-idle-info.1 create mode 100644 tools/power/cpupower/man/cpupower-idle-set.1 create mode 100644 tools/power/cpupower/man/cpupower-info.1 create mode 100644 tools/power/cpupower/man/cpupower-monitor.1 create mode 100644 tools/power/cpupower/man/cpupower-set.1 create mode 100644 tools/power/cpupower/man/cpupower.1 create mode 100644 tools/power/cpupower/po/cs.po create mode 100644 tools/power/cpupower/po/de.po create mode 100644 tools/power/cpupower/po/fr.po create mode 100644 tools/power/cpupower/po/it.po create mode 100644 tools/power/cpupower/po/pt.po create mode 100644 tools/power/cpupower/utils/builtin.h create mode 100644 tools/power/cpupower/utils/cpufreq-info.c create mode 100644 tools/power/cpupower/utils/cpufreq-set.c create mode 100644 tools/power/cpupower/utils/cpuidle-info.c create mode 100644 tools/power/cpupower/utils/cpuidle-set.c create mode 100644 tools/power/cpupower/utils/cpupower-info.c create mode 100644 tools/power/cpupower/utils/cpupower-set.c create mode 100644 tools/power/cpupower/utils/cpupower.c create mode 100644 tools/power/cpupower/utils/helpers/amd.c create mode 100644 tools/power/cpupower/utils/helpers/bitmask.c create mode 100644 tools/power/cpupower/utils/helpers/bitmask.h create mode 100644 tools/power/cpupower/utils/helpers/cpuid.c create mode 100644 tools/power/cpupower/utils/helpers/helpers.h create mode 100644 tools/power/cpupower/utils/helpers/misc.c create mode 100644 tools/power/cpupower/utils/helpers/msr.c create mode 100644 tools/power/cpupower/utils/helpers/pci.c create mode 100644 tools/power/cpupower/utils/helpers/sysfs.c create mode 100644 tools/power/cpupower/utils/helpers/sysfs.h create mode 100644 tools/power/cpupower/utils/helpers/topology.c create mode 100644 tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c create mode 100644 tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c create mode 100644 tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c create mode 100644 tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h create mode 100644 tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c create mode 100644 tools/power/cpupower/utils/idle_monitor/idle_monitors.def create mode 100644 tools/power/cpupower/utils/idle_monitor/idle_monitors.h create mode 100644 tools/power/cpupower/utils/idle_monitor/mperf_monitor.c create mode 100644 tools/power/cpupower/utils/idle_monitor/nhm_idle.c create mode 100644 tools/power/cpupower/utils/idle_monitor/snb_idle.c create mode 100755 tools/power/cpupower/utils/version-gen.sh create mode 100644 tools/power/pm-graph/Makefile create mode 100644 tools/power/pm-graph/bootgraph.8 create mode 100755 tools/power/pm-graph/bootgraph.py create mode 100644 tools/power/pm-graph/config/cgskip.txt create mode 100644 tools/power/pm-graph/config/custom-timeline-functions.cfg create mode 100644 tools/power/pm-graph/config/example.cfg create mode 100644 tools/power/pm-graph/config/freeze-callgraph.cfg create mode 100644 tools/power/pm-graph/config/freeze-dev.cfg create mode 100644 tools/power/pm-graph/config/freeze.cfg create mode 100644 tools/power/pm-graph/config/standby-callgraph.cfg create mode 100644 tools/power/pm-graph/config/standby-dev.cfg create mode 100644 tools/power/pm-graph/config/standby.cfg create mode 100644 tools/power/pm-graph/config/suspend-callgraph.cfg create mode 100644 tools/power/pm-graph/config/suspend-dev.cfg create mode 100644 tools/power/pm-graph/config/suspend-x2-proc.cfg create mode 100644 tools/power/pm-graph/config/suspend.cfg create mode 100644 tools/power/pm-graph/sleepgraph.8 create mode 100755 tools/power/pm-graph/sleepgraph.py create mode 100755 tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py create mode 100644 tools/power/x86/turbostat/.gitignore create mode 100644 tools/power/x86/turbostat/Makefile create mode 100644 tools/power/x86/turbostat/turbostat.8 create mode 100644 tools/power/x86/turbostat/turbostat.c create mode 100644 tools/power/x86/x86_energy_perf_policy/Makefile create mode 100644 tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.8 create mode 100644 tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c create mode 100644 tools/scripts/Makefile.arch create mode 100644 tools/scripts/Makefile.include create mode 100644 tools/scripts/utilities.mak create mode 100644 tools/spi/.gitignore create mode 100644 tools/spi/Build create mode 100644 tools/spi/Makefile create mode 100644 tools/spi/spidev_fdx.c create mode 100644 tools/spi/spidev_test.c create mode 100644 tools/testing/fault-injection/failcmd.sh create mode 100755 tools/testing/ktest/compare-ktest-sample.pl create mode 100755 tools/testing/ktest/config-bisect.pl create mode 100644 tools/testing/ktest/examples/README create mode 100644 tools/testing/ktest/examples/crosstests.conf create mode 100644 tools/testing/ktest/examples/include/bisect.conf create mode 100644 tools/testing/ktest/examples/include/defaults.conf create mode 100644 tools/testing/ktest/examples/include/min-config.conf create mode 100644 tools/testing/ktest/examples/include/patchcheck.conf create mode 100644 tools/testing/ktest/examples/include/tests.conf create mode 100644 tools/testing/ktest/examples/kvm.conf create mode 100644 tools/testing/ktest/examples/snowball.conf create mode 100644 tools/testing/ktest/examples/test.conf create mode 100755 tools/testing/ktest/ktest.pl create mode 100644 tools/testing/ktest/sample.conf create mode 100644 tools/testing/nvdimm/Kbuild create mode 100644 tools/testing/nvdimm/Makefile create mode 100644 tools/testing/nvdimm/acpi_nfit_test.c create mode 100644 tools/testing/nvdimm/config_check.c create mode 100644 tools/testing/nvdimm/dax-dev.c create mode 100644 tools/testing/nvdimm/device_dax_test.c create mode 100644 tools/testing/nvdimm/libnvdimm_test.c create mode 100644 tools/testing/nvdimm/pmem-dax.c create mode 100644 tools/testing/nvdimm/pmem_test.c create mode 100644 tools/testing/nvdimm/test/Kbuild create mode 100644 tools/testing/nvdimm/test/iomap.c create mode 100644 tools/testing/nvdimm/test/nfit.c create mode 100644 tools/testing/nvdimm/test/nfit_test.h create mode 100644 tools/testing/nvdimm/watermark.h create mode 100644 tools/testing/radix-tree/.gitignore create mode 100644 tools/testing/radix-tree/Makefile create mode 100644 tools/testing/radix-tree/benchmark.c create mode 100644 tools/testing/radix-tree/generated/autoconf.h create mode 100644 tools/testing/radix-tree/idr-test.c create mode 100644 tools/testing/radix-tree/iteration_check.c create mode 100644 tools/testing/radix-tree/linux.c create mode 100644 tools/testing/radix-tree/linux/bug.h create mode 100644 tools/testing/radix-tree/linux/compiler_types.h create mode 100644 tools/testing/radix-tree/linux/cpu.h create mode 100644 tools/testing/radix-tree/linux/gfp.h create mode 100644 tools/testing/radix-tree/linux/idr.h create mode 100644 tools/testing/radix-tree/linux/init.h create mode 100644 tools/testing/radix-tree/linux/kernel.h create mode 100644 tools/testing/radix-tree/linux/kmemleak.h create mode 100644 tools/testing/radix-tree/linux/percpu.h create mode 100644 tools/testing/radix-tree/linux/preempt.h create mode 100644 tools/testing/radix-tree/linux/radix-tree.h create mode 100644 tools/testing/radix-tree/linux/rcupdate.h create mode 100644 tools/testing/radix-tree/linux/slab.h create mode 100644 tools/testing/radix-tree/linux/xarray.h create mode 100644 tools/testing/radix-tree/main.c create mode 100644 tools/testing/radix-tree/multiorder.c create mode 100644 tools/testing/radix-tree/regression.h create mode 100644 tools/testing/radix-tree/regression1.c create mode 100644 tools/testing/radix-tree/regression2.c create mode 100644 tools/testing/radix-tree/regression3.c create mode 100644 tools/testing/radix-tree/tag_check.c create mode 100644 tools/testing/radix-tree/test.c create mode 100644 tools/testing/radix-tree/test.h create mode 100644 tools/testing/scatterlist/Makefile create mode 100644 tools/testing/scatterlist/linux/mm.h create mode 100644 tools/testing/scatterlist/main.c create mode 100644 tools/testing/selftests/.gitignore create mode 100644 tools/testing/selftests/Makefile create mode 100644 tools/testing/selftests/android/Makefile create mode 100644 tools/testing/selftests/android/config create mode 100644 tools/testing/selftests/android/ion/.gitignore create mode 100644 tools/testing/selftests/android/ion/Makefile create mode 100644 tools/testing/selftests/android/ion/README create mode 100644 tools/testing/selftests/android/ion/ion.h create mode 100755 tools/testing/selftests/android/ion/ion_test.sh create mode 100644 tools/testing/selftests/android/ion/ionapp_export.c create mode 100644 tools/testing/selftests/android/ion/ionapp_import.c create mode 100644 tools/testing/selftests/android/ion/ionmap_test.c create mode 100644 tools/testing/selftests/android/ion/ionutils.c create mode 100644 tools/testing/selftests/android/ion/ionutils.h create mode 100644 tools/testing/selftests/android/ion/ipcsocket.c create mode 100644 tools/testing/selftests/android/ion/ipcsocket.h create mode 100755 tools/testing/selftests/android/run.sh create mode 100644 tools/testing/selftests/bpf/.gitignore create mode 100644 tools/testing/selftests/bpf/Makefile create mode 100644 tools/testing/selftests/bpf/bpf_endian.h create mode 100644 tools/testing/selftests/bpf/bpf_helpers.h create mode 100644 tools/testing/selftests/bpf/bpf_rand.h create mode 100644 tools/testing/selftests/bpf/bpf_rlimit.h create mode 100644 tools/testing/selftests/bpf/bpf_util.h create mode 100644 tools/testing/selftests/bpf/cgroup_helpers.c create mode 100644 tools/testing/selftests/bpf/cgroup_helpers.h create mode 100644 tools/testing/selftests/bpf/config create mode 100644 tools/testing/selftests/bpf/connect4_prog.c create mode 100644 tools/testing/selftests/bpf/connect6_prog.c create mode 100644 tools/testing/selftests/bpf/dev_cgroup.c create mode 100644 tools/testing/selftests/bpf/get_cgroup_id_kern.c create mode 100644 tools/testing/selftests/bpf/get_cgroup_id_user.c create mode 100644 tools/testing/selftests/bpf/gnu/stubs.h create mode 100644 tools/testing/selftests/bpf/include/uapi/linux/types.h create mode 100644 tools/testing/selftests/bpf/sample_map_ret0.c create mode 100644 tools/testing/selftests/bpf/sample_ret0.c create mode 100644 tools/testing/selftests/bpf/sendmsg4_prog.c create mode 100644 tools/testing/selftests/bpf/sendmsg6_prog.c create mode 100644 tools/testing/selftests/bpf/socket_cookie_prog.c create mode 100644 tools/testing/selftests/bpf/sockmap_parse_prog.c create mode 100644 tools/testing/selftests/bpf/sockmap_tcp_msg_prog.c create mode 100644 tools/testing/selftests/bpf/sockmap_verdict_prog.c create mode 100755 tools/testing/selftests/bpf/tcp_client.py create mode 100755 tools/testing/selftests/bpf/tcp_server.py create mode 100644 tools/testing/selftests/bpf/test_adjust_tail.c create mode 100644 tools/testing/selftests/bpf/test_align.c create mode 100644 tools/testing/selftests/bpf/test_btf.c create mode 100644 tools/testing/selftests/bpf/test_btf_haskv.c create mode 100644 tools/testing/selftests/bpf/test_btf_nokv.c create mode 100644 tools/testing/selftests/bpf/test_cgroup_storage.c create mode 100644 tools/testing/selftests/bpf/test_dev_cgroup.c create mode 100644 tools/testing/selftests/bpf/test_get_stack_rawtp.c create mode 100644 tools/testing/selftests/bpf/test_iptunnel_common.h create mode 100755 tools/testing/selftests/bpf/test_kmod.sh create mode 100644 tools/testing/selftests/bpf/test_l4lb.c create mode 100644 tools/testing/selftests/bpf/test_l4lb_noinline.c create mode 100755 tools/testing/selftests/bpf/test_libbpf.sh create mode 100644 tools/testing/selftests/bpf/test_libbpf_open.c create mode 100755 tools/testing/selftests/bpf/test_lirc_mode2.sh create mode 100644 tools/testing/selftests/bpf/test_lirc_mode2_kern.c create mode 100644 tools/testing/selftests/bpf/test_lirc_mode2_user.c create mode 100644 tools/testing/selftests/bpf/test_lpm_map.c create mode 100644 tools/testing/selftests/bpf/test_lru_map.c create mode 100644 tools/testing/selftests/bpf/test_lwt_seg6local.c create mode 100755 tools/testing/selftests/bpf/test_lwt_seg6local.sh create mode 100644 tools/testing/selftests/bpf/test_maps.c create mode 100644 tools/testing/selftests/bpf/test_obj_id.c create mode 100755 tools/testing/selftests/bpf/test_offload.py create mode 100644 tools/testing/selftests/bpf/test_pkt_access.c create mode 100644 tools/testing/selftests/bpf/test_pkt_md_access.c create mode 100644 tools/testing/selftests/bpf/test_progs.c create mode 100644 tools/testing/selftests/bpf/test_select_reuseport.c create mode 100644 tools/testing/selftests/bpf/test_select_reuseport_common.h create mode 100644 tools/testing/selftests/bpf/test_select_reuseport_kern.c create mode 100755 tools/testing/selftests/bpf/test_skb_cgroup_id.sh create mode 100644 tools/testing/selftests/bpf/test_skb_cgroup_id_kern.c create mode 100644 tools/testing/selftests/bpf/test_skb_cgroup_id_user.c create mode 100644 tools/testing/selftests/bpf/test_sock.c create mode 100644 tools/testing/selftests/bpf/test_sock_addr.c create mode 100755 tools/testing/selftests/bpf/test_sock_addr.sh create mode 100644 tools/testing/selftests/bpf/test_socket_cookie.c create mode 100644 tools/testing/selftests/bpf/test_sockhash_kern.c create mode 100644 tools/testing/selftests/bpf/test_sockmap.c create mode 100644 tools/testing/selftests/bpf/test_sockmap_kern.c create mode 100644 tools/testing/selftests/bpf/test_sockmap_kern.h create mode 100644 tools/testing/selftests/bpf/test_stacktrace_build_id.c create mode 100644 tools/testing/selftests/bpf/test_stacktrace_map.c create mode 100644 tools/testing/selftests/bpf/test_tag.c create mode 100644 tools/testing/selftests/bpf/test_tcp_estats.c create mode 100644 tools/testing/selftests/bpf/test_tcpbpf.h create mode 100644 tools/testing/selftests/bpf/test_tcpbpf_kern.c create mode 100644 tools/testing/selftests/bpf/test_tcpbpf_user.c create mode 100644 tools/testing/selftests/bpf/test_tracepoint.c create mode 100755 tools/testing/selftests/bpf/test_tunnel.sh create mode 100644 tools/testing/selftests/bpf/test_tunnel_kern.c create mode 100644 tools/testing/selftests/bpf/test_verifier.c create mode 100644 tools/testing/selftests/bpf/test_verifier_log.c create mode 100644 tools/testing/selftests/bpf/test_xdp.c create mode 100644 tools/testing/selftests/bpf/test_xdp_meta.c create mode 100755 tools/testing/selftests/bpf/test_xdp_meta.sh create mode 100644 tools/testing/selftests/bpf/test_xdp_noinline.c create mode 100644 tools/testing/selftests/bpf/test_xdp_redirect.c create mode 100755 tools/testing/selftests/bpf/test_xdp_redirect.sh create mode 100644 tools/testing/selftests/bpf/trace_helpers.c create mode 100644 tools/testing/selftests/bpf/trace_helpers.h create mode 100644 tools/testing/selftests/bpf/urandom_read.c create mode 100644 tools/testing/selftests/breakpoints/.gitignore create mode 100644 tools/testing/selftests/breakpoints/Makefile create mode 100644 tools/testing/selftests/breakpoints/breakpoint_test.c create mode 100644 tools/testing/selftests/breakpoints/breakpoint_test_arm64.c create mode 100644 tools/testing/selftests/breakpoints/step_after_suspend_test.c create mode 100644 tools/testing/selftests/capabilities/.gitignore create mode 100644 tools/testing/selftests/capabilities/Makefile create mode 100644 tools/testing/selftests/capabilities/test_execve.c create mode 100644 tools/testing/selftests/capabilities/validate_cap.c create mode 100644 tools/testing/selftests/cgroup/.gitignore create mode 100644 tools/testing/selftests/cgroup/Makefile create mode 100644 tools/testing/selftests/cgroup/cgroup_util.c create mode 100644 tools/testing/selftests/cgroup/cgroup_util.h create mode 100644 tools/testing/selftests/cgroup/test_core.c create mode 100644 tools/testing/selftests/cgroup/test_memcontrol.c create mode 100644 tools/testing/selftests/cpu-hotplug/Makefile create mode 100644 tools/testing/selftests/cpu-hotplug/config create mode 100755 tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh create mode 100644 tools/testing/selftests/cpufreq/Makefile create mode 100644 tools/testing/selftests/cpufreq/config create mode 100755 tools/testing/selftests/cpufreq/cpu.sh create mode 100755 tools/testing/selftests/cpufreq/cpufreq.sh create mode 100755 tools/testing/selftests/cpufreq/governor.sh create mode 100755 tools/testing/selftests/cpufreq/main.sh create mode 100755 tools/testing/selftests/cpufreq/module.sh create mode 100755 tools/testing/selftests/cpufreq/special-tests.sh create mode 100755 tools/testing/selftests/drivers/gpu/drm_mm.sh create mode 100755 tools/testing/selftests/drivers/gpu/i915.sh create mode 100755 tools/testing/selftests/drivers/net/mlxsw/mirror_gre.sh create mode 100644 tools/testing/selftests/drivers/net/mlxsw/mirror_gre_scale.sh create mode 100755 tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh create mode 100755 tools/testing/selftests/drivers/net/mlxsw/qos_dscp_router.sh create mode 100644 tools/testing/selftests/drivers/net/mlxsw/router_scale.sh create mode 100755 tools/testing/selftests/drivers/net/mlxsw/spectrum-2/tc_flower.sh create mode 100644 tools/testing/selftests/drivers/net/mlxsw/spectrum/devlink_lib_spectrum.sh create mode 100755 tools/testing/selftests/drivers/net/mlxsw/spectrum/devlink_resources.sh create mode 100644 tools/testing/selftests/drivers/net/mlxsw/spectrum/mirror_gre_scale.sh create mode 100755 tools/testing/selftests/drivers/net/mlxsw/spectrum/resource_scale.sh create mode 100644 tools/testing/selftests/drivers/net/mlxsw/spectrum/router_scale.sh create mode 100644 tools/testing/selftests/drivers/net/mlxsw/spectrum/tc_flower_scale.sh create mode 100644 tools/testing/selftests/drivers/net/mlxsw/tc_flower_scale.sh create mode 100755 tools/testing/selftests/drivers/usb/usbip/usbip_test.sh create mode 100644 tools/testing/selftests/efivarfs/.gitignore create mode 100644 tools/testing/selftests/efivarfs/Makefile create mode 100644 tools/testing/selftests/efivarfs/config create mode 100644 tools/testing/selftests/efivarfs/create-read.c create mode 100755 tools/testing/selftests/efivarfs/efivarfs.sh create mode 100644 tools/testing/selftests/efivarfs/open-unlink.c create mode 100644 tools/testing/selftests/exec/.gitignore create mode 100644 tools/testing/selftests/exec/Makefile create mode 100644 tools/testing/selftests/exec/execveat.c create mode 100644 tools/testing/selftests/filesystems/.gitignore create mode 100644 tools/testing/selftests/filesystems/Makefile create mode 100644 tools/testing/selftests/filesystems/devpts_pts.c create mode 100644 tools/testing/selftests/filesystems/dnotify_test.c create mode 100644 tools/testing/selftests/firmware/Makefile create mode 100644 tools/testing/selftests/firmware/config create mode 100755 tools/testing/selftests/firmware/fw_fallback.sh create mode 100755 tools/testing/selftests/firmware/fw_filesystem.sh create mode 100755 tools/testing/selftests/firmware/fw_lib.sh create mode 100755 tools/testing/selftests/firmware/fw_run_tests.sh create mode 100644 tools/testing/selftests/ftrace/.gitignore create mode 100644 tools/testing/selftests/ftrace/Makefile create mode 100644 tools/testing/selftests/ftrace/README create mode 100644 tools/testing/selftests/ftrace/config create mode 100755 tools/testing/selftests/ftrace/ftracetest create mode 100644 tools/testing/selftests/ftrace/samples/fail.tc create mode 100644 tools/testing/selftests/ftrace/samples/pass.tc create mode 100644 tools/testing/selftests/ftrace/samples/unresolved.tc create mode 100644 tools/testing/selftests/ftrace/samples/unsupported.tc create mode 100644 tools/testing/selftests/ftrace/samples/untested.tc create mode 100644 tools/testing/selftests/ftrace/samples/xfail.tc create mode 100644 tools/testing/selftests/ftrace/settings create mode 100644 tools/testing/selftests/ftrace/test.d/00basic/basic1.tc create mode 100644 tools/testing/selftests/ftrace/test.d/00basic/basic2.tc create mode 100644 tools/testing/selftests/ftrace/test.d/00basic/basic3.tc create mode 100644 tools/testing/selftests/ftrace/test.d/00basic/basic4.tc create mode 100644 tools/testing/selftests/ftrace/test.d/00basic/snapshot.tc create mode 100644 tools/testing/selftests/ftrace/test.d/event/event-enable.tc create mode 100644 tools/testing/selftests/ftrace/test.d/event/event-pid.tc create mode 100644 tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc create mode 100644 tools/testing/selftests/ftrace/test.d/event/toplevel-enable.tc create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter-stack.tc create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter.tc create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/func_traceonoff_triggers.tc create mode 100644 tools/testing/selftests/ftrace/test.d/functions create mode 100644 tools/testing/selftests/ftrace/test.d/instances/instance-event.tc create mode 100644 tools/testing/selftests/ftrace/test.d/instances/instance.tc create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/add_and_remove.tc create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/busy_check.tc create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args.tc create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_syntax.tc create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_args.tc create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_maxactive.tc create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc create mode 100644 tools/testing/selftests/ftrace/test.d/preemptirq/irqsoff_tracer.tc create mode 100644 tools/testing/selftests/ftrace/test.d/template create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-field-variable-support.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-inter-event-combined-hist.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-multi-actions-accept.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onmatch-action-hist.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onmatch-onmax-action-hist.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onmax-action-hist.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-createremove.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-syntax.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/trigger-eventonoff.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/trigger-filter.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/trigger-snapshot.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/trigger-stacktrace.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-snapshot.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic-kernel.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/trigger-traceonoff.tc create mode 100644 tools/testing/selftests/futex/Makefile create mode 100644 tools/testing/selftests/futex/README create mode 100644 tools/testing/selftests/futex/functional/.gitignore create mode 100644 tools/testing/selftests/futex/functional/Makefile create mode 100644 tools/testing/selftests/futex/functional/futex_requeue_pi.c create mode 100644 tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c create mode 100644 tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c create mode 100644 tools/testing/selftests/futex/functional/futex_wait_private_mapped_file.c create mode 100644 tools/testing/selftests/futex/functional/futex_wait_timeout.c create mode 100644 tools/testing/selftests/futex/functional/futex_wait_uninitialized_heap.c create mode 100644 tools/testing/selftests/futex/functional/futex_wait_wouldblock.c create mode 100755 tools/testing/selftests/futex/functional/run.sh create mode 100644 tools/testing/selftests/futex/include/atomic.h create mode 100644 tools/testing/selftests/futex/include/futextest.h create mode 100644 tools/testing/selftests/futex/include/logging.h create mode 100755 tools/testing/selftests/futex/run.sh create mode 100755 tools/testing/selftests/gen_kselftest_tar.sh create mode 100644 tools/testing/selftests/gpio/.gitignore create mode 100644 tools/testing/selftests/gpio/Makefile create mode 100644 tools/testing/selftests/gpio/config create mode 100644 tools/testing/selftests/gpio/gpio-mockup-chardev.c create mode 100755 tools/testing/selftests/gpio/gpio-mockup-sysfs.sh create mode 100755 tools/testing/selftests/gpio/gpio-mockup.sh create mode 100644 tools/testing/selftests/ia64/.gitignore create mode 100644 tools/testing/selftests/ia64/Makefile create mode 100644 tools/testing/selftests/ia64/aliasing-test.c create mode 100644 tools/testing/selftests/intel_pstate/.gitignore create mode 100644 tools/testing/selftests/intel_pstate/Makefile create mode 100644 tools/testing/selftests/intel_pstate/aperf.c create mode 100644 tools/testing/selftests/intel_pstate/msr.c create mode 100755 tools/testing/selftests/intel_pstate/run.sh create mode 100644 tools/testing/selftests/ipc/.gitignore create mode 100644 tools/testing/selftests/ipc/Makefile create mode 100644 tools/testing/selftests/ipc/config create mode 100644 tools/testing/selftests/ipc/msgque.c create mode 100644 tools/testing/selftests/kcmp/.gitignore create mode 100644 tools/testing/selftests/kcmp/Makefile create mode 100644 tools/testing/selftests/kcmp/kcmp_test.c create mode 100644 tools/testing/selftests/kmod/Makefile create mode 100644 tools/testing/selftests/kmod/config create mode 100755 tools/testing/selftests/kmod/kmod.sh create mode 100644 tools/testing/selftests/kselftest.h create mode 100644 tools/testing/selftests/kselftest_harness.h create mode 100755 tools/testing/selftests/kselftest_install.sh create mode 100644 tools/testing/selftests/kvm/.gitignore create mode 100644 tools/testing/selftests/kvm/Makefile create mode 100644 tools/testing/selftests/kvm/config create mode 100644 tools/testing/selftests/kvm/cr4_cpuid_sync_test.c create mode 100644 tools/testing/selftests/kvm/dirty_log_test.c create mode 100644 tools/testing/selftests/kvm/include/kvm_util.h create mode 100644 tools/testing/selftests/kvm/include/sparsebit.h create mode 100644 tools/testing/selftests/kvm/include/test_util.h create mode 100644 tools/testing/selftests/kvm/include/vmx.h create mode 100644 tools/testing/selftests/kvm/include/x86.h create mode 100644 tools/testing/selftests/kvm/lib/assert.c create mode 100644 tools/testing/selftests/kvm/lib/elf.c create mode 100644 tools/testing/selftests/kvm/lib/io.c create mode 100644 tools/testing/selftests/kvm/lib/kvm_util.c create mode 100644 tools/testing/selftests/kvm/lib/kvm_util_internal.h create mode 100644 tools/testing/selftests/kvm/lib/sparsebit.c create mode 100644 tools/testing/selftests/kvm/lib/vmx.c create mode 100644 tools/testing/selftests/kvm/lib/x86.c create mode 100644 tools/testing/selftests/kvm/platform_info_test.c create mode 100644 tools/testing/selftests/kvm/set_sregs_test.c create mode 100644 tools/testing/selftests/kvm/state_test.c create mode 100644 tools/testing/selftests/kvm/sync_regs_test.c create mode 100644 tools/testing/selftests/kvm/vmx_tsc_adjust_test.c create mode 100644 tools/testing/selftests/lib.mk create mode 100644 tools/testing/selftests/lib/Makefile create mode 100755 tools/testing/selftests/lib/bitmap.sh create mode 100644 tools/testing/selftests/lib/config create mode 100755 tools/testing/selftests/lib/prime_numbers.sh create mode 100755 tools/testing/selftests/lib/printf.sh create mode 100644 tools/testing/selftests/locking/Makefile create mode 100755 tools/testing/selftests/locking/ww_mutex.sh create mode 100644 tools/testing/selftests/media_tests/.gitignore create mode 100644 tools/testing/selftests/media_tests/Makefile create mode 100755 tools/testing/selftests/media_tests/bind_unbind_sample.sh create mode 100644 tools/testing/selftests/media_tests/media_device_open.c create mode 100644 tools/testing/selftests/media_tests/media_device_test.c create mode 100755 tools/testing/selftests/media_tests/open_loop_test.sh create mode 100644 tools/testing/selftests/media_tests/regression_test.txt create mode 100644 tools/testing/selftests/media_tests/video_device_test.c create mode 100644 tools/testing/selftests/membarrier/.gitignore create mode 100644 tools/testing/selftests/membarrier/Makefile create mode 100644 tools/testing/selftests/membarrier/membarrier_test.c create mode 100644 tools/testing/selftests/memfd/.gitignore create mode 100644 tools/testing/selftests/memfd/Makefile create mode 100644 tools/testing/selftests/memfd/common.c create mode 100644 tools/testing/selftests/memfd/common.h create mode 100644 tools/testing/selftests/memfd/config create mode 100644 tools/testing/selftests/memfd/fuse_mnt.c create mode 100644 tools/testing/selftests/memfd/fuse_test.c create mode 100644 tools/testing/selftests/memfd/memfd_test.c create mode 100755 tools/testing/selftests/memfd/run_fuse_test.sh create mode 100755 tools/testing/selftests/memfd/run_hugetlbfs_test.sh create mode 100644 tools/testing/selftests/memory-hotplug/Makefile create mode 100644 tools/testing/selftests/memory-hotplug/config create mode 100755 tools/testing/selftests/memory-hotplug/mem-on-off-test.sh create mode 100644 tools/testing/selftests/mount/.gitignore create mode 100644 tools/testing/selftests/mount/Makefile create mode 100644 tools/testing/selftests/mount/config create mode 100755 tools/testing/selftests/mount/run_tests.sh create mode 100644 tools/testing/selftests/mount/unprivileged-remount-test.c create mode 100644 tools/testing/selftests/mqueue/.gitignore create mode 100644 tools/testing/selftests/mqueue/Makefile create mode 100644 tools/testing/selftests/mqueue/mq_open_tests.c create mode 100644 tools/testing/selftests/mqueue/mq_perf_tests.c create mode 100644 tools/testing/selftests/net/.gitignore create mode 100644 tools/testing/selftests/net/Makefile create mode 100644 tools/testing/selftests/net/config create mode 100755 tools/testing/selftests/net/fib-onlink-tests.sh create mode 100755 tools/testing/selftests/net/fib_rule_tests.sh create mode 100755 tools/testing/selftests/net/fib_tests.sh create mode 100644 tools/testing/selftests/net/forwarding/.gitignore create mode 100644 tools/testing/selftests/net/forwarding/README create mode 100755 tools/testing/selftests/net/forwarding/bridge_port_isolation.sh create mode 100755 tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh create mode 100755 tools/testing/selftests/net/forwarding/bridge_vlan_unaware.sh create mode 100644 tools/testing/selftests/net/forwarding/config create mode 100644 tools/testing/selftests/net/forwarding/devlink_lib.sh create mode 100644 tools/testing/selftests/net/forwarding/forwarding.config.sample create mode 100755 tools/testing/selftests/net/forwarding/gre_multipath.sh create mode 100644 tools/testing/selftests/net/forwarding/lib.sh create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre.sh create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_bound.sh create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d.sh create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q.sh create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q_lag.sh create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_changes.sh create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_flower.sh create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_lag_lacp.sh create mode 100644 tools/testing/selftests/net/forwarding/mirror_gre_lib.sh create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_neigh.sh create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_nh.sh create mode 100644 tools/testing/selftests/net/forwarding/mirror_gre_topo_lib.sh create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_vlan.sh create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_vlan_bridge_1q.sh create mode 100644 tools/testing/selftests/net/forwarding/mirror_lib.sh create mode 100644 tools/testing/selftests/net/forwarding/mirror_topo_lib.sh create mode 100755 tools/testing/selftests/net/forwarding/mirror_vlan.sh create mode 100755 tools/testing/selftests/net/forwarding/router.sh create mode 100755 tools/testing/selftests/net/forwarding/router_bridge.sh create mode 100755 tools/testing/selftests/net/forwarding/router_bridge_vlan.sh create mode 100755 tools/testing/selftests/net/forwarding/router_broadcast.sh create mode 100755 tools/testing/selftests/net/forwarding/router_multipath.sh create mode 100755 tools/testing/selftests/net/forwarding/tc_actions.sh create mode 100755 tools/testing/selftests/net/forwarding/tc_chains.sh create mode 100644 tools/testing/selftests/net/forwarding/tc_common.sh create mode 100755 tools/testing/selftests/net/forwarding/tc_flower.sh create mode 100755 tools/testing/selftests/net/forwarding/tc_shblocks.sh create mode 100755 tools/testing/selftests/net/in_netns.sh create mode 100755 tools/testing/selftests/net/ip6_gre_headroom.sh create mode 100644 tools/testing/selftests/net/msg_zerocopy.c create mode 100755 tools/testing/selftests/net/msg_zerocopy.sh create mode 100755 tools/testing/selftests/net/netdevice.sh create mode 100755 tools/testing/selftests/net/pmtu.sh create mode 100644 tools/testing/selftests/net/psock_fanout.c create mode 100644 tools/testing/selftests/net/psock_lib.h create mode 100644 tools/testing/selftests/net/psock_snd.c create mode 100755 tools/testing/selftests/net/psock_snd.sh create mode 100644 tools/testing/selftests/net/psock_tpacket.c create mode 100644 tools/testing/selftests/net/reuseaddr_conflict.c create mode 100644 tools/testing/selftests/net/reuseport_bpf.c create mode 100644 tools/testing/selftests/net/reuseport_bpf_cpu.c create mode 100644 tools/testing/selftests/net/reuseport_bpf_numa.c create mode 100644 tools/testing/selftests/net/reuseport_dualstack.c create mode 100755 tools/testing/selftests/net/rtnetlink.sh create mode 100755 tools/testing/selftests/net/run_afpackettests create mode 100755 tools/testing/selftests/net/run_netsocktests create mode 100644 tools/testing/selftests/net/socket.c create mode 100644 tools/testing/selftests/net/tcp_inq.c create mode 100644 tools/testing/selftests/net/tcp_mmap.c create mode 100755 tools/testing/selftests/net/test_bpf.sh create mode 100644 tools/testing/selftests/net/tls.c create mode 100644 tools/testing/selftests/net/udpgso.c create mode 100755 tools/testing/selftests/net/udpgso.sh create mode 100755 tools/testing/selftests/net/udpgso_bench.sh create mode 100644 tools/testing/selftests/net/udpgso_bench_rx.c create mode 100644 tools/testing/selftests/net/udpgso_bench_tx.c create mode 100644 tools/testing/selftests/netfilter/Makefile create mode 100644 tools/testing/selftests/netfilter/config create mode 100755 tools/testing/selftests/netfilter/conntrack_icmp_related.sh create mode 100755 tools/testing/selftests/netfilter/nft_nat.sh create mode 100755 tools/testing/selftests/netfilter/nft_trans_stress.sh create mode 100644 tools/testing/selftests/networking/timestamping/.gitignore create mode 100644 tools/testing/selftests/networking/timestamping/Makefile create mode 100644 tools/testing/selftests/networking/timestamping/hwtstamp_config.c create mode 100644 tools/testing/selftests/networking/timestamping/rxtimestamp.c create mode 100644 tools/testing/selftests/networking/timestamping/timestamping.c create mode 100644 tools/testing/selftests/networking/timestamping/txtimestamp.c create mode 100644 tools/testing/selftests/nsfs/.gitignore create mode 100644 tools/testing/selftests/nsfs/Makefile create mode 100644 tools/testing/selftests/nsfs/config create mode 100644 tools/testing/selftests/nsfs/owner.c create mode 100644 tools/testing/selftests/nsfs/pidns.c create mode 100755 tools/testing/selftests/ntb/ntb_test.sh create mode 100644 tools/testing/selftests/powerpc/Makefile create mode 100644 tools/testing/selftests/powerpc/alignment/.gitignore create mode 100644 tools/testing/selftests/powerpc/alignment/Makefile create mode 100644 tools/testing/selftests/powerpc/alignment/alignment_handler.c create mode 100644 tools/testing/selftests/powerpc/alignment/copy_first_unaligned.c create mode 100644 tools/testing/selftests/powerpc/benchmarks/.gitignore create mode 100644 tools/testing/selftests/powerpc/benchmarks/Makefile create mode 100644 tools/testing/selftests/powerpc/benchmarks/context_switch.c create mode 100644 tools/testing/selftests/powerpc/benchmarks/exec_target.c create mode 100644 tools/testing/selftests/powerpc/benchmarks/fork.c create mode 100644 tools/testing/selftests/powerpc/benchmarks/futex_bench.c create mode 100644 tools/testing/selftests/powerpc/benchmarks/gettimeofday.c create mode 100644 tools/testing/selftests/powerpc/benchmarks/mmap_bench.c create mode 100644 tools/testing/selftests/powerpc/benchmarks/null_syscall.c create mode 100644 tools/testing/selftests/powerpc/cache_shape/.gitignore create mode 100644 tools/testing/selftests/powerpc/cache_shape/Makefile create mode 100644 tools/testing/selftests/powerpc/cache_shape/cache_shape.c create mode 100644 tools/testing/selftests/powerpc/copyloops/.gitignore create mode 100644 tools/testing/selftests/powerpc/copyloops/Makefile create mode 100644 tools/testing/selftests/powerpc/copyloops/asm/asm-compat.h create mode 100644 tools/testing/selftests/powerpc/copyloops/asm/export.h create mode 100644 tools/testing/selftests/powerpc/copyloops/asm/feature-fixups.h create mode 100644 tools/testing/selftests/powerpc/copyloops/asm/ppc_asm.h create mode 100644 tools/testing/selftests/powerpc/copyloops/asm/processor.h create mode 100644 tools/testing/selftests/powerpc/copyloops/copy_tofrom_user_reference.S create mode 120000 tools/testing/selftests/powerpc/copyloops/copyuser_64.S create mode 120000 tools/testing/selftests/powerpc/copyloops/copyuser_power7.S create mode 100644 tools/testing/selftests/powerpc/copyloops/exc_validate.c create mode 120000 tools/testing/selftests/powerpc/copyloops/memcpy_64.S create mode 120000 tools/testing/selftests/powerpc/copyloops/memcpy_power7.S create mode 100644 tools/testing/selftests/powerpc/copyloops/stubs.S create mode 100644 tools/testing/selftests/powerpc/copyloops/validate.c create mode 100644 tools/testing/selftests/powerpc/dscr/.gitignore create mode 100644 tools/testing/selftests/powerpc/dscr/Makefile create mode 100644 tools/testing/selftests/powerpc/dscr/dscr.h create mode 100644 tools/testing/selftests/powerpc/dscr/dscr_default_test.c create mode 100644 tools/testing/selftests/powerpc/dscr/dscr_explicit_test.c create mode 100644 tools/testing/selftests/powerpc/dscr/dscr_inherit_exec_test.c create mode 100644 tools/testing/selftests/powerpc/dscr/dscr_inherit_test.c create mode 100644 tools/testing/selftests/powerpc/dscr/dscr_sysfs_test.c create mode 100644 tools/testing/selftests/powerpc/dscr/dscr_sysfs_thread_test.c create mode 100644 tools/testing/selftests/powerpc/dscr/dscr_user_test.c create mode 100644 tools/testing/selftests/powerpc/harness.c create mode 100644 tools/testing/selftests/powerpc/include/basic_asm.h create mode 100644 tools/testing/selftests/powerpc/include/fpu_asm.h create mode 100644 tools/testing/selftests/powerpc/include/gpr_asm.h create mode 100644 tools/testing/selftests/powerpc/include/instructions.h create mode 100644 tools/testing/selftests/powerpc/include/reg.h create mode 100644 tools/testing/selftests/powerpc/include/subunit.h create mode 100644 tools/testing/selftests/powerpc/include/utils.h create mode 100644 tools/testing/selftests/powerpc/include/vmx_asm.h create mode 100644 tools/testing/selftests/powerpc/include/vsx_asm.h create mode 100644 tools/testing/selftests/powerpc/lib/reg.S create mode 100644 tools/testing/selftests/powerpc/math/.gitignore create mode 100644 tools/testing/selftests/powerpc/math/Makefile create mode 100644 tools/testing/selftests/powerpc/math/fpu_asm.S create mode 100644 tools/testing/selftests/powerpc/math/fpu_preempt.c create mode 100644 tools/testing/selftests/powerpc/math/fpu_signal.c create mode 100644 tools/testing/selftests/powerpc/math/fpu_syscall.c create mode 100644 tools/testing/selftests/powerpc/math/vmx_asm.S create mode 100644 tools/testing/selftests/powerpc/math/vmx_preempt.c create mode 100644 tools/testing/selftests/powerpc/math/vmx_signal.c create mode 100644 tools/testing/selftests/powerpc/math/vmx_syscall.c create mode 100644 tools/testing/selftests/powerpc/math/vsx_asm.S create mode 100644 tools/testing/selftests/powerpc/math/vsx_preempt.c create mode 100644 tools/testing/selftests/powerpc/mm/.gitignore create mode 100644 tools/testing/selftests/powerpc/mm/Makefile create mode 100644 tools/testing/selftests/powerpc/mm/hugetlb_vs_thp_test.c create mode 100644 tools/testing/selftests/powerpc/mm/prot_sao.c create mode 100644 tools/testing/selftests/powerpc/mm/segv_errors.c create mode 100644 tools/testing/selftests/powerpc/mm/subpage_prot.c create mode 100644 tools/testing/selftests/powerpc/mm/tlbie_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/.gitignore create mode 100644 tools/testing/selftests/powerpc/pmu/Makefile create mode 100644 tools/testing/selftests/powerpc/pmu/count_instructions.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/.gitignore create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/Makefile create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/busy_loop.S create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/close_clears_pmcc_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/cpu_event_pinned_vs_ebb_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/cpu_event_vs_ebb_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/ebb.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/ebb.h create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/ebb_handler.S create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/ebb_on_child_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/ebb_vs_cpu_event_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/event_attributes_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/fixed_instruction_loop.S create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/fork_cleanup_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/instruction_count_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/lost_exception_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/multi_counter_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/no_handler_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/reg_access_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/task_event_pinned_vs_ebb_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/task_event_vs_ebb_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/trace.c create mode 100644 tools/testing/selftests/powerpc/pmu/ebb/trace.h create mode 100644 tools/testing/selftests/powerpc/pmu/event.c create mode 100644 tools/testing/selftests/powerpc/pmu/event.h create mode 100644 tools/testing/selftests/powerpc/pmu/l3_bank_test.c create mode 100644 tools/testing/selftests/powerpc/pmu/lib.c create mode 100644 tools/testing/selftests/powerpc/pmu/lib.h create mode 100644 tools/testing/selftests/powerpc/pmu/loop.S create mode 100644 tools/testing/selftests/powerpc/pmu/per_event_excludes.c create mode 100644 tools/testing/selftests/powerpc/primitives/.gitignore create mode 100644 tools/testing/selftests/powerpc/primitives/Makefile create mode 120000 tools/testing/selftests/powerpc/primitives/asm/asm-compat.h create mode 120000 tools/testing/selftests/powerpc/primitives/asm/asm-const.h create mode 120000 tools/testing/selftests/powerpc/primitives/asm/feature-fixups.h create mode 100644 tools/testing/selftests/powerpc/primitives/asm/firmware.h create mode 100644 tools/testing/selftests/powerpc/primitives/asm/ppc-opcode.h create mode 120000 tools/testing/selftests/powerpc/primitives/asm/ppc_asm.h create mode 100644 tools/testing/selftests/powerpc/primitives/asm/processor.h create mode 100644 tools/testing/selftests/powerpc/primitives/linux/stringify.h create mode 100644 tools/testing/selftests/powerpc/primitives/load_unaligned_zeropad.c create mode 120000 tools/testing/selftests/powerpc/primitives/word-at-a-time.h create mode 100644 tools/testing/selftests/powerpc/ptrace/.gitignore create mode 100644 tools/testing/selftests/powerpc/ptrace/Makefile create mode 100644 tools/testing/selftests/powerpc/ptrace/child.h create mode 100644 tools/testing/selftests/powerpc/ptrace/core-pkey.c create mode 100644 tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-gpr.c create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-gpr.h create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tar.c create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tar.h create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-gpr.c create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-gpr.c create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-tar.c create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-vsx.c create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-spr.c create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-tar.c create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-vsx.c create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-vsx.c create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-vsx.h create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace.h create mode 100755 tools/testing/selftests/powerpc/scripts/hmi.sh create mode 100644 tools/testing/selftests/powerpc/signal/.gitignore create mode 100644 tools/testing/selftests/powerpc/signal/Makefile create mode 100644 tools/testing/selftests/powerpc/signal/signal.S create mode 100644 tools/testing/selftests/powerpc/signal/signal.c create mode 100644 tools/testing/selftests/powerpc/signal/signal_tm.c create mode 100644 tools/testing/selftests/powerpc/stringloops/.gitignore create mode 100644 tools/testing/selftests/powerpc/stringloops/Makefile create mode 100644 tools/testing/selftests/powerpc/stringloops/asm/cache.h create mode 100644 tools/testing/selftests/powerpc/stringloops/asm/export.h create mode 100644 tools/testing/selftests/powerpc/stringloops/asm/ppc-opcode.h create mode 100644 tools/testing/selftests/powerpc/stringloops/asm/ppc_asm.h create mode 100644 tools/testing/selftests/powerpc/stringloops/memcmp.c create mode 120000 tools/testing/selftests/powerpc/stringloops/memcmp_32.S create mode 120000 tools/testing/selftests/powerpc/stringloops/memcmp_64.S create mode 100644 tools/testing/selftests/powerpc/stringloops/string.c create mode 100644 tools/testing/selftests/powerpc/stringloops/strlen.c create mode 120000 tools/testing/selftests/powerpc/stringloops/strlen_32.S create mode 100644 tools/testing/selftests/powerpc/switch_endian/.gitignore create mode 100644 tools/testing/selftests/powerpc/switch_endian/Makefile create mode 100644 tools/testing/selftests/powerpc/switch_endian/check.S create mode 100644 tools/testing/selftests/powerpc/switch_endian/common.h create mode 100644 tools/testing/selftests/powerpc/switch_endian/switch_endian_test.S create mode 100644 tools/testing/selftests/powerpc/syscalls/.gitignore create mode 100644 tools/testing/selftests/powerpc/syscalls/Makefile create mode 100644 tools/testing/selftests/powerpc/syscalls/ipc.h create mode 100644 tools/testing/selftests/powerpc/syscalls/ipc_unmuxed.c create mode 100644 tools/testing/selftests/powerpc/tm/.gitignore create mode 100644 tools/testing/selftests/powerpc/tm/Makefile create mode 100644 tools/testing/selftests/powerpc/tm/tm-exec.c create mode 100644 tools/testing/selftests/powerpc/tm/tm-fork.c create mode 100644 tools/testing/selftests/powerpc/tm/tm-resched-dscr.c create mode 100644 tools/testing/selftests/powerpc/tm/tm-signal-context-chk-fpu.c create mode 100644 tools/testing/selftests/powerpc/tm/tm-signal-context-chk-gpr.c create mode 100644 tools/testing/selftests/powerpc/tm/tm-signal-context-chk-vmx.c create mode 100644 tools/testing/selftests/powerpc/tm/tm-signal-context-chk-vsx.c create mode 100644 tools/testing/selftests/powerpc/tm/tm-signal-msr-resv.c create mode 100644 tools/testing/selftests/powerpc/tm/tm-signal-stack.c create mode 100644 tools/testing/selftests/powerpc/tm/tm-signal.S create mode 100644 tools/testing/selftests/powerpc/tm/tm-sigreturn.c create mode 100644 tools/testing/selftests/powerpc/tm/tm-syscall-asm.S create mode 100644 tools/testing/selftests/powerpc/tm/tm-syscall.c create mode 100644 tools/testing/selftests/powerpc/tm/tm-tar.c create mode 100644 tools/testing/selftests/powerpc/tm/tm-tmspr.c create mode 100644 tools/testing/selftests/powerpc/tm/tm-trap.c create mode 100644 tools/testing/selftests/powerpc/tm/tm-unavailable.c create mode 100644 tools/testing/selftests/powerpc/tm/tm-vmx-unavail.c create mode 100644 tools/testing/selftests/powerpc/tm/tm-vmxcopy.c create mode 100644 tools/testing/selftests/powerpc/tm/tm.h create mode 100644 tools/testing/selftests/powerpc/utils.c create mode 100644 tools/testing/selftests/powerpc/vphn/.gitignore create mode 100644 tools/testing/selftests/powerpc/vphn/Makefile create mode 100644 tools/testing/selftests/powerpc/vphn/test-vphn.c create mode 120000 tools/testing/selftests/powerpc/vphn/vphn.c create mode 120000 tools/testing/selftests/powerpc/vphn/vphn.h create mode 100644 tools/testing/selftests/prctl/.gitignore create mode 100644 tools/testing/selftests/prctl/Makefile create mode 100644 tools/testing/selftests/prctl/disable-tsc-ctxt-sw-stress-test.c create mode 100644 tools/testing/selftests/prctl/disable-tsc-on-off-stress-test.c create mode 100644 tools/testing/selftests/prctl/disable-tsc-test.c create mode 100644 tools/testing/selftests/proc/.gitignore create mode 100644 tools/testing/selftests/proc/Makefile create mode 100644 tools/testing/selftests/proc/config create mode 100644 tools/testing/selftests/proc/fd-001-lookup.c create mode 100644 tools/testing/selftests/proc/fd-002-posix-eq.c create mode 100644 tools/testing/selftests/proc/fd-003-kthread.c create mode 100644 tools/testing/selftests/proc/proc-loadavg-001.c create mode 100644 tools/testing/selftests/proc/proc-self-map-files-001.c create mode 100644 tools/testing/selftests/proc/proc-self-map-files-002.c create mode 100644 tools/testing/selftests/proc/proc-self-syscall.c create mode 100644 tools/testing/selftests/proc/proc-self-wchan.c create mode 100644 tools/testing/selftests/proc/proc-uptime-001.c create mode 100644 tools/testing/selftests/proc/proc-uptime-002.c create mode 100644 tools/testing/selftests/proc/proc-uptime.h create mode 100644 tools/testing/selftests/proc/proc.h create mode 100644 tools/testing/selftests/proc/read.c create mode 100644 tools/testing/selftests/proc/self.c create mode 100644 tools/testing/selftests/proc/setns-dcache.c create mode 100644 tools/testing/selftests/proc/thread-self.c create mode 100644 tools/testing/selftests/pstore/.gitignore create mode 100644 tools/testing/selftests/pstore/Makefile create mode 100755 tools/testing/selftests/pstore/common_tests create mode 100644 tools/testing/selftests/pstore/config create mode 100755 tools/testing/selftests/pstore/pstore_crash_test create mode 100755 tools/testing/selftests/pstore/pstore_post_reboot_tests create mode 100755 tools/testing/selftests/pstore/pstore_tests create mode 100644 tools/testing/selftests/ptp/.gitignore create mode 100644 tools/testing/selftests/ptp/Makefile create mode 100644 tools/testing/selftests/ptp/testptp.c create mode 100644 tools/testing/selftests/ptp/testptp.mk create mode 100644 tools/testing/selftests/ptrace/.gitignore create mode 100644 tools/testing/selftests/ptrace/Makefile create mode 100644 tools/testing/selftests/ptrace/peeksiginfo.c create mode 100644 tools/testing/selftests/rcutorture/.gitignore create mode 100755 tools/testing/selftests/rcutorture/bin/configNR_CPUS.sh create mode 100755 tools/testing/selftests/rcutorture/bin/config_override.sh create mode 100755 tools/testing/selftests/rcutorture/bin/configcheck.sh create mode 100755 tools/testing/selftests/rcutorture/bin/configinit.sh create mode 100755 tools/testing/selftests/rcutorture/bin/cpus2use.sh create mode 100644 tools/testing/selftests/rcutorture/bin/functions.sh create mode 100755 tools/testing/selftests/rcutorture/bin/jitter.sh create mode 100755 tools/testing/selftests/rcutorture/bin/kvm-build.sh create mode 100755 tools/testing/selftests/rcutorture/bin/kvm-find-errors.sh create mode 100755 tools/testing/selftests/rcutorture/bin/kvm-recheck-lock.sh create mode 100755 tools/testing/selftests/rcutorture/bin/kvm-recheck-rcu.sh create mode 100755 tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf-ftrace.sh create mode 100755 tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf.sh create mode 100755 tools/testing/selftests/rcutorture/bin/kvm-recheck.sh create mode 100755 tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh create mode 100755 tools/testing/selftests/rcutorture/bin/kvm.sh create mode 100755 tools/testing/selftests/rcutorture/bin/parse-build.sh create mode 100755 tools/testing/selftests/rcutorture/bin/parse-console.sh create mode 100644 tools/testing/selftests/rcutorture/configs/lock/BUSTED create mode 100644 tools/testing/selftests/rcutorture/configs/lock/BUSTED.boot create mode 100644 tools/testing/selftests/rcutorture/configs/lock/CFLIST create mode 100644 tools/testing/selftests/rcutorture/configs/lock/CFcommon create mode 100644 tools/testing/selftests/rcutorture/configs/lock/LOCK01 create mode 100644 tools/testing/selftests/rcutorture/configs/lock/LOCK02 create mode 100644 tools/testing/selftests/rcutorture/configs/lock/LOCK02.boot create mode 100644 tools/testing/selftests/rcutorture/configs/lock/LOCK03 create mode 100644 tools/testing/selftests/rcutorture/configs/lock/LOCK03.boot create mode 100644 tools/testing/selftests/rcutorture/configs/lock/LOCK04 create mode 100644 tools/testing/selftests/rcutorture/configs/lock/LOCK04.boot create mode 100644 tools/testing/selftests/rcutorture/configs/lock/LOCK05 create mode 100644 tools/testing/selftests/rcutorture/configs/lock/LOCK05.boot create mode 100644 tools/testing/selftests/rcutorture/configs/lock/LOCK06 create mode 100644 tools/testing/selftests/rcutorture/configs/lock/LOCK06.boot create mode 100644 tools/testing/selftests/rcutorture/configs/lock/LOCK07 create mode 100644 tools/testing/selftests/rcutorture/configs/lock/LOCK07.boot create mode 100644 tools/testing/selftests/rcutorture/configs/lock/ver_functions.sh create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/BUSTED create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/BUSTED.boot create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/CFLIST create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/CFcommon create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/SRCU-N create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/SRCU-N.boot create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/SRCU-P create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/SRCU-P.boot create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/SRCU-t create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/SRCU-t.boot create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/SRCU-u create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/SRCU-u.boot create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TASKS01 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TASKS01.boot create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TASKS02 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TASKS02.boot create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TASKS03 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TASKS03.boot create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TINY01 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TINY02 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TINY02.boot create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE01 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE01.boot create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE02 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE03 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE03.boot create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE04 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE04.boot create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE05 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE05.boot create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE06 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE06.boot create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE07 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE07.boot create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE08 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE08.boot create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE09 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/ver_functions.sh create mode 100644 tools/testing/selftests/rcutorture/configs/rcuperf/CFLIST create mode 100644 tools/testing/selftests/rcutorture/configs/rcuperf/CFcommon create mode 100644 tools/testing/selftests/rcutorture/configs/rcuperf/TINY create mode 100644 tools/testing/selftests/rcutorture/configs/rcuperf/TREE create mode 100644 tools/testing/selftests/rcutorture/configs/rcuperf/TREE54 create mode 100644 tools/testing/selftests/rcutorture/configs/rcuperf/ver_functions.sh create mode 100644 tools/testing/selftests/rcutorture/doc/TINY_RCU.txt create mode 100644 tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt create mode 100644 tools/testing/selftests/rcutorture/doc/initrd.txt create mode 100644 tools/testing/selftests/rcutorture/doc/rcu-test-image.txt create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/.gitignore create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/Makefile create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/empty_includes/linux/delay.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/empty_includes/linux/export.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/empty_includes/linux/mutex.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/empty_includes/linux/percpu.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/empty_includes/linux/preempt.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/empty_includes/linux/rcupdate.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/empty_includes/linux/sched.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/empty_includes/linux/smp.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/empty_includes/linux/workqueue.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/empty_includes/uapi/linux/types.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/include/linux/.gitignore create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/include/linux/kconfig.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/include/linux/types.h create mode 100755 tools/testing/selftests/rcutorture/formal/srcu-cbmc/modify_srcu.awk create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/assume.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/barriers.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/bug_on.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/combined_source.c create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/config.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/include_srcu.c create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/int_typedefs.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/locks.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/misc.c create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/misc.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/percpu.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/preempt.c create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/preempt.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/simple_sync_srcu.c create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/workqueues.h create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/tests/store_buffering/.gitignore create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/tests/store_buffering/Makefile create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/tests/store_buffering/assert_end.fail create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/tests/store_buffering/force.fail create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/tests/store_buffering/force2.fail create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/tests/store_buffering/force3.fail create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/tests/store_buffering/main.pass create mode 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/tests/store_buffering/test.c create mode 100755 tools/testing/selftests/rcutorture/formal/srcu-cbmc/tests/test_script.sh create mode 100644 tools/testing/selftests/rseq/.gitignore create mode 100644 tools/testing/selftests/rseq/Makefile create mode 100644 tools/testing/selftests/rseq/basic_percpu_ops_test.c create mode 100644 tools/testing/selftests/rseq/basic_test.c create mode 100644 tools/testing/selftests/rseq/param_test.c create mode 100644 tools/testing/selftests/rseq/rseq-arm.h create mode 100644 tools/testing/selftests/rseq/rseq-arm64.h create mode 100644 tools/testing/selftests/rseq/rseq-mips.h create mode 100644 tools/testing/selftests/rseq/rseq-ppc.h create mode 100644 tools/testing/selftests/rseq/rseq-s390.h create mode 100644 tools/testing/selftests/rseq/rseq-skip.h create mode 100644 tools/testing/selftests/rseq/rseq-x86.h create mode 100644 tools/testing/selftests/rseq/rseq.c create mode 100644 tools/testing/selftests/rseq/rseq.h create mode 100755 tools/testing/selftests/rseq/run_param_test.sh create mode 100644 tools/testing/selftests/rseq/settings create mode 100644 tools/testing/selftests/rtc/.gitignore create mode 100644 tools/testing/selftests/rtc/Makefile create mode 100644 tools/testing/selftests/rtc/rtctest.c create mode 100644 tools/testing/selftests/rtc/setdate.c create mode 100644 tools/testing/selftests/seccomp/.gitignore create mode 100644 tools/testing/selftests/seccomp/Makefile create mode 100644 tools/testing/selftests/seccomp/config create mode 100644 tools/testing/selftests/seccomp/seccomp_benchmark.c create mode 100644 tools/testing/selftests/seccomp/seccomp_bpf.c create mode 100644 tools/testing/selftests/sigaltstack/.gitignore create mode 100644 tools/testing/selftests/sigaltstack/Makefile create mode 100644 tools/testing/selftests/sigaltstack/sas.c create mode 100644 tools/testing/selftests/size/.gitignore create mode 100644 tools/testing/selftests/size/Makefile create mode 100644 tools/testing/selftests/size/get_size.c create mode 100644 tools/testing/selftests/sparc64/Makefile create mode 100644 tools/testing/selftests/sparc64/drivers/.gitignore create mode 100644 tools/testing/selftests/sparc64/drivers/Makefile create mode 100644 tools/testing/selftests/sparc64/drivers/adi-test.c create mode 100755 tools/testing/selftests/sparc64/drivers/drivers_test.sh create mode 100755 tools/testing/selftests/sparc64/run.sh create mode 100644 tools/testing/selftests/splice/.gitignore create mode 100644 tools/testing/selftests/splice/Makefile create mode 100644 tools/testing/selftests/splice/default_file_splice_read.c create mode 100755 tools/testing/selftests/splice/default_file_splice_read.sh create mode 100644 tools/testing/selftests/static_keys/Makefile create mode 100644 tools/testing/selftests/static_keys/config create mode 100755 tools/testing/selftests/static_keys/test_static_keys.sh create mode 100644 tools/testing/selftests/sync/.gitignore create mode 100644 tools/testing/selftests/sync/Makefile create mode 100644 tools/testing/selftests/sync/config create mode 100644 tools/testing/selftests/sync/sw_sync.h create mode 100644 tools/testing/selftests/sync/sync.c create mode 100644 tools/testing/selftests/sync/sync.h create mode 100644 tools/testing/selftests/sync/sync_alloc.c create mode 100644 tools/testing/selftests/sync/sync_fence.c create mode 100644 tools/testing/selftests/sync/sync_merge.c create mode 100644 tools/testing/selftests/sync/sync_stress_consumer.c create mode 100644 tools/testing/selftests/sync/sync_stress_merge.c create mode 100644 tools/testing/selftests/sync/sync_stress_parallelism.c create mode 100644 tools/testing/selftests/sync/sync_test.c create mode 100644 tools/testing/selftests/sync/sync_wait.c create mode 100644 tools/testing/selftests/sync/synctest.h create mode 100644 tools/testing/selftests/sysctl/Makefile create mode 100644 tools/testing/selftests/sysctl/config create mode 100755 tools/testing/selftests/sysctl/sysctl.sh create mode 100644 tools/testing/selftests/tc-testing/.gitignore create mode 100644 tools/testing/selftests/tc-testing/README create mode 100644 tools/testing/selftests/tc-testing/TODO.txt create mode 100644 tools/testing/selftests/tc-testing/TdcPlugin.py create mode 100644 tools/testing/selftests/tc-testing/bpf/Makefile create mode 100644 tools/testing/selftests/tc-testing/bpf/action.c create mode 100644 tools/testing/selftests/tc-testing/config create mode 100644 tools/testing/selftests/tc-testing/creating-plugins/AddingPlugins.txt create mode 100644 tools/testing/selftests/tc-testing/creating-testcases/AddingTestCases.txt create mode 100644 tools/testing/selftests/tc-testing/creating-testcases/example.json create mode 100644 tools/testing/selftests/tc-testing/creating-testcases/template.json create mode 100644 tools/testing/selftests/tc-testing/plugin-lib/README-PLUGINS create mode 100644 tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py create mode 100644 tools/testing/selftests/tc-testing/plugin-lib/rootPlugin.py create mode 100644 tools/testing/selftests/tc-testing/plugin-lib/valgrindPlugin.py create mode 100644 tools/testing/selftests/tc-testing/plugins/__init__.py create mode 100644 tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json create mode 100644 tools/testing/selftests/tc-testing/tc-tests/actions/connmark.json create mode 100644 tools/testing/selftests/tc-testing/tc-tests/actions/csum.json create mode 100644 tools/testing/selftests/tc-testing/tc-tests/actions/gact.json create mode 100644 tools/testing/selftests/tc-testing/tc-tests/actions/ife.json create mode 100644 tools/testing/selftests/tc-testing/tc-tests/actions/mirred.json create mode 100644 tools/testing/selftests/tc-testing/tc-tests/actions/nat.json create mode 100644 tools/testing/selftests/tc-testing/tc-tests/actions/police.json create mode 100644 tools/testing/selftests/tc-testing/tc-tests/actions/sample.json create mode 100644 tools/testing/selftests/tc-testing/tc-tests/actions/simple.json create mode 100644 tools/testing/selftests/tc-testing/tc-tests/actions/skbedit.json create mode 100644 tools/testing/selftests/tc-testing/tc-tests/actions/skbmod.json create mode 100644 tools/testing/selftests/tc-testing/tc-tests/actions/tunnel_key.json create mode 100644 tools/testing/selftests/tc-testing/tc-tests/actions/vlan.json create mode 100644 tools/testing/selftests/tc-testing/tc-tests/filters/fw.json create mode 100644 tools/testing/selftests/tc-testing/tc-tests/filters/tests.json create mode 100755 tools/testing/selftests/tc-testing/tdc.py create mode 100755 tools/testing/selftests/tc-testing/tdc_batch.py create mode 100644 tools/testing/selftests/tc-testing/tdc_config.py create mode 100644 tools/testing/selftests/tc-testing/tdc_config_local_template.py create mode 100644 tools/testing/selftests/tc-testing/tdc_helper.py create mode 100644 tools/testing/selftests/timers/.gitignore create mode 100644 tools/testing/selftests/timers/Makefile create mode 100644 tools/testing/selftests/timers/adjtick.c create mode 100644 tools/testing/selftests/timers/alarmtimer-suspend.c create mode 100644 tools/testing/selftests/timers/change_skew.c create mode 100644 tools/testing/selftests/timers/clocksource-switch.c create mode 100644 tools/testing/selftests/timers/freq-step.c create mode 100644 tools/testing/selftests/timers/inconsistency-check.c create mode 100644 tools/testing/selftests/timers/leap-a-day.c create mode 100644 tools/testing/selftests/timers/leapcrash.c create mode 100644 tools/testing/selftests/timers/mqueue-lat.c create mode 100644 tools/testing/selftests/timers/nanosleep.c create mode 100644 tools/testing/selftests/timers/nsleep-lat.c create mode 100644 tools/testing/selftests/timers/posix_timers.c create mode 100644 tools/testing/selftests/timers/raw_skew.c create mode 100644 tools/testing/selftests/timers/rtcpie.c create mode 100644 tools/testing/selftests/timers/set-2038.c create mode 100644 tools/testing/selftests/timers/set-tai.c create mode 100644 tools/testing/selftests/timers/set-timer-lat.c create mode 100644 tools/testing/selftests/timers/set-tz.c create mode 100644 tools/testing/selftests/timers/skew_consistency.c create mode 100644 tools/testing/selftests/timers/threadtest.c create mode 100644 tools/testing/selftests/timers/valid-adjtimex.c create mode 100644 tools/testing/selftests/uevent/Makefile create mode 100644 tools/testing/selftests/uevent/config create mode 100644 tools/testing/selftests/uevent/uevent_filtering.c create mode 100644 tools/testing/selftests/user/Makefile create mode 100644 tools/testing/selftests/user/config create mode 100755 tools/testing/selftests/user/test_user_copy.sh create mode 100644 tools/testing/selftests/vDSO/.gitignore create mode 100644 tools/testing/selftests/vDSO/Makefile create mode 100644 tools/testing/selftests/vDSO/parse_vdso.c create mode 100644 tools/testing/selftests/vDSO/vdso_standalone_test_x86.c create mode 100644 tools/testing/selftests/vDSO/vdso_test.c create mode 100644 tools/testing/selftests/vm/.gitignore create mode 100644 tools/testing/selftests/vm/Makefile create mode 100644 tools/testing/selftests/vm/compaction_test.c create mode 100644 tools/testing/selftests/vm/config create mode 100644 tools/testing/selftests/vm/gup_benchmark.c create mode 100644 tools/testing/selftests/vm/hugepage-mmap.c create mode 100644 tools/testing/selftests/vm/hugepage-shm.c create mode 100644 tools/testing/selftests/vm/map_hugetlb.c create mode 100644 tools/testing/selftests/vm/map_populate.c create mode 100644 tools/testing/selftests/vm/mlock-random-test.c create mode 100644 tools/testing/selftests/vm/mlock2-tests.c create mode 100644 tools/testing/selftests/vm/mlock2.h create mode 100644 tools/testing/selftests/vm/on-fault-limit.c create mode 100755 tools/testing/selftests/vm/run_vmtests create mode 100644 tools/testing/selftests/vm/thuge-gen.c create mode 100644 tools/testing/selftests/vm/transhuge-stress.c create mode 100644 tools/testing/selftests/vm/userfaultfd.c create mode 100644 tools/testing/selftests/vm/va_128TBswitch.c create mode 100644 tools/testing/selftests/vm/virtual_address_range.c create mode 100644 tools/testing/selftests/watchdog/.gitignore create mode 100644 tools/testing/selftests/watchdog/Makefile create mode 100644 tools/testing/selftests/watchdog/watchdog-test.c create mode 100644 tools/testing/selftests/x86/.gitignore create mode 100644 tools/testing/selftests/x86/Makefile create mode 100755 tools/testing/selftests/x86/check_cc.sh create mode 100644 tools/testing/selftests/x86/check_initial_reg_state.c create mode 100644 tools/testing/selftests/x86/entry_from_vm86.c create mode 100644 tools/testing/selftests/x86/fsgsbase.c create mode 100644 tools/testing/selftests/x86/ioperm.c create mode 100644 tools/testing/selftests/x86/iopl.c create mode 100644 tools/testing/selftests/x86/ldt_gdt.c create mode 100644 tools/testing/selftests/x86/mov_ss_trap.c create mode 100644 tools/testing/selftests/x86/mpx-debug.h create mode 100644 tools/testing/selftests/x86/mpx-dig.c create mode 100644 tools/testing/selftests/x86/mpx-hw.h create mode 100644 tools/testing/selftests/x86/mpx-mini-test.c create mode 100644 tools/testing/selftests/x86/mpx-mm.h create mode 100644 tools/testing/selftests/x86/pkey-helpers.h create mode 100644 tools/testing/selftests/x86/protection_keys.c create mode 100644 tools/testing/selftests/x86/ptrace_syscall.c create mode 100644 tools/testing/selftests/x86/raw_syscall_helper_32.S create mode 100644 tools/testing/selftests/x86/sigreturn.c create mode 100644 tools/testing/selftests/x86/single_step_syscall.c create mode 100644 tools/testing/selftests/x86/syscall_arg_fault.c create mode 100644 tools/testing/selftests/x86/syscall_nt.c create mode 100644 tools/testing/selftests/x86/sysret_rip.c create mode 100644 tools/testing/selftests/x86/sysret_ss_attrs.c create mode 100644 tools/testing/selftests/x86/test_FCMOV.c create mode 100644 tools/testing/selftests/x86/test_FCOMI.c create mode 100644 tools/testing/selftests/x86/test_FISTTP.c create mode 100644 tools/testing/selftests/x86/test_mremap_vdso.c create mode 100644 tools/testing/selftests/x86/test_syscall_vdso.c create mode 100644 tools/testing/selftests/x86/test_vdso.c create mode 100644 tools/testing/selftests/x86/test_vsyscall.c create mode 100644 tools/testing/selftests/x86/thunks.S create mode 100644 tools/testing/selftests/x86/thunks_32.S create mode 100644 tools/testing/selftests/x86/trivial_32bit_program.c create mode 100644 tools/testing/selftests/x86/trivial_64bit_program.c create mode 100644 tools/testing/selftests/x86/trivial_program.c create mode 100644 tools/testing/selftests/x86/unwind_vdso.c create mode 100644 tools/testing/selftests/x86/vdso_restorer.c create mode 100644 tools/testing/selftests/zram/Makefile create mode 100644 tools/testing/selftests/zram/README create mode 100644 tools/testing/selftests/zram/config create mode 100755 tools/testing/selftests/zram/zram.sh create mode 100755 tools/testing/selftests/zram/zram01.sh create mode 100755 tools/testing/selftests/zram/zram02.sh create mode 100755 tools/testing/selftests/zram/zram_lib.sh create mode 100644 tools/testing/vsock/.gitignore create mode 100644 tools/testing/vsock/Makefile create mode 100644 tools/testing/vsock/README create mode 100644 tools/testing/vsock/control.c create mode 100644 tools/testing/vsock/control.h create mode 100644 tools/testing/vsock/timeout.c create mode 100644 tools/testing/vsock/timeout.h create mode 100644 tools/testing/vsock/vsock_diag_test.c create mode 100644 tools/thermal/tmon/.gitignore create mode 100644 tools/thermal/tmon/Makefile create mode 100644 tools/thermal/tmon/README create mode 100644 tools/thermal/tmon/pid.c create mode 100644 tools/thermal/tmon/sysfs.c create mode 100644 tools/thermal/tmon/tmon.8 create mode 100644 tools/thermal/tmon/tmon.c create mode 100644 tools/thermal/tmon/tmon.h create mode 100644 tools/thermal/tmon/tui.c create mode 100755 tools/time/udelay_test.sh create mode 100644 tools/usb/.gitignore create mode 100644 tools/usb/Makefile create mode 100644 tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c create mode 100644 tools/usb/ffs-aio-example/multibuff/host_app/Makefile create mode 100644 tools/usb/ffs-aio-example/multibuff/host_app/test.c create mode 100644 tools/usb/ffs-aio-example/simple/device_app/aio_simple.c create mode 100644 tools/usb/ffs-aio-example/simple/host_app/Makefile create mode 100644 tools/usb/ffs-aio-example/simple/host_app/test.c create mode 100644 tools/usb/ffs-test.c create mode 100644 tools/usb/hcd-tests.sh create mode 100644 tools/usb/testusb.c create mode 100644 tools/usb/usbip/.gitignore create mode 100644 tools/usb/usbip/AUTHORS create mode 100644 tools/usb/usbip/COPYING create mode 100644 tools/usb/usbip/INSTALL create mode 100644 tools/usb/usbip/Makefile.am create mode 100644 tools/usb/usbip/README create mode 100755 tools/usb/usbip/autogen.sh create mode 100755 tools/usb/usbip/cleanup.sh create mode 100644 tools/usb/usbip/configure.ac create mode 100644 tools/usb/usbip/doc/usbip.8 create mode 100644 tools/usb/usbip/doc/usbipd.8 create mode 100644 tools/usb/usbip/libsrc/Makefile.am create mode 100644 tools/usb/usbip/libsrc/list.h create mode 100644 tools/usb/usbip/libsrc/names.c create mode 100644 tools/usb/usbip/libsrc/names.h create mode 100644 tools/usb/usbip/libsrc/sysfs_utils.c create mode 100644 tools/usb/usbip/libsrc/sysfs_utils.h create mode 100644 tools/usb/usbip/libsrc/usbip_common.c create mode 100644 tools/usb/usbip/libsrc/usbip_common.h create mode 100644 tools/usb/usbip/libsrc/usbip_device_driver.c create mode 100644 tools/usb/usbip/libsrc/usbip_device_driver.h create mode 100644 tools/usb/usbip/libsrc/usbip_host_common.c create mode 100644 tools/usb/usbip/libsrc/usbip_host_common.h create mode 100644 tools/usb/usbip/libsrc/usbip_host_driver.c create mode 100644 tools/usb/usbip/libsrc/usbip_host_driver.h create mode 100644 tools/usb/usbip/libsrc/vhci_driver.c create mode 100644 tools/usb/usbip/libsrc/vhci_driver.h create mode 100644 tools/usb/usbip/src/Makefile.am create mode 100644 tools/usb/usbip/src/usbip.c create mode 100644 tools/usb/usbip/src/usbip.h create mode 100644 tools/usb/usbip/src/usbip_attach.c create mode 100644 tools/usb/usbip/src/usbip_bind.c create mode 100644 tools/usb/usbip/src/usbip_detach.c create mode 100644 tools/usb/usbip/src/usbip_list.c create mode 100644 tools/usb/usbip/src/usbip_network.c create mode 100644 tools/usb/usbip/src/usbip_network.h create mode 100644 tools/usb/usbip/src/usbip_port.c create mode 100644 tools/usb/usbip/src/usbip_unbind.c create mode 100644 tools/usb/usbip/src/usbipd.c create mode 100644 tools/usb/usbip/src/utils.c create mode 100644 tools/usb/usbip/src/utils.h create mode 100755 tools/usb/usbip/vudc/vudc_server_example.sh create mode 100644 tools/virtio/.gitignore create mode 100644 tools/virtio/Makefile create mode 100644 tools/virtio/asm/barrier.h create mode 100644 tools/virtio/linux/bug.h create mode 100644 tools/virtio/linux/compiler.h create mode 100644 tools/virtio/linux/device.h create mode 100644 tools/virtio/linux/dma-mapping.h create mode 100644 tools/virtio/linux/err.h create mode 100644 tools/virtio/linux/export.h create mode 100644 tools/virtio/linux/hrtimer.h create mode 100644 tools/virtio/linux/irqreturn.h create mode 100644 tools/virtio/linux/kernel.h create mode 100644 tools/virtio/linux/kmemleak.h create mode 100644 tools/virtio/linux/module.h create mode 100644 tools/virtio/linux/printk.h create mode 100644 tools/virtio/linux/ratelimit.h create mode 100644 tools/virtio/linux/scatterlist.h create mode 100644 tools/virtio/linux/slab.h create mode 100644 tools/virtio/linux/thread_info.h create mode 100644 tools/virtio/linux/uaccess.h create mode 100644 tools/virtio/linux/uio.h create mode 100644 tools/virtio/linux/virtio.h create mode 100644 tools/virtio/linux/virtio_byteorder.h create mode 100644 tools/virtio/linux/virtio_config.h create mode 100644 tools/virtio/linux/virtio_ring.h create mode 100644 tools/virtio/linux/vringh.h create mode 100644 tools/virtio/ringtest/Makefile create mode 100644 tools/virtio/ringtest/README create mode 100644 tools/virtio/ringtest/main.c create mode 100644 tools/virtio/ringtest/main.h create mode 100644 tools/virtio/ringtest/noring.c create mode 100644 tools/virtio/ringtest/ptr_ring.c create mode 100644 tools/virtio/ringtest/ring.c create mode 100755 tools/virtio/ringtest/run-on-all.sh create mode 100644 tools/virtio/ringtest/virtio_ring_0_9.c create mode 100644 tools/virtio/ringtest/virtio_ring_inorder.c create mode 100644 tools/virtio/ringtest/virtio_ring_poll.c create mode 100644 tools/virtio/uapi/linux/uio.h create mode 100644 tools/virtio/uapi/linux/virtio_config.h create mode 100644 tools/virtio/uapi/linux/virtio_ring.h create mode 100644 tools/virtio/uapi/linux/virtio_types.h create mode 100644 tools/virtio/vhost_test/Makefile create mode 100644 tools/virtio/vhost_test/vhost_test.c create mode 100644 tools/virtio/virtio-trace/Makefile create mode 100644 tools/virtio/virtio-trace/README create mode 100644 tools/virtio/virtio-trace/trace-agent-ctl.c create mode 100644 tools/virtio/virtio-trace/trace-agent-rw.c create mode 100644 tools/virtio/virtio-trace/trace-agent.c create mode 100644 tools/virtio/virtio-trace/trace-agent.h create mode 100644 tools/virtio/virtio_test.c create mode 100644 tools/virtio/vringh_test.c create mode 100644 tools/vm/.gitignore create mode 100644 tools/vm/Makefile create mode 100644 tools/vm/page-types.c create mode 100644 tools/vm/page_owner_sort.c create mode 100644 tools/vm/slabinfo-gnuplot.sh create mode 100644 tools/vm/slabinfo.c create mode 100644 tools/wmi/Makefile create mode 100644 tools/wmi/dell-smbios-example.c (limited to 'tools') diff --git a/tools/Makefile b/tools/Makefile new file mode 100644 index 000000000..be02c8b90 --- /dev/null +++ b/tools/Makefile @@ -0,0 +1,179 @@ +# SPDX-License-Identifier: GPL-2.0 +# Some of the tools (perf) use same make variables +# as in kernel build. +export srctree= +export objtree= + +include scripts/Makefile.include + +help: + @echo 'Possible targets:' + @echo '' + @echo ' acpi - ACPI tools' + @echo ' cgroup - cgroup tools' + @echo ' cpupower - a tool for all things x86 CPU power' + @echo ' firewire - the userspace part of nosy, an IEEE-1394 traffic sniffer' + @echo ' freefall - laptop accelerometer program for disk protection' + @echo ' gpio - GPIO tools' + @echo ' hv - tools used when in Hyper-V clients' + @echo ' iio - IIO tools' + @echo ' kvm_stat - top-like utility for displaying kvm statistics' + @echo ' leds - LEDs tools' + @echo ' liblockdep - user-space wrapper for kernel locking-validator' + @echo ' bpf - misc BPF tools' + @echo ' perf - Linux performance measurement and analysis tool' + @echo ' selftests - various kernel selftests' + @echo ' spi - spi tools' + @echo ' objtool - an ELF object analysis tool' + @echo ' tmon - thermal monitoring and tuning tool' + @echo ' turbostat - Intel CPU idle stats and freq reporting tool' + @echo ' usb - USB testing tools' + @echo ' virtio - vhost test module' + @echo ' vm - misc vm tools' + @echo ' wmi - WMI interface examples' + @echo ' x86_energy_perf_policy - Intel energy policy tool' + @echo '' + @echo 'You can do:' + @echo ' $$ make -C tools/ _install' + @echo '' + @echo ' from the kernel command line to build and install one of' + @echo ' the tools above' + @echo '' + @echo ' $$ make tools/all' + @echo '' + @echo ' builds all tools.' + @echo '' + @echo ' $$ make tools/install' + @echo '' + @echo ' installs all tools.' + @echo '' + @echo 'Cleaning targets:' + @echo '' + @echo ' all of the above with the "_clean" string appended cleans' + @echo ' the respective build directory.' + @echo ' clean: a summary clean target to clean _all_ folders' + +acpi: FORCE + $(call descend,power/$@) + +cpupower: FORCE + $(call descend,power/$@) + +cgroup firewire hv guest spi usb virtio vm bpf iio gpio objtool leds wmi: FORCE + $(call descend,$@) + +liblockdep: FORCE + $(call descend,lib/lockdep) + +libapi: FORCE + $(call descend,lib/api) + +# The perf build does not follow the descend function setup, +# invoking it via it's own make rule. +PERF_O = $(if $(O),$(O)/tools/perf,) + +perf: FORCE + $(Q)mkdir -p $(PERF_O) . + $(Q)$(MAKE) --no-print-directory -C perf O=$(PERF_O) subdir= + +selftests: FORCE + $(call descend,testing/$@) + +turbostat x86_energy_perf_policy: FORCE + $(call descend,power/x86/$@) + +tmon: FORCE + $(call descend,thermal/$@) + +freefall: FORCE + $(call descend,laptop/$@) + +kvm_stat: FORCE + $(call descend,kvm/$@) + +all: acpi cgroup cpupower gpio hv firewire liblockdep \ + perf selftests spi turbostat usb \ + virtio vm bpf x86_energy_perf_policy \ + tmon freefall iio objtool kvm_stat wmi + +acpi_install: + $(call descend,power/$(@:_install=),install) + +cpupower_install: + $(call descend,power/$(@:_install=),install) + +cgroup_install firewire_install gpio_install hv_install iio_install perf_install spi_install usb_install virtio_install vm_install bpf_install objtool_install wmi_install: + $(call descend,$(@:_install=),install) + +liblockdep_install: + $(call descend,lib/lockdep,install) + +selftests_install: + $(call descend,testing/$(@:_install=),install) + +turbostat_install x86_energy_perf_policy_install: + $(call descend,power/x86/$(@:_install=),install) + +tmon_install: + $(call descend,thermal/$(@:_install=),install) + +freefall_install: + $(call descend,laptop/$(@:_install=),install) + +kvm_stat_install: + $(call descend,kvm/$(@:_install=),install) + +install: acpi_install cgroup_install cpupower_install gpio_install \ + hv_install firewire_install iio_install liblockdep_install \ + perf_install selftests_install turbostat_install usb_install \ + virtio_install vm_install bpf_install x86_energy_perf_policy_install \ + tmon_install freefall_install objtool_install kvm_stat_install \ + wmi_install + +acpi_clean: + $(call descend,power/acpi,clean) + +cpupower_clean: + $(call descend,power/cpupower,clean) + +cgroup_clean hv_clean firewire_clean spi_clean usb_clean virtio_clean vm_clean wmi_clean bpf_clean iio_clean gpio_clean objtool_clean leds_clean: + $(call descend,$(@:_clean=),clean) + +liblockdep_clean: + $(call descend,lib/lockdep,clean) + +libapi_clean: + $(call descend,lib/api,clean) + +libbpf_clean: + $(call descend,lib/bpf,clean) + +libsubcmd_clean: + $(call descend,lib/subcmd,clean) + +perf_clean: + $(Q)mkdir -p $(PERF_O) . + $(Q)$(MAKE) --no-print-directory -C perf O=$(PERF_O) subdir= clean + +selftests_clean: + $(call descend,testing/$(@:_clean=),clean) + +turbostat_clean x86_energy_perf_policy_clean: + $(call descend,power/x86/$(@:_clean=),clean) + +tmon_clean: + $(call descend,thermal/tmon,clean) + +freefall_clean: + $(call descend,laptop/freefall,clean) + +build_clean: + $(call descend,build,clean) + +clean: acpi_clean cgroup_clean cpupower_clean hv_clean firewire_clean \ + perf_clean selftests_clean turbostat_clean spi_clean usb_clean virtio_clean \ + vm_clean bpf_clean iio_clean x86_energy_perf_policy_clean tmon_clean \ + freefall_clean build_clean libbpf_clean libsubcmd_clean liblockdep_clean \ + gpio_clean objtool_clean leds_clean wmi_clean + +.PHONY: FORCE diff --git a/tools/accounting/.gitignore b/tools/accounting/.gitignore new file mode 100644 index 000000000..86485203c --- /dev/null +++ b/tools/accounting/.gitignore @@ -0,0 +1 @@ +getdelays diff --git a/tools/accounting/Makefile b/tools/accounting/Makefile new file mode 100644 index 000000000..03687f19c --- /dev/null +++ b/tools/accounting/Makefile @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0 +CC := $(CROSS_COMPILE)gcc +CFLAGS := -I../../usr/include + +PROGS := getdelays + +all: $(PROGS) + +clean: + rm -fr $(PROGS) diff --git a/tools/accounting/getdelays.c b/tools/accounting/getdelays.c new file mode 100644 index 000000000..6bf6a2043 --- /dev/null +++ b/tools/accounting/getdelays.c @@ -0,0 +1,551 @@ +// SPDX-License-Identifier: GPL-2.0 +/* getdelays.c + * + * Utility to get per-pid and per-tgid delay accounting statistics + * Also illustrates usage of the taskstats interface + * + * Copyright (C) Shailabh Nagar, IBM Corp. 2005 + * Copyright (C) Balbir Singh, IBM Corp. 2006 + * Copyright (c) Jay Lan, SGI. 2006 + * + * Compile with + * gcc -I/usr/src/linux/include getdelays.c -o getdelays + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +/* + * Generic macros for dealing with netlink sockets. Might be duplicated + * elsewhere. It is recommended that commercial grade applications use + * libnl or libnetlink and use the interfaces provided by the library + */ +#define GENLMSG_DATA(glh) ((void *)(NLMSG_DATA(glh) + GENL_HDRLEN)) +#define GENLMSG_PAYLOAD(glh) (NLMSG_PAYLOAD(glh, 0) - GENL_HDRLEN) +#define NLA_DATA(na) ((void *)((char*)(na) + NLA_HDRLEN)) +#define NLA_PAYLOAD(len) (len - NLA_HDRLEN) + +#define err(code, fmt, arg...) \ + do { \ + fprintf(stderr, fmt, ##arg); \ + exit(code); \ + } while (0) + +int done; +int rcvbufsz; +char name[100]; +int dbg; +int print_delays; +int print_io_accounting; +int print_task_context_switch_counts; + +#define PRINTF(fmt, arg...) { \ + if (dbg) { \ + printf(fmt, ##arg); \ + } \ + } + +/* Maximum size of response requested or message sent */ +#define MAX_MSG_SIZE 1024 +/* Maximum number of cpus expected to be specified in a cpumask */ +#define MAX_CPUS 32 + +struct msgtemplate { + struct nlmsghdr n; + struct genlmsghdr g; + char buf[MAX_MSG_SIZE]; +}; + +char cpumask[100+6*MAX_CPUS]; + +static void usage(void) +{ + fprintf(stderr, "getdelays [-dilv] [-w logfile] [-r bufsize] " + "[-m cpumask] [-t tgid] [-p pid]\n"); + fprintf(stderr, " -d: print delayacct stats\n"); + fprintf(stderr, " -i: print IO accounting (works only with -p)\n"); + fprintf(stderr, " -l: listen forever\n"); + fprintf(stderr, " -v: debug on\n"); + fprintf(stderr, " -C: container path\n"); +} + +/* + * Create a raw netlink socket and bind + */ +static int create_nl_socket(int protocol) +{ + int fd; + struct sockaddr_nl local; + + fd = socket(AF_NETLINK, SOCK_RAW, protocol); + if (fd < 0) + return -1; + + if (rcvbufsz) + if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, + &rcvbufsz, sizeof(rcvbufsz)) < 0) { + fprintf(stderr, "Unable to set socket rcv buf size to %d\n", + rcvbufsz); + goto error; + } + + memset(&local, 0, sizeof(local)); + local.nl_family = AF_NETLINK; + + if (bind(fd, (struct sockaddr *) &local, sizeof(local)) < 0) + goto error; + + return fd; +error: + close(fd); + return -1; +} + + +static int send_cmd(int sd, __u16 nlmsg_type, __u32 nlmsg_pid, + __u8 genl_cmd, __u16 nla_type, + void *nla_data, int nla_len) +{ + struct nlattr *na; + struct sockaddr_nl nladdr; + int r, buflen; + char *buf; + + struct msgtemplate msg; + + msg.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN); + msg.n.nlmsg_type = nlmsg_type; + msg.n.nlmsg_flags = NLM_F_REQUEST; + msg.n.nlmsg_seq = 0; + msg.n.nlmsg_pid = nlmsg_pid; + msg.g.cmd = genl_cmd; + msg.g.version = 0x1; + na = (struct nlattr *) GENLMSG_DATA(&msg); + na->nla_type = nla_type; + na->nla_len = nla_len + NLA_HDRLEN; + memcpy(NLA_DATA(na), nla_data, nla_len); + msg.n.nlmsg_len += NLMSG_ALIGN(na->nla_len); + + buf = (char *) &msg; + buflen = msg.n.nlmsg_len ; + memset(&nladdr, 0, sizeof(nladdr)); + nladdr.nl_family = AF_NETLINK; + while ((r = sendto(sd, buf, buflen, 0, (struct sockaddr *) &nladdr, + sizeof(nladdr))) < buflen) { + if (r > 0) { + buf += r; + buflen -= r; + } else if (errno != EAGAIN) + return -1; + } + return 0; +} + + +/* + * Probe the controller in genetlink to find the family id + * for the TASKSTATS family + */ +static int get_family_id(int sd) +{ + struct { + struct nlmsghdr n; + struct genlmsghdr g; + char buf[256]; + } ans; + + int id = 0, rc; + struct nlattr *na; + int rep_len; + + strcpy(name, TASKSTATS_GENL_NAME); + rc = send_cmd(sd, GENL_ID_CTRL, getpid(), CTRL_CMD_GETFAMILY, + CTRL_ATTR_FAMILY_NAME, (void *)name, + strlen(TASKSTATS_GENL_NAME)+1); + if (rc < 0) + return 0; /* sendto() failure? */ + + rep_len = recv(sd, &ans, sizeof(ans), 0); + if (ans.n.nlmsg_type == NLMSG_ERROR || + (rep_len < 0) || !NLMSG_OK((&ans.n), rep_len)) + return 0; + + na = (struct nlattr *) GENLMSG_DATA(&ans); + na = (struct nlattr *) ((char *) na + NLA_ALIGN(na->nla_len)); + if (na->nla_type == CTRL_ATTR_FAMILY_ID) { + id = *(__u16 *) NLA_DATA(na); + } + return id; +} + +#define average_ms(t, c) (t / 1000000ULL / (c ? c : 1)) + +static void print_delayacct(struct taskstats *t) +{ + printf("\n\nCPU %15s%15s%15s%15s%15s\n" + " %15llu%15llu%15llu%15llu%15.3fms\n" + "IO %15s%15s%15s\n" + " %15llu%15llu%15llums\n" + "SWAP %15s%15s%15s\n" + " %15llu%15llu%15llums\n" + "RECLAIM %12s%15s%15s\n" + " %15llu%15llu%15llums\n", + "count", "real total", "virtual total", + "delay total", "delay average", + (unsigned long long)t->cpu_count, + (unsigned long long)t->cpu_run_real_total, + (unsigned long long)t->cpu_run_virtual_total, + (unsigned long long)t->cpu_delay_total, + average_ms((double)t->cpu_delay_total, t->cpu_count), + "count", "delay total", "delay average", + (unsigned long long)t->blkio_count, + (unsigned long long)t->blkio_delay_total, + average_ms(t->blkio_delay_total, t->blkio_count), + "count", "delay total", "delay average", + (unsigned long long)t->swapin_count, + (unsigned long long)t->swapin_delay_total, + average_ms(t->swapin_delay_total, t->swapin_count), + "count", "delay total", "delay average", + (unsigned long long)t->freepages_count, + (unsigned long long)t->freepages_delay_total, + average_ms(t->freepages_delay_total, t->freepages_count)); +} + +static void task_context_switch_counts(struct taskstats *t) +{ + printf("\n\nTask %15s%15s\n" + " %15llu%15llu\n", + "voluntary", "nonvoluntary", + (unsigned long long)t->nvcsw, (unsigned long long)t->nivcsw); +} + +static void print_cgroupstats(struct cgroupstats *c) +{ + printf("sleeping %llu, blocked %llu, running %llu, stopped %llu, " + "uninterruptible %llu\n", (unsigned long long)c->nr_sleeping, + (unsigned long long)c->nr_io_wait, + (unsigned long long)c->nr_running, + (unsigned long long)c->nr_stopped, + (unsigned long long)c->nr_uninterruptible); +} + + +static void print_ioacct(struct taskstats *t) +{ + printf("%s: read=%llu, write=%llu, cancelled_write=%llu\n", + t->ac_comm, + (unsigned long long)t->read_bytes, + (unsigned long long)t->write_bytes, + (unsigned long long)t->cancelled_write_bytes); +} + +int main(int argc, char *argv[]) +{ + int c, rc, rep_len, aggr_len, len2; + int cmd_type = TASKSTATS_CMD_ATTR_UNSPEC; + __u16 id; + __u32 mypid; + + struct nlattr *na; + int nl_sd = -1; + int len = 0; + pid_t tid = 0; + pid_t rtid = 0; + + int fd = 0; + int count = 0; + int write_file = 0; + int maskset = 0; + char *logfile = NULL; + int loop = 0; + int containerset = 0; + char *containerpath = NULL; + int cfd = 0; + int forking = 0; + sigset_t sigset; + + struct msgtemplate msg; + + while (!forking) { + c = getopt(argc, argv, "qdiw:r:m:t:p:vlC:c:"); + if (c < 0) + break; + + switch (c) { + case 'd': + printf("print delayacct stats ON\n"); + print_delays = 1; + break; + case 'i': + printf("printing IO accounting\n"); + print_io_accounting = 1; + break; + case 'q': + printf("printing task/process context switch rates\n"); + print_task_context_switch_counts = 1; + break; + case 'C': + containerset = 1; + containerpath = optarg; + break; + case 'w': + logfile = strdup(optarg); + printf("write to file %s\n", logfile); + write_file = 1; + break; + case 'r': + rcvbufsz = atoi(optarg); + printf("receive buf size %d\n", rcvbufsz); + if (rcvbufsz < 0) + err(1, "Invalid rcv buf size\n"); + break; + case 'm': + strncpy(cpumask, optarg, sizeof(cpumask)); + cpumask[sizeof(cpumask) - 1] = '\0'; + maskset = 1; + printf("cpumask %s maskset %d\n", cpumask, maskset); + break; + case 't': + tid = atoi(optarg); + if (!tid) + err(1, "Invalid tgid\n"); + cmd_type = TASKSTATS_CMD_ATTR_TGID; + break; + case 'p': + tid = atoi(optarg); + if (!tid) + err(1, "Invalid pid\n"); + cmd_type = TASKSTATS_CMD_ATTR_PID; + break; + case 'c': + + /* Block SIGCHLD for sigwait() later */ + if (sigemptyset(&sigset) == -1) + err(1, "Failed to empty sigset"); + if (sigaddset(&sigset, SIGCHLD)) + err(1, "Failed to set sigchld in sigset"); + sigprocmask(SIG_BLOCK, &sigset, NULL); + + /* fork/exec a child */ + tid = fork(); + if (tid < 0) + err(1, "Fork failed\n"); + if (tid == 0) + if (execvp(argv[optind - 1], + &argv[optind - 1]) < 0) + exit(-1); + + /* Set the command type and avoid further processing */ + cmd_type = TASKSTATS_CMD_ATTR_PID; + forking = 1; + break; + case 'v': + printf("debug on\n"); + dbg = 1; + break; + case 'l': + printf("listen forever\n"); + loop = 1; + break; + default: + usage(); + exit(-1); + } + } + + if (write_file) { + fd = open(logfile, O_WRONLY | O_CREAT | O_TRUNC, + S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + if (fd == -1) { + perror("Cannot open output file\n"); + exit(1); + } + } + + nl_sd = create_nl_socket(NETLINK_GENERIC); + if (nl_sd < 0) + err(1, "error creating Netlink socket\n"); + + + mypid = getpid(); + id = get_family_id(nl_sd); + if (!id) { + fprintf(stderr, "Error getting family id, errno %d\n", errno); + goto err; + } + PRINTF("family id %d\n", id); + + if (maskset) { + rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET, + TASKSTATS_CMD_ATTR_REGISTER_CPUMASK, + &cpumask, strlen(cpumask) + 1); + PRINTF("Sent register cpumask, retval %d\n", rc); + if (rc < 0) { + fprintf(stderr, "error sending register cpumask\n"); + goto err; + } + } + + if (tid && containerset) { + fprintf(stderr, "Select either -t or -C, not both\n"); + goto err; + } + + /* + * If we forked a child, wait for it to exit. Cannot use waitpid() + * as all the delicious data would be reaped as part of the wait + */ + if (tid && forking) { + int sig_received; + sigwait(&sigset, &sig_received); + } + + if (tid) { + rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET, + cmd_type, &tid, sizeof(__u32)); + PRINTF("Sent pid/tgid, retval %d\n", rc); + if (rc < 0) { + fprintf(stderr, "error sending tid/tgid cmd\n"); + goto done; + } + } + + if (containerset) { + cfd = open(containerpath, O_RDONLY); + if (cfd < 0) { + perror("error opening container file"); + goto err; + } + rc = send_cmd(nl_sd, id, mypid, CGROUPSTATS_CMD_GET, + CGROUPSTATS_CMD_ATTR_FD, &cfd, sizeof(__u32)); + if (rc < 0) { + perror("error sending cgroupstats command"); + goto err; + } + } + if (!maskset && !tid && !containerset) { + usage(); + goto err; + } + + do { + rep_len = recv(nl_sd, &msg, sizeof(msg), 0); + PRINTF("received %d bytes\n", rep_len); + + if (rep_len < 0) { + fprintf(stderr, "nonfatal reply error: errno %d\n", + errno); + continue; + } + if (msg.n.nlmsg_type == NLMSG_ERROR || + !NLMSG_OK((&msg.n), rep_len)) { + struct nlmsgerr *err = NLMSG_DATA(&msg); + fprintf(stderr, "fatal reply error, errno %d\n", + err->error); + goto done; + } + + PRINTF("nlmsghdr size=%zu, nlmsg_len=%d, rep_len=%d\n", + sizeof(struct nlmsghdr), msg.n.nlmsg_len, rep_len); + + + rep_len = GENLMSG_PAYLOAD(&msg.n); + + na = (struct nlattr *) GENLMSG_DATA(&msg); + len = 0; + while (len < rep_len) { + len += NLA_ALIGN(na->nla_len); + switch (na->nla_type) { + case TASKSTATS_TYPE_AGGR_TGID: + /* Fall through */ + case TASKSTATS_TYPE_AGGR_PID: + aggr_len = NLA_PAYLOAD(na->nla_len); + len2 = 0; + /* For nested attributes, na follows */ + na = (struct nlattr *) NLA_DATA(na); + done = 0; + while (len2 < aggr_len) { + switch (na->nla_type) { + case TASKSTATS_TYPE_PID: + rtid = *(int *) NLA_DATA(na); + if (print_delays) + printf("PID\t%d\n", rtid); + break; + case TASKSTATS_TYPE_TGID: + rtid = *(int *) NLA_DATA(na); + if (print_delays) + printf("TGID\t%d\n", rtid); + break; + case TASKSTATS_TYPE_STATS: + count++; + if (print_delays) + print_delayacct((struct taskstats *) NLA_DATA(na)); + if (print_io_accounting) + print_ioacct((struct taskstats *) NLA_DATA(na)); + if (print_task_context_switch_counts) + task_context_switch_counts((struct taskstats *) NLA_DATA(na)); + if (fd) { + if (write(fd, NLA_DATA(na), na->nla_len) < 0) { + err(1,"write error\n"); + } + } + if (!loop) + goto done; + break; + case TASKSTATS_TYPE_NULL: + break; + default: + fprintf(stderr, "Unknown nested" + " nla_type %d\n", + na->nla_type); + break; + } + len2 += NLA_ALIGN(na->nla_len); + na = (struct nlattr *)((char *)na + + NLA_ALIGN(na->nla_len)); + } + break; + + case CGROUPSTATS_TYPE_CGROUP_STATS: + print_cgroupstats(NLA_DATA(na)); + break; + default: + fprintf(stderr, "Unknown nla_type %d\n", + na->nla_type); + case TASKSTATS_TYPE_NULL: + break; + } + na = (struct nlattr *) (GENLMSG_DATA(&msg) + len); + } + } while (loop); +done: + if (maskset) { + rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET, + TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK, + &cpumask, strlen(cpumask) + 1); + printf("Sent deregister mask, retval %d\n", rc); + if (rc < 0) + err(rc, "error sending deregister cpumask\n"); + } +err: + close(nl_sd); + if (fd) + close(fd); + if (cfd) + close(cfd); + return 0; +} diff --git a/tools/arch/alpha/include/asm/barrier.h b/tools/arch/alpha/include/asm/barrier.h new file mode 100644 index 000000000..da8d6457e --- /dev/null +++ b/tools/arch/alpha/include/asm/barrier.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __TOOLS_LINUX_ASM_ALPHA_BARRIER_H +#define __TOOLS_LINUX_ASM_ALPHA_BARRIER_H + +#define mb() __asm__ __volatile__("mb": : :"memory") +#define rmb() __asm__ __volatile__("mb": : :"memory") +#define wmb() __asm__ __volatile__("wmb": : :"memory") + +#endif /* __TOOLS_LINUX_ASM_ALPHA_BARRIER_H */ diff --git a/tools/arch/alpha/include/uapi/asm/bitsperlong.h b/tools/arch/alpha/include/uapi/asm/bitsperlong.h new file mode 100644 index 000000000..6c5bf7d03 --- /dev/null +++ b/tools/arch/alpha/include/uapi/asm/bitsperlong.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_ALPHA_BITSPERLONG_H +#define __ASM_ALPHA_BITSPERLONG_H + +#define __BITS_PER_LONG 64 + +#include + +#endif /* __ASM_ALPHA_BITSPERLONG_H */ diff --git a/tools/arch/alpha/include/uapi/asm/errno.h b/tools/arch/alpha/include/uapi/asm/errno.h new file mode 100644 index 000000000..3d265f6ba --- /dev/null +++ b/tools/arch/alpha/include/uapi/asm/errno.h @@ -0,0 +1,128 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _ALPHA_ERRNO_H +#define _ALPHA_ERRNO_H + +#include + +#undef EAGAIN /* 11 in errno-base.h */ + +#define EDEADLK 11 /* Resource deadlock would occur */ + +#define EAGAIN 35 /* Try again */ +#define EWOULDBLOCK EAGAIN /* Operation would block */ +#define EINPROGRESS 36 /* Operation now in progress */ +#define EALREADY 37 /* Operation already in progress */ +#define ENOTSOCK 38 /* Socket operation on non-socket */ +#define EDESTADDRREQ 39 /* Destination address required */ +#define EMSGSIZE 40 /* Message too long */ +#define EPROTOTYPE 41 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 42 /* Protocol not available */ +#define EPROTONOSUPPORT 43 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ +#define EOPNOTSUPP 45 /* Operation not supported on transport endpoint */ +#define EPFNOSUPPORT 46 /* Protocol family not supported */ +#define EAFNOSUPPORT 47 /* Address family not supported by protocol */ +#define EADDRINUSE 48 /* Address already in use */ +#define EADDRNOTAVAIL 49 /* Cannot assign requested address */ +#define ENETDOWN 50 /* Network is down */ +#define ENETUNREACH 51 /* Network is unreachable */ +#define ENETRESET 52 /* Network dropped connection because of reset */ +#define ECONNABORTED 53 /* Software caused connection abort */ +#define ECONNRESET 54 /* Connection reset by peer */ +#define ENOBUFS 55 /* No buffer space available */ +#define EISCONN 56 /* Transport endpoint is already connected */ +#define ENOTCONN 57 /* Transport endpoint is not connected */ +#define ESHUTDOWN 58 /* Cannot send after transport endpoint shutdown */ +#define ETOOMANYREFS 59 /* Too many references: cannot splice */ +#define ETIMEDOUT 60 /* Connection timed out */ +#define ECONNREFUSED 61 /* Connection refused */ +#define ELOOP 62 /* Too many symbolic links encountered */ +#define ENAMETOOLONG 63 /* File name too long */ +#define EHOSTDOWN 64 /* Host is down */ +#define EHOSTUNREACH 65 /* No route to host */ +#define ENOTEMPTY 66 /* Directory not empty */ + +#define EUSERS 68 /* Too many users */ +#define EDQUOT 69 /* Quota exceeded */ +#define ESTALE 70 /* Stale file handle */ +#define EREMOTE 71 /* Object is remote */ + +#define ENOLCK 77 /* No record locks available */ +#define ENOSYS 78 /* Function not implemented */ + +#define ENOMSG 80 /* No message of desired type */ +#define EIDRM 81 /* Identifier removed */ +#define ENOSR 82 /* Out of streams resources */ +#define ETIME 83 /* Timer expired */ +#define EBADMSG 84 /* Not a data message */ +#define EPROTO 85 /* Protocol error */ +#define ENODATA 86 /* No data available */ +#define ENOSTR 87 /* Device not a stream */ + +#define ENOPKG 92 /* Package not installed */ + +#define EILSEQ 116 /* Illegal byte sequence */ + +/* The following are just random noise.. */ +#define ECHRNG 88 /* Channel number out of range */ +#define EL2NSYNC 89 /* Level 2 not synchronized */ +#define EL3HLT 90 /* Level 3 halted */ +#define EL3RST 91 /* Level 3 reset */ + +#define ELNRNG 93 /* Link number out of range */ +#define EUNATCH 94 /* Protocol driver not attached */ +#define ENOCSI 95 /* No CSI structure available */ +#define EL2HLT 96 /* Level 2 halted */ +#define EBADE 97 /* Invalid exchange */ +#define EBADR 98 /* Invalid request descriptor */ +#define EXFULL 99 /* Exchange full */ +#define ENOANO 100 /* No anode */ +#define EBADRQC 101 /* Invalid request code */ +#define EBADSLT 102 /* Invalid slot */ + +#define EDEADLOCK EDEADLK + +#define EBFONT 104 /* Bad font file format */ +#define ENONET 105 /* Machine is not on the network */ +#define ENOLINK 106 /* Link has been severed */ +#define EADV 107 /* Advertise error */ +#define ESRMNT 108 /* Srmount error */ +#define ECOMM 109 /* Communication error on send */ +#define EMULTIHOP 110 /* Multihop attempted */ +#define EDOTDOT 111 /* RFS specific error */ +#define EOVERFLOW 112 /* Value too large for defined data type */ +#define ENOTUNIQ 113 /* Name not unique on network */ +#define EBADFD 114 /* File descriptor in bad state */ +#define EREMCHG 115 /* Remote address changed */ + +#define EUCLEAN 117 /* Structure needs cleaning */ +#define ENOTNAM 118 /* Not a XENIX named type file */ +#define ENAVAIL 119 /* No XENIX semaphores available */ +#define EISNAM 120 /* Is a named type file */ +#define EREMOTEIO 121 /* Remote I/O error */ + +#define ELIBACC 122 /* Can not access a needed shared library */ +#define ELIBBAD 123 /* Accessing a corrupted shared library */ +#define ELIBSCN 124 /* .lib section in a.out corrupted */ +#define ELIBMAX 125 /* Attempting to link in too many shared libraries */ +#define ELIBEXEC 126 /* Cannot exec a shared library directly */ +#define ERESTART 127 /* Interrupted system call should be restarted */ +#define ESTRPIPE 128 /* Streams pipe error */ + +#define ENOMEDIUM 129 /* No medium found */ +#define EMEDIUMTYPE 130 /* Wrong medium type */ +#define ECANCELED 131 /* Operation Cancelled */ +#define ENOKEY 132 /* Required key not available */ +#define EKEYEXPIRED 133 /* Key has expired */ +#define EKEYREVOKED 134 /* Key has been revoked */ +#define EKEYREJECTED 135 /* Key was rejected by service */ + +/* for robust mutexes */ +#define EOWNERDEAD 136 /* Owner died */ +#define ENOTRECOVERABLE 137 /* State not recoverable */ + +#define ERFKILL 138 /* Operation not possible due to RF-kill */ + +#define EHWPOISON 139 /* Memory page has hardware error */ + +#endif diff --git a/tools/arch/alpha/include/uapi/asm/mman.h b/tools/arch/alpha/include/uapi/asm/mman.h new file mode 100644 index 000000000..c317d3e68 --- /dev/null +++ b/tools/arch/alpha/include/uapi/asm/mman.h @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H +#define TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H +#define MADV_DODUMP 17 +#define MADV_DOFORK 11 +#define MADV_DONTDUMP 16 +#define MADV_DONTFORK 10 +#define MADV_DONTNEED 6 +#define MADV_FREE 8 +#define MADV_HUGEPAGE 14 +#define MADV_MERGEABLE 12 +#define MADV_NOHUGEPAGE 15 +#define MADV_NORMAL 0 +#define MADV_RANDOM 1 +#define MADV_REMOVE 9 +#define MADV_SEQUENTIAL 2 +#define MADV_UNMERGEABLE 13 +#define MADV_WILLNEED 3 +#define MAP_ANONYMOUS 0x10 +#define MAP_DENYWRITE 0x02000 +#define MAP_EXECUTABLE 0x04000 +#define MAP_FILE 0 +#define MAP_FIXED 0x100 +#define MAP_GROWSDOWN 0x01000 +#define MAP_HUGETLB 0x100000 +#define MAP_LOCKED 0x08000 +#define MAP_NONBLOCK 0x40000 +#define MAP_NORESERVE 0x10000 +#define MAP_POPULATE 0x20000 +#define MAP_PRIVATE 0x02 +#define MAP_SHARED 0x01 +#define MAP_STACK 0x80000 +#define PROT_EXEC 0x4 +#define PROT_GROWSDOWN 0x01000000 +#define PROT_GROWSUP 0x02000000 +#define PROT_NONE 0x0 +#define PROT_READ 0x1 +#define PROT_SEM 0x8 +#define PROT_WRITE 0x2 +/* MADV_HWPOISON is undefined on alpha, fix it for perf */ +#define MADV_HWPOISON 100 +/* MADV_SOFT_OFFLINE is undefined on alpha, fix it for perf */ +#define MADV_SOFT_OFFLINE 101 +/* MAP_32BIT is undefined on alpha, fix it for perf */ +#define MAP_32BIT 0 +/* MAP_UNINITIALIZED is undefined on alpha, fix it for perf */ +#define MAP_UNINITIALIZED 0 +#endif diff --git a/tools/arch/arc/include/uapi/asm/mman.h b/tools/arch/arc/include/uapi/asm/mman.h new file mode 100644 index 000000000..81f0f9bf0 --- /dev/null +++ b/tools/arch/arc/include/uapi/asm/mman.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef TOOLS_ARCH_ARC_UAPI_ASM_MMAN_FIX_H +#define TOOLS_ARCH_ARC_UAPI_ASM_MMAN_FIX_H +#include +/* MAP_32BIT is undefined on arc, fix it for perf */ +#define MAP_32BIT 0 +#endif diff --git a/tools/arch/arm/include/asm/barrier.h b/tools/arch/arm/include/asm/barrier.h new file mode 100644 index 000000000..005c618a0 --- /dev/null +++ b/tools/arch/arm/include/asm/barrier.h @@ -0,0 +1,12 @@ +#ifndef _TOOLS_LINUX_ASM_ARM_BARRIER_H +#define _TOOLS_LINUX_ASM_ARM_BARRIER_H + +/* + * Use the __kuser_memory_barrier helper in the CPU helper page. See + * arch/arm/kernel/entry-armv.S in the kernel source for details. + */ +#define mb() ((void(*)(void))0xffff0fa0)() +#define wmb() ((void(*)(void))0xffff0fa0)() +#define rmb() ((void(*)(void))0xffff0fa0)() + +#endif /* _TOOLS_LINUX_ASM_ARM_BARRIER_H */ diff --git a/tools/arch/arm/include/uapi/asm/kvm.h b/tools/arch/arm/include/uapi/asm/kvm.h new file mode 100644 index 000000000..4602464eb --- /dev/null +++ b/tools/arch/arm/include/uapi/asm/kvm.h @@ -0,0 +1,299 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * Copyright (C) 2012 - Virtual Open Systems and Columbia University + * Author: Christoffer Dall + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __ARM_KVM_H__ +#define __ARM_KVM_H__ + +#include +#include +#include + +#define __KVM_HAVE_GUEST_DEBUG +#define __KVM_HAVE_IRQ_LINE +#define __KVM_HAVE_READONLY_MEM +#define __KVM_HAVE_VCPU_EVENTS + +#define KVM_COALESCED_MMIO_PAGE_OFFSET 1 + +#define KVM_REG_SIZE(id) \ + (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT)) + +/* Valid for svc_regs, abt_regs, und_regs, irq_regs in struct kvm_regs */ +#define KVM_ARM_SVC_sp svc_regs[0] +#define KVM_ARM_SVC_lr svc_regs[1] +#define KVM_ARM_SVC_spsr svc_regs[2] +#define KVM_ARM_ABT_sp abt_regs[0] +#define KVM_ARM_ABT_lr abt_regs[1] +#define KVM_ARM_ABT_spsr abt_regs[2] +#define KVM_ARM_UND_sp und_regs[0] +#define KVM_ARM_UND_lr und_regs[1] +#define KVM_ARM_UND_spsr und_regs[2] +#define KVM_ARM_IRQ_sp irq_regs[0] +#define KVM_ARM_IRQ_lr irq_regs[1] +#define KVM_ARM_IRQ_spsr irq_regs[2] + +/* Valid only for fiq_regs in struct kvm_regs */ +#define KVM_ARM_FIQ_r8 fiq_regs[0] +#define KVM_ARM_FIQ_r9 fiq_regs[1] +#define KVM_ARM_FIQ_r10 fiq_regs[2] +#define KVM_ARM_FIQ_fp fiq_regs[3] +#define KVM_ARM_FIQ_ip fiq_regs[4] +#define KVM_ARM_FIQ_sp fiq_regs[5] +#define KVM_ARM_FIQ_lr fiq_regs[6] +#define KVM_ARM_FIQ_spsr fiq_regs[7] + +struct kvm_regs { + struct pt_regs usr_regs; /* R0_usr - R14_usr, PC, CPSR */ + unsigned long svc_regs[3]; /* SP_svc, LR_svc, SPSR_svc */ + unsigned long abt_regs[3]; /* SP_abt, LR_abt, SPSR_abt */ + unsigned long und_regs[3]; /* SP_und, LR_und, SPSR_und */ + unsigned long irq_regs[3]; /* SP_irq, LR_irq, SPSR_irq */ + unsigned long fiq_regs[8]; /* R8_fiq - R14_fiq, SPSR_fiq */ +}; + +/* Supported Processor Types */ +#define KVM_ARM_TARGET_CORTEX_A15 0 +#define KVM_ARM_TARGET_CORTEX_A7 1 +#define KVM_ARM_NUM_TARGETS 2 + +/* KVM_ARM_SET_DEVICE_ADDR ioctl id encoding */ +#define KVM_ARM_DEVICE_TYPE_SHIFT 0 +#define KVM_ARM_DEVICE_TYPE_MASK (0xffff << KVM_ARM_DEVICE_TYPE_SHIFT) +#define KVM_ARM_DEVICE_ID_SHIFT 16 +#define KVM_ARM_DEVICE_ID_MASK (0xffff << KVM_ARM_DEVICE_ID_SHIFT) + +/* Supported device IDs */ +#define KVM_ARM_DEVICE_VGIC_V2 0 + +/* Supported VGIC address types */ +#define KVM_VGIC_V2_ADDR_TYPE_DIST 0 +#define KVM_VGIC_V2_ADDR_TYPE_CPU 1 + +#define KVM_VGIC_V2_DIST_SIZE 0x1000 +#define KVM_VGIC_V2_CPU_SIZE 0x2000 + +/* Supported VGICv3 address types */ +#define KVM_VGIC_V3_ADDR_TYPE_DIST 2 +#define KVM_VGIC_V3_ADDR_TYPE_REDIST 3 +#define KVM_VGIC_ITS_ADDR_TYPE 4 +#define KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION 5 + +#define KVM_VGIC_V3_DIST_SIZE SZ_64K +#define KVM_VGIC_V3_REDIST_SIZE (2 * SZ_64K) +#define KVM_VGIC_V3_ITS_SIZE (2 * SZ_64K) + +#define KVM_ARM_VCPU_POWER_OFF 0 /* CPU is started in OFF state */ +#define KVM_ARM_VCPU_PSCI_0_2 1 /* CPU uses PSCI v0.2 */ + +struct kvm_vcpu_init { + __u32 target; + __u32 features[7]; +}; + +struct kvm_sregs { +}; + +struct kvm_fpu { +}; + +struct kvm_guest_debug_arch { +}; + +struct kvm_debug_exit_arch { +}; + +struct kvm_sync_regs { + /* Used with KVM_CAP_ARM_USER_IRQ */ + __u64 device_irq_level; +}; + +struct kvm_arch_memory_slot { +}; + +/* for KVM_GET/SET_VCPU_EVENTS */ +struct kvm_vcpu_events { + struct { + __u8 serror_pending; + __u8 serror_has_esr; + /* Align it to 8 bytes */ + __u8 pad[6]; + __u64 serror_esr; + } exception; + __u32 reserved[12]; +}; + +/* If you need to interpret the index values, here is the key: */ +#define KVM_REG_ARM_COPROC_MASK 0x000000000FFF0000 +#define KVM_REG_ARM_COPROC_SHIFT 16 +#define KVM_REG_ARM_32_OPC2_MASK 0x0000000000000007 +#define KVM_REG_ARM_32_OPC2_SHIFT 0 +#define KVM_REG_ARM_OPC1_MASK 0x0000000000000078 +#define KVM_REG_ARM_OPC1_SHIFT 3 +#define KVM_REG_ARM_CRM_MASK 0x0000000000000780 +#define KVM_REG_ARM_CRM_SHIFT 7 +#define KVM_REG_ARM_32_CRN_MASK 0x0000000000007800 +#define KVM_REG_ARM_32_CRN_SHIFT 11 +/* + * For KVM currently all guest registers are nonsecure, but we reserve a bit + * in the encoding to distinguish secure from nonsecure for AArch32 system + * registers that are banked by security. This is 1 for the secure banked + * register, and 0 for the nonsecure banked register or if the register is + * not banked by security. + */ +#define KVM_REG_ARM_SECURE_MASK 0x0000000010000000 +#define KVM_REG_ARM_SECURE_SHIFT 28 + +#define ARM_CP15_REG_SHIFT_MASK(x,n) \ + (((x) << KVM_REG_ARM_ ## n ## _SHIFT) & KVM_REG_ARM_ ## n ## _MASK) + +#define __ARM_CP15_REG(op1,crn,crm,op2) \ + (KVM_REG_ARM | (15 << KVM_REG_ARM_COPROC_SHIFT) | \ + ARM_CP15_REG_SHIFT_MASK(op1, OPC1) | \ + ARM_CP15_REG_SHIFT_MASK(crn, 32_CRN) | \ + ARM_CP15_REG_SHIFT_MASK(crm, CRM) | \ + ARM_CP15_REG_SHIFT_MASK(op2, 32_OPC2)) + +#define ARM_CP15_REG32(...) (__ARM_CP15_REG(__VA_ARGS__) | KVM_REG_SIZE_U32) + +#define __ARM_CP15_REG64(op1,crm) \ + (__ARM_CP15_REG(op1, 0, crm, 0) | KVM_REG_SIZE_U64) +#define ARM_CP15_REG64(...) __ARM_CP15_REG64(__VA_ARGS__) + +/* PL1 Physical Timer Registers */ +#define KVM_REG_ARM_PTIMER_CTL ARM_CP15_REG32(0, 14, 2, 1) +#define KVM_REG_ARM_PTIMER_CNT ARM_CP15_REG64(0, 14) +#define KVM_REG_ARM_PTIMER_CVAL ARM_CP15_REG64(2, 14) + +/* Virtual Timer Registers */ +#define KVM_REG_ARM_TIMER_CTL ARM_CP15_REG32(0, 14, 3, 1) +#define KVM_REG_ARM_TIMER_CNT ARM_CP15_REG64(1, 14) +#define KVM_REG_ARM_TIMER_CVAL ARM_CP15_REG64(3, 14) + +/* Normal registers are mapped as coprocessor 16. */ +#define KVM_REG_ARM_CORE (0x0010 << KVM_REG_ARM_COPROC_SHIFT) +#define KVM_REG_ARM_CORE_REG(name) (offsetof(struct kvm_regs, name) / 4) + +/* Some registers need more space to represent values. */ +#define KVM_REG_ARM_DEMUX (0x0011 << KVM_REG_ARM_COPROC_SHIFT) +#define KVM_REG_ARM_DEMUX_ID_MASK 0x000000000000FF00 +#define KVM_REG_ARM_DEMUX_ID_SHIFT 8 +#define KVM_REG_ARM_DEMUX_ID_CCSIDR (0x00 << KVM_REG_ARM_DEMUX_ID_SHIFT) +#define KVM_REG_ARM_DEMUX_VAL_MASK 0x00000000000000FF +#define KVM_REG_ARM_DEMUX_VAL_SHIFT 0 + +/* VFP registers: we could overload CP10 like ARM does, but that's ugly. */ +#define KVM_REG_ARM_VFP (0x0012 << KVM_REG_ARM_COPROC_SHIFT) +#define KVM_REG_ARM_VFP_MASK 0x000000000000FFFF +#define KVM_REG_ARM_VFP_BASE_REG 0x0 +#define KVM_REG_ARM_VFP_FPSID 0x1000 +#define KVM_REG_ARM_VFP_FPSCR 0x1001 +#define KVM_REG_ARM_VFP_MVFR1 0x1006 +#define KVM_REG_ARM_VFP_MVFR0 0x1007 +#define KVM_REG_ARM_VFP_FPEXC 0x1008 +#define KVM_REG_ARM_VFP_FPINST 0x1009 +#define KVM_REG_ARM_VFP_FPINST2 0x100A + +/* KVM-as-firmware specific pseudo-registers */ +#define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT) +#define KVM_REG_ARM_FW_REG(r) (KVM_REG_ARM | KVM_REG_SIZE_U64 | \ + KVM_REG_ARM_FW | ((r) & 0xffff)) +#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0) + +/* Device Control API: ARM VGIC */ +#define KVM_DEV_ARM_VGIC_GRP_ADDR 0 +#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1 +#define KVM_DEV_ARM_VGIC_GRP_CPU_REGS 2 +#define KVM_DEV_ARM_VGIC_CPUID_SHIFT 32 +#define KVM_DEV_ARM_VGIC_CPUID_MASK (0xffULL << KVM_DEV_ARM_VGIC_CPUID_SHIFT) +#define KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT 32 +#define KVM_DEV_ARM_VGIC_V3_MPIDR_MASK \ + (0xffffffffULL << KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT) +#define KVM_DEV_ARM_VGIC_OFFSET_SHIFT 0 +#define KVM_DEV_ARM_VGIC_OFFSET_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_OFFSET_SHIFT) +#define KVM_DEV_ARM_VGIC_SYSREG_INSTR_MASK (0xffff) +#define KVM_DEV_ARM_VGIC_GRP_NR_IRQS 3 +#define KVM_DEV_ARM_VGIC_GRP_CTRL 4 +#define KVM_DEV_ARM_VGIC_GRP_REDIST_REGS 5 +#define KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS 6 +#define KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO 7 +#define KVM_DEV_ARM_VGIC_GRP_ITS_REGS 8 +#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT 10 +#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK \ + (0x3fffffULL << KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT) +#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK 0x3ff +#define VGIC_LEVEL_INFO_LINE_LEVEL 0 + +/* Device Control API on vcpu fd */ +#define KVM_ARM_VCPU_PMU_V3_CTRL 0 +#define KVM_ARM_VCPU_PMU_V3_IRQ 0 +#define KVM_ARM_VCPU_PMU_V3_INIT 1 +#define KVM_ARM_VCPU_TIMER_CTRL 1 +#define KVM_ARM_VCPU_TIMER_IRQ_VTIMER 0 +#define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1 + +#define KVM_DEV_ARM_VGIC_CTRL_INIT 0 +#define KVM_DEV_ARM_ITS_SAVE_TABLES 1 +#define KVM_DEV_ARM_ITS_RESTORE_TABLES 2 +#define KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES 3 +#define KVM_DEV_ARM_ITS_CTRL_RESET 4 + +/* KVM_IRQ_LINE irq field index values */ +#define KVM_ARM_IRQ_TYPE_SHIFT 24 +#define KVM_ARM_IRQ_TYPE_MASK 0xff +#define KVM_ARM_IRQ_VCPU_SHIFT 16 +#define KVM_ARM_IRQ_VCPU_MASK 0xff +#define KVM_ARM_IRQ_NUM_SHIFT 0 +#define KVM_ARM_IRQ_NUM_MASK 0xffff + +/* irq_type field */ +#define KVM_ARM_IRQ_TYPE_CPU 0 +#define KVM_ARM_IRQ_TYPE_SPI 1 +#define KVM_ARM_IRQ_TYPE_PPI 2 + +/* out-of-kernel GIC cpu interrupt injection irq_number field */ +#define KVM_ARM_IRQ_CPU_IRQ 0 +#define KVM_ARM_IRQ_CPU_FIQ 1 + +/* + * This used to hold the highest supported SPI, but it is now obsolete + * and only here to provide source code level compatibility with older + * userland. The highest SPI number can be set via KVM_DEV_ARM_VGIC_GRP_NR_IRQS. + */ +#ifndef __KERNEL__ +#define KVM_ARM_IRQ_GIC_MAX 127 +#endif + +/* One single KVM irqchip, ie. the VGIC */ +#define KVM_NR_IRQCHIPS 1 + +/* PSCI interface */ +#define KVM_PSCI_FN_BASE 0x95c1ba5e +#define KVM_PSCI_FN(n) (KVM_PSCI_FN_BASE + (n)) + +#define KVM_PSCI_FN_CPU_SUSPEND KVM_PSCI_FN(0) +#define KVM_PSCI_FN_CPU_OFF KVM_PSCI_FN(1) +#define KVM_PSCI_FN_CPU_ON KVM_PSCI_FN(2) +#define KVM_PSCI_FN_MIGRATE KVM_PSCI_FN(3) + +#define KVM_PSCI_RET_SUCCESS PSCI_RET_SUCCESS +#define KVM_PSCI_RET_NI PSCI_RET_NOT_SUPPORTED +#define KVM_PSCI_RET_INVAL PSCI_RET_INVALID_PARAMS +#define KVM_PSCI_RET_DENIED PSCI_RET_DENIED + +#endif /* __ARM_KVM_H__ */ diff --git a/tools/arch/arm/include/uapi/asm/mman.h b/tools/arch/arm/include/uapi/asm/mman.h new file mode 100644 index 000000000..a6d46321e --- /dev/null +++ b/tools/arch/arm/include/uapi/asm/mman.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H +#define TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H +#include +/* MAP_32BIT is undefined on arm, fix it for perf */ +#define MAP_32BIT 0 +#endif diff --git a/tools/arch/arm/include/uapi/asm/perf_regs.h b/tools/arch/arm/include/uapi/asm/perf_regs.h new file mode 100644 index 000000000..a3c046174 --- /dev/null +++ b/tools/arch/arm/include/uapi/asm/perf_regs.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _ASM_ARM_PERF_REGS_H +#define _ASM_ARM_PERF_REGS_H + +enum perf_event_arm_regs { + PERF_REG_ARM_R0, + PERF_REG_ARM_R1, + PERF_REG_ARM_R2, + PERF_REG_ARM_R3, + PERF_REG_ARM_R4, + PERF_REG_ARM_R5, + PERF_REG_ARM_R6, + PERF_REG_ARM_R7, + PERF_REG_ARM_R8, + PERF_REG_ARM_R9, + PERF_REG_ARM_R10, + PERF_REG_ARM_FP, + PERF_REG_ARM_IP, + PERF_REG_ARM_SP, + PERF_REG_ARM_LR, + PERF_REG_ARM_PC, + PERF_REG_ARM_MAX, +}; +#endif /* _ASM_ARM_PERF_REGS_H */ diff --git a/tools/arch/arm64/include/asm/barrier.h b/tools/arch/arm64/include/asm/barrier.h new file mode 100644 index 000000000..40bde6b23 --- /dev/null +++ b/tools/arch/arm64/include/asm/barrier.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _TOOLS_LINUX_ASM_AARCH64_BARRIER_H +#define _TOOLS_LINUX_ASM_AARCH64_BARRIER_H + +/* + * From tools/perf/perf-sys.h, last modified in: + * f428ebd184c82a7914b2aa7e9f868918aaf7ea78 perf tools: Fix AAAAARGH64 memory barriers + * + * XXX: arch/arm64/include/asm/barrier.h in the kernel sources use dsb, is this + * a case like for arm32 where we do things differently in userspace? + */ + +#define mb() asm volatile("dmb ish" ::: "memory") +#define wmb() asm volatile("dmb ishst" ::: "memory") +#define rmb() asm volatile("dmb ishld" ::: "memory") + +#endif /* _TOOLS_LINUX_ASM_AARCH64_BARRIER_H */ diff --git a/tools/arch/arm64/include/uapi/asm/bitsperlong.h b/tools/arch/arm64/include/uapi/asm/bitsperlong.h new file mode 100644 index 000000000..485d60bee --- /dev/null +++ b/tools/arch/arm64/include/uapi/asm/bitsperlong.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * Copyright (C) 2012 ARM Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef __ASM_BITSPERLONG_H +#define __ASM_BITSPERLONG_H + +#define __BITS_PER_LONG 64 + +#include + +#endif /* __ASM_BITSPERLONG_H */ diff --git a/tools/arch/arm64/include/uapi/asm/bpf_perf_event.h b/tools/arch/arm64/include/uapi/asm/bpf_perf_event.h new file mode 100644 index 000000000..b551b7416 --- /dev/null +++ b/tools/arch/arm64/include/uapi/asm/bpf_perf_event.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__ +#define _UAPI__ASM_BPF_PERF_EVENT_H__ + +#include + +typedef struct user_pt_regs bpf_user_pt_regs_t; + +#endif /* _UAPI__ASM_BPF_PERF_EVENT_H__ */ diff --git a/tools/arch/arm64/include/uapi/asm/kvm.h b/tools/arch/arm64/include/uapi/asm/kvm.h new file mode 100644 index 000000000..97c3478ee --- /dev/null +++ b/tools/arch/arm64/include/uapi/asm/kvm.h @@ -0,0 +1,312 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * Copyright (C) 2012,2013 - ARM Ltd + * Author: Marc Zyngier + * + * Derived from arch/arm/include/uapi/asm/kvm.h: + * Copyright (C) 2012 - Virtual Open Systems and Columbia University + * Author: Christoffer Dall + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __ARM_KVM_H__ +#define __ARM_KVM_H__ + +#define KVM_SPSR_EL1 0 +#define KVM_SPSR_SVC KVM_SPSR_EL1 +#define KVM_SPSR_ABT 1 +#define KVM_SPSR_UND 2 +#define KVM_SPSR_IRQ 3 +#define KVM_SPSR_FIQ 4 +#define KVM_NR_SPSR 5 + +#ifndef __ASSEMBLY__ +#include +#include +#include + +#define __KVM_HAVE_GUEST_DEBUG +#define __KVM_HAVE_IRQ_LINE +#define __KVM_HAVE_READONLY_MEM +#define __KVM_HAVE_VCPU_EVENTS + +#define KVM_COALESCED_MMIO_PAGE_OFFSET 1 + +#define KVM_REG_SIZE(id) \ + (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT)) + +struct kvm_regs { + struct user_pt_regs regs; /* sp = sp_el0 */ + + __u64 sp_el1; + __u64 elr_el1; + + __u64 spsr[KVM_NR_SPSR]; + + struct user_fpsimd_state fp_regs; +}; + +/* + * Supported CPU Targets - Adding a new target type is not recommended, + * unless there are some special registers not supported by the + * genericv8 syreg table. + */ +#define KVM_ARM_TARGET_AEM_V8 0 +#define KVM_ARM_TARGET_FOUNDATION_V8 1 +#define KVM_ARM_TARGET_CORTEX_A57 2 +#define KVM_ARM_TARGET_XGENE_POTENZA 3 +#define KVM_ARM_TARGET_CORTEX_A53 4 +/* Generic ARM v8 target */ +#define KVM_ARM_TARGET_GENERIC_V8 5 + +#define KVM_ARM_NUM_TARGETS 6 + +/* KVM_ARM_SET_DEVICE_ADDR ioctl id encoding */ +#define KVM_ARM_DEVICE_TYPE_SHIFT 0 +#define KVM_ARM_DEVICE_TYPE_MASK (0xffff << KVM_ARM_DEVICE_TYPE_SHIFT) +#define KVM_ARM_DEVICE_ID_SHIFT 16 +#define KVM_ARM_DEVICE_ID_MASK (0xffff << KVM_ARM_DEVICE_ID_SHIFT) + +/* Supported device IDs */ +#define KVM_ARM_DEVICE_VGIC_V2 0 + +/* Supported VGIC address types */ +#define KVM_VGIC_V2_ADDR_TYPE_DIST 0 +#define KVM_VGIC_V2_ADDR_TYPE_CPU 1 + +#define KVM_VGIC_V2_DIST_SIZE 0x1000 +#define KVM_VGIC_V2_CPU_SIZE 0x2000 + +/* Supported VGICv3 address types */ +#define KVM_VGIC_V3_ADDR_TYPE_DIST 2 +#define KVM_VGIC_V3_ADDR_TYPE_REDIST 3 +#define KVM_VGIC_ITS_ADDR_TYPE 4 +#define KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION 5 + +#define KVM_VGIC_V3_DIST_SIZE SZ_64K +#define KVM_VGIC_V3_REDIST_SIZE (2 * SZ_64K) +#define KVM_VGIC_V3_ITS_SIZE (2 * SZ_64K) + +#define KVM_ARM_VCPU_POWER_OFF 0 /* CPU is started in OFF state */ +#define KVM_ARM_VCPU_EL1_32BIT 1 /* CPU running a 32bit VM */ +#define KVM_ARM_VCPU_PSCI_0_2 2 /* CPU uses PSCI v0.2 */ +#define KVM_ARM_VCPU_PMU_V3 3 /* Support guest PMUv3 */ + +struct kvm_vcpu_init { + __u32 target; + __u32 features[7]; +}; + +struct kvm_sregs { +}; + +struct kvm_fpu { +}; + +/* + * See v8 ARM ARM D7.3: Debug Registers + * + * The architectural limit is 16 debug registers of each type although + * in practice there are usually less (see ID_AA64DFR0_EL1). + * + * Although the control registers are architecturally defined as 32 + * bits wide we use a 64 bit structure here to keep parity with + * KVM_GET/SET_ONE_REG behaviour which treats all system registers as + * 64 bit values. It also allows for the possibility of the + * architecture expanding the control registers without having to + * change the userspace ABI. + */ +#define KVM_ARM_MAX_DBG_REGS 16 +struct kvm_guest_debug_arch { + __u64 dbg_bcr[KVM_ARM_MAX_DBG_REGS]; + __u64 dbg_bvr[KVM_ARM_MAX_DBG_REGS]; + __u64 dbg_wcr[KVM_ARM_MAX_DBG_REGS]; + __u64 dbg_wvr[KVM_ARM_MAX_DBG_REGS]; +}; + +struct kvm_debug_exit_arch { + __u32 hsr; + __u64 far; /* used for watchpoints */ +}; + +/* + * Architecture specific defines for kvm_guest_debug->control + */ + +#define KVM_GUESTDBG_USE_SW_BP (1 << 16) +#define KVM_GUESTDBG_USE_HW (1 << 17) + +struct kvm_sync_regs { + /* Used with KVM_CAP_ARM_USER_IRQ */ + __u64 device_irq_level; +}; + +struct kvm_arch_memory_slot { +}; + +/* for KVM_GET/SET_VCPU_EVENTS */ +struct kvm_vcpu_events { + struct { + __u8 serror_pending; + __u8 serror_has_esr; + /* Align it to 8 bytes */ + __u8 pad[6]; + __u64 serror_esr; + } exception; + __u32 reserved[12]; +}; + +/* If you need to interpret the index values, here is the key: */ +#define KVM_REG_ARM_COPROC_MASK 0x000000000FFF0000 +#define KVM_REG_ARM_COPROC_SHIFT 16 + +/* Normal registers are mapped as coprocessor 16. */ +#define KVM_REG_ARM_CORE (0x0010 << KVM_REG_ARM_COPROC_SHIFT) +#define KVM_REG_ARM_CORE_REG(name) (offsetof(struct kvm_regs, name) / sizeof(__u32)) + +/* Some registers need more space to represent values. */ +#define KVM_REG_ARM_DEMUX (0x0011 << KVM_REG_ARM_COPROC_SHIFT) +#define KVM_REG_ARM_DEMUX_ID_MASK 0x000000000000FF00 +#define KVM_REG_ARM_DEMUX_ID_SHIFT 8 +#define KVM_REG_ARM_DEMUX_ID_CCSIDR (0x00 << KVM_REG_ARM_DEMUX_ID_SHIFT) +#define KVM_REG_ARM_DEMUX_VAL_MASK 0x00000000000000FF +#define KVM_REG_ARM_DEMUX_VAL_SHIFT 0 + +/* AArch64 system registers */ +#define KVM_REG_ARM64_SYSREG (0x0013 << KVM_REG_ARM_COPROC_SHIFT) +#define KVM_REG_ARM64_SYSREG_OP0_MASK 0x000000000000c000 +#define KVM_REG_ARM64_SYSREG_OP0_SHIFT 14 +#define KVM_REG_ARM64_SYSREG_OP1_MASK 0x0000000000003800 +#define KVM_REG_ARM64_SYSREG_OP1_SHIFT 11 +#define KVM_REG_ARM64_SYSREG_CRN_MASK 0x0000000000000780 +#define KVM_REG_ARM64_SYSREG_CRN_SHIFT 7 +#define KVM_REG_ARM64_SYSREG_CRM_MASK 0x0000000000000078 +#define KVM_REG_ARM64_SYSREG_CRM_SHIFT 3 +#define KVM_REG_ARM64_SYSREG_OP2_MASK 0x0000000000000007 +#define KVM_REG_ARM64_SYSREG_OP2_SHIFT 0 + +#define ARM64_SYS_REG_SHIFT_MASK(x,n) \ + (((x) << KVM_REG_ARM64_SYSREG_ ## n ## _SHIFT) & \ + KVM_REG_ARM64_SYSREG_ ## n ## _MASK) + +#define __ARM64_SYS_REG(op0,op1,crn,crm,op2) \ + (KVM_REG_ARM64 | KVM_REG_ARM64_SYSREG | \ + ARM64_SYS_REG_SHIFT_MASK(op0, OP0) | \ + ARM64_SYS_REG_SHIFT_MASK(op1, OP1) | \ + ARM64_SYS_REG_SHIFT_MASK(crn, CRN) | \ + ARM64_SYS_REG_SHIFT_MASK(crm, CRM) | \ + ARM64_SYS_REG_SHIFT_MASK(op2, OP2)) + +#define ARM64_SYS_REG(...) (__ARM64_SYS_REG(__VA_ARGS__) | KVM_REG_SIZE_U64) + +/* Physical Timer EL0 Registers */ +#define KVM_REG_ARM_PTIMER_CTL ARM64_SYS_REG(3, 3, 14, 2, 1) +#define KVM_REG_ARM_PTIMER_CVAL ARM64_SYS_REG(3, 3, 14, 2, 2) +#define KVM_REG_ARM_PTIMER_CNT ARM64_SYS_REG(3, 3, 14, 0, 1) + +/* EL0 Virtual Timer Registers */ +#define KVM_REG_ARM_TIMER_CTL ARM64_SYS_REG(3, 3, 14, 3, 1) +#define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2) +#define KVM_REG_ARM_TIMER_CVAL ARM64_SYS_REG(3, 3, 14, 0, 2) + +/* KVM-as-firmware specific pseudo-registers */ +#define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT) +#define KVM_REG_ARM_FW_REG(r) (KVM_REG_ARM64 | KVM_REG_SIZE_U64 | \ + KVM_REG_ARM_FW | ((r) & 0xffff)) +#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0) + +/* Device Control API: ARM VGIC */ +#define KVM_DEV_ARM_VGIC_GRP_ADDR 0 +#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1 +#define KVM_DEV_ARM_VGIC_GRP_CPU_REGS 2 +#define KVM_DEV_ARM_VGIC_CPUID_SHIFT 32 +#define KVM_DEV_ARM_VGIC_CPUID_MASK (0xffULL << KVM_DEV_ARM_VGIC_CPUID_SHIFT) +#define KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT 32 +#define KVM_DEV_ARM_VGIC_V3_MPIDR_MASK \ + (0xffffffffULL << KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT) +#define KVM_DEV_ARM_VGIC_OFFSET_SHIFT 0 +#define KVM_DEV_ARM_VGIC_OFFSET_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_OFFSET_SHIFT) +#define KVM_DEV_ARM_VGIC_SYSREG_INSTR_MASK (0xffff) +#define KVM_DEV_ARM_VGIC_GRP_NR_IRQS 3 +#define KVM_DEV_ARM_VGIC_GRP_CTRL 4 +#define KVM_DEV_ARM_VGIC_GRP_REDIST_REGS 5 +#define KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS 6 +#define KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO 7 +#define KVM_DEV_ARM_VGIC_GRP_ITS_REGS 8 +#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT 10 +#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK \ + (0x3fffffULL << KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT) +#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK 0x3ff +#define VGIC_LEVEL_INFO_LINE_LEVEL 0 + +#define KVM_DEV_ARM_VGIC_CTRL_INIT 0 +#define KVM_DEV_ARM_ITS_SAVE_TABLES 1 +#define KVM_DEV_ARM_ITS_RESTORE_TABLES 2 +#define KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES 3 +#define KVM_DEV_ARM_ITS_CTRL_RESET 4 + +/* Device Control API on vcpu fd */ +#define KVM_ARM_VCPU_PMU_V3_CTRL 0 +#define KVM_ARM_VCPU_PMU_V3_IRQ 0 +#define KVM_ARM_VCPU_PMU_V3_INIT 1 +#define KVM_ARM_VCPU_TIMER_CTRL 1 +#define KVM_ARM_VCPU_TIMER_IRQ_VTIMER 0 +#define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1 + +/* KVM_IRQ_LINE irq field index values */ +#define KVM_ARM_IRQ_TYPE_SHIFT 24 +#define KVM_ARM_IRQ_TYPE_MASK 0xff +#define KVM_ARM_IRQ_VCPU_SHIFT 16 +#define KVM_ARM_IRQ_VCPU_MASK 0xff +#define KVM_ARM_IRQ_NUM_SHIFT 0 +#define KVM_ARM_IRQ_NUM_MASK 0xffff + +/* irq_type field */ +#define KVM_ARM_IRQ_TYPE_CPU 0 +#define KVM_ARM_IRQ_TYPE_SPI 1 +#define KVM_ARM_IRQ_TYPE_PPI 2 + +/* out-of-kernel GIC cpu interrupt injection irq_number field */ +#define KVM_ARM_IRQ_CPU_IRQ 0 +#define KVM_ARM_IRQ_CPU_FIQ 1 + +/* + * This used to hold the highest supported SPI, but it is now obsolete + * and only here to provide source code level compatibility with older + * userland. The highest SPI number can be set via KVM_DEV_ARM_VGIC_GRP_NR_IRQS. + */ +#ifndef __KERNEL__ +#define KVM_ARM_IRQ_GIC_MAX 127 +#endif + +/* One single KVM irqchip, ie. the VGIC */ +#define KVM_NR_IRQCHIPS 1 + +/* PSCI interface */ +#define KVM_PSCI_FN_BASE 0x95c1ba5e +#define KVM_PSCI_FN(n) (KVM_PSCI_FN_BASE + (n)) + +#define KVM_PSCI_FN_CPU_SUSPEND KVM_PSCI_FN(0) +#define KVM_PSCI_FN_CPU_OFF KVM_PSCI_FN(1) +#define KVM_PSCI_FN_CPU_ON KVM_PSCI_FN(2) +#define KVM_PSCI_FN_MIGRATE KVM_PSCI_FN(3) + +#define KVM_PSCI_RET_SUCCESS PSCI_RET_SUCCESS +#define KVM_PSCI_RET_NI PSCI_RET_NOT_SUPPORTED +#define KVM_PSCI_RET_INVAL PSCI_RET_INVALID_PARAMS +#define KVM_PSCI_RET_DENIED PSCI_RET_DENIED + +#endif + +#endif /* __ARM_KVM_H__ */ diff --git a/tools/arch/arm64/include/uapi/asm/mman.h b/tools/arch/arm64/include/uapi/asm/mman.h new file mode 100644 index 000000000..2ee288e44 --- /dev/null +++ b/tools/arch/arm64/include/uapi/asm/mman.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H +#define TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H +#include +/* MAP_32BIT is undefined on arm64, fix it for perf */ +#define MAP_32BIT 0 +#endif diff --git a/tools/arch/arm64/include/uapi/asm/perf_regs.h b/tools/arch/arm64/include/uapi/asm/perf_regs.h new file mode 100644 index 000000000..d54daafa8 --- /dev/null +++ b/tools/arch/arm64/include/uapi/asm/perf_regs.h @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _ASM_ARM64_PERF_REGS_H +#define _ASM_ARM64_PERF_REGS_H + +enum perf_event_arm_regs { + PERF_REG_ARM64_X0, + PERF_REG_ARM64_X1, + PERF_REG_ARM64_X2, + PERF_REG_ARM64_X3, + PERF_REG_ARM64_X4, + PERF_REG_ARM64_X5, + PERF_REG_ARM64_X6, + PERF_REG_ARM64_X7, + PERF_REG_ARM64_X8, + PERF_REG_ARM64_X9, + PERF_REG_ARM64_X10, + PERF_REG_ARM64_X11, + PERF_REG_ARM64_X12, + PERF_REG_ARM64_X13, + PERF_REG_ARM64_X14, + PERF_REG_ARM64_X15, + PERF_REG_ARM64_X16, + PERF_REG_ARM64_X17, + PERF_REG_ARM64_X18, + PERF_REG_ARM64_X19, + PERF_REG_ARM64_X20, + PERF_REG_ARM64_X21, + PERF_REG_ARM64_X22, + PERF_REG_ARM64_X23, + PERF_REG_ARM64_X24, + PERF_REG_ARM64_X25, + PERF_REG_ARM64_X26, + PERF_REG_ARM64_X27, + PERF_REG_ARM64_X28, + PERF_REG_ARM64_X29, + PERF_REG_ARM64_LR, + PERF_REG_ARM64_SP, + PERF_REG_ARM64_PC, + PERF_REG_ARM64_MAX, +}; +#endif /* _ASM_ARM64_PERF_REGS_H */ diff --git a/tools/arch/arm64/include/uapi/asm/unistd.h b/tools/arch/arm64/include/uapi/asm/unistd.h new file mode 100644 index 000000000..5072cbd15 --- /dev/null +++ b/tools/arch/arm64/include/uapi/asm/unistd.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * Copyright (C) 2012 ARM Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#define __ARCH_WANT_RENAMEAT + +#include diff --git a/tools/arch/h8300/include/asm/bitsperlong.h b/tools/arch/h8300/include/asm/bitsperlong.h new file mode 100644 index 000000000..fa1508337 --- /dev/null +++ b/tools/arch/h8300/include/asm/bitsperlong.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_H8300_BITS_PER_LONG +#define __ASM_H8300_BITS_PER_LONG + +#include + +#if !defined(__ASSEMBLY__) +/* h8300-unknown-linux required long */ +#define __kernel_size_t __kernel_size_t +typedef unsigned long __kernel_size_t; +typedef long __kernel_ssize_t; +typedef long __kernel_ptrdiff_t; +#endif + +#endif /* __ASM_H8300_BITS_PER_LONG */ diff --git a/tools/arch/h8300/include/uapi/asm/mman.h b/tools/arch/h8300/include/uapi/asm/mman.h new file mode 100644 index 000000000..be7bbe052 --- /dev/null +++ b/tools/arch/h8300/include/uapi/asm/mman.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H +#define TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H +#include +/* MAP_32BIT is undefined on h8300, fix it for perf */ +#define MAP_32BIT 0 +#endif diff --git a/tools/arch/hexagon/include/uapi/asm/bitsperlong.h b/tools/arch/hexagon/include/uapi/asm/bitsperlong.h new file mode 100644 index 000000000..5adca0d26 --- /dev/null +++ b/tools/arch/hexagon/include/uapi/asm/bitsperlong.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#ifndef __ASM_HEXAGON_BITSPERLONG_H +#define __ASM_HEXAGON_BITSPERLONG_H + +#define __BITS_PER_LONG 32 + +#include + +#endif diff --git a/tools/arch/hexagon/include/uapi/asm/mman.h b/tools/arch/hexagon/include/uapi/asm/mman.h new file mode 100644 index 000000000..cd59ba932 --- /dev/null +++ b/tools/arch/hexagon/include/uapi/asm/mman.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H +#define TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H +#include +/* MAP_32BIT is undefined on hexagon, fix it for perf */ +#define MAP_32BIT 0 +#endif diff --git a/tools/arch/ia64/include/asm/barrier.h b/tools/arch/ia64/include/asm/barrier.h new file mode 100644 index 000000000..90f8bbd9a --- /dev/null +++ b/tools/arch/ia64/include/asm/barrier.h @@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copied from the kernel sources to tools/: + * + * Memory barrier definitions. This is based on information published + * in the Processor Abstraction Layer and the System Abstraction Layer + * manual. + * + * Copyright (C) 1998-2003 Hewlett-Packard Co + * David Mosberger-Tang + * Copyright (C) 1999 Asit Mallick + * Copyright (C) 1999 Don Dugger + */ +#ifndef _TOOLS_LINUX_ASM_IA64_BARRIER_H +#define _TOOLS_LINUX_ASM_IA64_BARRIER_H + +#include + +/* + * Macros to force memory ordering. In these descriptions, "previous" + * and "subsequent" refer to program order; "visible" means that all + * architecturally visible effects of a memory access have occurred + * (at a minimum, this means the memory has been read or written). + * + * wmb(): Guarantees that all preceding stores to memory- + * like regions are visible before any subsequent + * stores and that all following stores will be + * visible only after all previous stores. + * rmb(): Like wmb(), but for reads. + * mb(): wmb()/rmb() combo, i.e., all previous memory + * accesses are visible before all subsequent + * accesses and vice versa. This is also known as + * a "fence." + * + * Note: "mb()" and its variants cannot be used as a fence to order + * accesses to memory mapped I/O registers. For that, mf.a needs to + * be used. However, we don't want to always use mf.a because (a) + * it's (presumably) much slower than mf and (b) mf.a is supported for + * sequential memory pages only. + */ + +#define mb() ia64_mf() +#define rmb() mb() +#define wmb() mb() + +#endif /* _TOOLS_LINUX_ASM_IA64_BARRIER_H */ diff --git a/tools/arch/ia64/include/uapi/asm/bitsperlong.h b/tools/arch/ia64/include/uapi/asm/bitsperlong.h new file mode 100644 index 000000000..1146d5556 --- /dev/null +++ b/tools/arch/ia64/include/uapi/asm/bitsperlong.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_IA64_BITSPERLONG_H +#define __ASM_IA64_BITSPERLONG_H + +#define __BITS_PER_LONG 64 + +#include + +#endif /* __ASM_IA64_BITSPERLONG_H */ diff --git a/tools/arch/ia64/include/uapi/asm/mman.h b/tools/arch/ia64/include/uapi/asm/mman.h new file mode 100644 index 000000000..2a19bb1db --- /dev/null +++ b/tools/arch/ia64/include/uapi/asm/mman.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H +#define TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H +#include +/* MAP_32BIT is undefined on ia64, fix it for perf */ +#define MAP_32BIT 0 +#endif diff --git a/tools/arch/microblaze/include/uapi/asm/bitsperlong.h b/tools/arch/microblaze/include/uapi/asm/bitsperlong.h new file mode 100644 index 000000000..76da34b10 --- /dev/null +++ b/tools/arch/microblaze/include/uapi/asm/bitsperlong.h @@ -0,0 +1,2 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#include diff --git a/tools/arch/microblaze/include/uapi/asm/mman.h b/tools/arch/microblaze/include/uapi/asm/mman.h new file mode 100644 index 000000000..f3f2103fd --- /dev/null +++ b/tools/arch/microblaze/include/uapi/asm/mman.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H +#define TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H +#include +/* MAP_32BIT is undefined on microblaze, fix it for perf */ +#define MAP_32BIT 0 +#endif diff --git a/tools/arch/mips/include/asm/barrier.h b/tools/arch/mips/include/asm/barrier.h new file mode 100644 index 000000000..0d1191523 --- /dev/null +++ b/tools/arch/mips/include/asm/barrier.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _TOOLS_LINUX_ASM_MIPS_BARRIER_H +#define _TOOLS_LINUX_ASM_MIPS_BARRIER_H +/* + * FIXME: This came from tools/perf/perf-sys.h, where it was first introduced + * in c1e028ef40b8d6943b767028ba17d4f2ba020edb, more work needed to make it + * more closely follow the Linux kernel arch/mips/include/asm/barrier.h file. + * Probably when we continue work on tools/ Kconfig support to have all the + * CONFIG_ needed for properly doing that. + */ +#define mb() asm volatile( \ + ".set mips2\n\t" \ + "sync\n\t" \ + ".set mips0" \ + : /* no output */ \ + : /* no input */ \ + : "memory") +#define wmb() mb() +#define rmb() mb() + +#endif /* _TOOLS_LINUX_ASM_MIPS_BARRIER_H */ diff --git a/tools/arch/mips/include/asm/errno.h b/tools/arch/mips/include/asm/errno.h new file mode 100644 index 000000000..21d91cdfe --- /dev/null +++ b/tools/arch/mips/include/asm/errno.h @@ -0,0 +1,17 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995, 1999, 2001, 2002 by Ralf Baechle + */ +#ifndef _ASM_ERRNO_H +#define _ASM_ERRNO_H + +#include + + +/* The biggest error number defined here or in . */ +#define EMAXERRNO 1133 + +#endif /* _ASM_ERRNO_H */ diff --git a/tools/arch/mips/include/uapi/asm/bitsperlong.h b/tools/arch/mips/include/uapi/asm/bitsperlong.h new file mode 100644 index 000000000..7268380d8 --- /dev/null +++ b/tools/arch/mips/include/uapi/asm/bitsperlong.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_MIPS_BITSPERLONG_H +#define __ASM_MIPS_BITSPERLONG_H + +#define __BITS_PER_LONG _MIPS_SZLONG + +#include + +#endif /* __ASM_MIPS_BITSPERLONG_H */ diff --git a/tools/arch/mips/include/uapi/asm/errno.h b/tools/arch/mips/include/uapi/asm/errno.h new file mode 100644 index 000000000..2fb714e2d --- /dev/null +++ b/tools/arch/mips/include/uapi/asm/errno.h @@ -0,0 +1,130 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995, 1999, 2001, 2002 by Ralf Baechle + */ +#ifndef _UAPI_ASM_ERRNO_H +#define _UAPI_ASM_ERRNO_H + +/* + * These error numbers are intended to be MIPS ABI compatible + */ + +#include + +#define ENOMSG 35 /* No message of desired type */ +#define EIDRM 36 /* Identifier removed */ +#define ECHRNG 37 /* Channel number out of range */ +#define EL2NSYNC 38 /* Level 2 not synchronized */ +#define EL3HLT 39 /* Level 3 halted */ +#define EL3RST 40 /* Level 3 reset */ +#define ELNRNG 41 /* Link number out of range */ +#define EUNATCH 42 /* Protocol driver not attached */ +#define ENOCSI 43 /* No CSI structure available */ +#define EL2HLT 44 /* Level 2 halted */ +#define EDEADLK 45 /* Resource deadlock would occur */ +#define ENOLCK 46 /* No record locks available */ +#define EBADE 50 /* Invalid exchange */ +#define EBADR 51 /* Invalid request descriptor */ +#define EXFULL 52 /* Exchange full */ +#define ENOANO 53 /* No anode */ +#define EBADRQC 54 /* Invalid request code */ +#define EBADSLT 55 /* Invalid slot */ +#define EDEADLOCK 56 /* File locking deadlock error */ +#define EBFONT 59 /* Bad font file format */ +#define ENOSTR 60 /* Device not a stream */ +#define ENODATA 61 /* No data available */ +#define ETIME 62 /* Timer expired */ +#define ENOSR 63 /* Out of streams resources */ +#define ENONET 64 /* Machine is not on the network */ +#define ENOPKG 65 /* Package not installed */ +#define EREMOTE 66 /* Object is remote */ +#define ENOLINK 67 /* Link has been severed */ +#define EADV 68 /* Advertise error */ +#define ESRMNT 69 /* Srmount error */ +#define ECOMM 70 /* Communication error on send */ +#define EPROTO 71 /* Protocol error */ +#define EDOTDOT 73 /* RFS specific error */ +#define EMULTIHOP 74 /* Multihop attempted */ +#define EBADMSG 77 /* Not a data message */ +#define ENAMETOOLONG 78 /* File name too long */ +#define EOVERFLOW 79 /* Value too large for defined data type */ +#define ENOTUNIQ 80 /* Name not unique on network */ +#define EBADFD 81 /* File descriptor in bad state */ +#define EREMCHG 82 /* Remote address changed */ +#define ELIBACC 83 /* Can not access a needed shared library */ +#define ELIBBAD 84 /* Accessing a corrupted shared library */ +#define ELIBSCN 85 /* .lib section in a.out corrupted */ +#define ELIBMAX 86 /* Attempting to link in too many shared libraries */ +#define ELIBEXEC 87 /* Cannot exec a shared library directly */ +#define EILSEQ 88 /* Illegal byte sequence */ +#define ENOSYS 89 /* Function not implemented */ +#define ELOOP 90 /* Too many symbolic links encountered */ +#define ERESTART 91 /* Interrupted system call should be restarted */ +#define ESTRPIPE 92 /* Streams pipe error */ +#define ENOTEMPTY 93 /* Directory not empty */ +#define EUSERS 94 /* Too many users */ +#define ENOTSOCK 95 /* Socket operation on non-socket */ +#define EDESTADDRREQ 96 /* Destination address required */ +#define EMSGSIZE 97 /* Message too long */ +#define EPROTOTYPE 98 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 99 /* Protocol not available */ +#define EPROTONOSUPPORT 120 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 121 /* Socket type not supported */ +#define EOPNOTSUPP 122 /* Operation not supported on transport endpoint */ +#define EPFNOSUPPORT 123 /* Protocol family not supported */ +#define EAFNOSUPPORT 124 /* Address family not supported by protocol */ +#define EADDRINUSE 125 /* Address already in use */ +#define EADDRNOTAVAIL 126 /* Cannot assign requested address */ +#define ENETDOWN 127 /* Network is down */ +#define ENETUNREACH 128 /* Network is unreachable */ +#define ENETRESET 129 /* Network dropped connection because of reset */ +#define ECONNABORTED 130 /* Software caused connection abort */ +#define ECONNRESET 131 /* Connection reset by peer */ +#define ENOBUFS 132 /* No buffer space available */ +#define EISCONN 133 /* Transport endpoint is already connected */ +#define ENOTCONN 134 /* Transport endpoint is not connected */ +#define EUCLEAN 135 /* Structure needs cleaning */ +#define ENOTNAM 137 /* Not a XENIX named type file */ +#define ENAVAIL 138 /* No XENIX semaphores available */ +#define EISNAM 139 /* Is a named type file */ +#define EREMOTEIO 140 /* Remote I/O error */ +#define EINIT 141 /* Reserved */ +#define EREMDEV 142 /* Error 142 */ +#define ESHUTDOWN 143 /* Cannot send after transport endpoint shutdown */ +#define ETOOMANYREFS 144 /* Too many references: cannot splice */ +#define ETIMEDOUT 145 /* Connection timed out */ +#define ECONNREFUSED 146 /* Connection refused */ +#define EHOSTDOWN 147 /* Host is down */ +#define EHOSTUNREACH 148 /* No route to host */ +#define EWOULDBLOCK EAGAIN /* Operation would block */ +#define EALREADY 149 /* Operation already in progress */ +#define EINPROGRESS 150 /* Operation now in progress */ +#define ESTALE 151 /* Stale file handle */ +#define ECANCELED 158 /* AIO operation canceled */ + +/* + * These error are Linux extensions. + */ +#define ENOMEDIUM 159 /* No medium found */ +#define EMEDIUMTYPE 160 /* Wrong medium type */ +#define ENOKEY 161 /* Required key not available */ +#define EKEYEXPIRED 162 /* Key has expired */ +#define EKEYREVOKED 163 /* Key has been revoked */ +#define EKEYREJECTED 164 /* Key was rejected by service */ + +/* for robust mutexes */ +#define EOWNERDEAD 165 /* Owner died */ +#define ENOTRECOVERABLE 166 /* State not recoverable */ + +#define ERFKILL 167 /* Operation not possible due to RF-kill */ + +#define EHWPOISON 168 /* Memory page has hardware error */ + +#define EDQUOT 1133 /* Quota exceeded */ + + +#endif /* _UAPI_ASM_ERRNO_H */ diff --git a/tools/arch/mips/include/uapi/asm/kvm.h b/tools/arch/mips/include/uapi/asm/kvm.h new file mode 100644 index 000000000..d2714cc1c --- /dev/null +++ b/tools/arch/mips/include/uapi/asm/kvm.h @@ -0,0 +1,209 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. + * Copyright (C) 2013 Cavium, Inc. + * Authors: Sanjay Lal + */ + +#ifndef __LINUX_KVM_MIPS_H +#define __LINUX_KVM_MIPS_H + +#include + +/* + * KVM MIPS specific structures and definitions. + * + * Some parts derived from the x86 version of this file. + */ + +/* + * for KVM_GET_REGS and KVM_SET_REGS + * + * If Config[AT] is zero (32-bit CPU), the register contents are + * stored in the lower 32-bits of the struct kvm_regs fields and sign + * extended to 64-bits. + */ +struct kvm_regs { + /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */ + __u64 gpr[32]; + __u64 hi; + __u64 lo; + __u64 pc; +}; + +/* + * for KVM_GET_FPU and KVM_SET_FPU + */ +struct kvm_fpu { +}; + + +/* + * For MIPS, we use KVM_SET_ONE_REG and KVM_GET_ONE_REG to access various + * registers. The id field is broken down as follows: + * + * bits[63..52] - As per linux/kvm.h + * bits[51..32] - Must be zero. + * bits[31..16] - Register set. + * + * Register set = 0: GP registers from kvm_regs (see definitions below). + * + * Register set = 1: CP0 registers. + * bits[15..8] - Must be zero. + * bits[7..3] - Register 'rd' index. + * bits[2..0] - Register 'sel' index. + * + * Register set = 2: KVM specific registers (see definitions below). + * + * Register set = 3: FPU / MSA registers (see definitions below). + * + * Other sets registers may be added in the future. Each set would + * have its own identifier in bits[31..16]. + */ + +#define KVM_REG_MIPS_GP (KVM_REG_MIPS | 0x0000000000000000ULL) +#define KVM_REG_MIPS_CP0 (KVM_REG_MIPS | 0x0000000000010000ULL) +#define KVM_REG_MIPS_KVM (KVM_REG_MIPS | 0x0000000000020000ULL) +#define KVM_REG_MIPS_FPU (KVM_REG_MIPS | 0x0000000000030000ULL) + + +/* + * KVM_REG_MIPS_GP - General purpose registers from kvm_regs. + */ + +#define KVM_REG_MIPS_R0 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 0) +#define KVM_REG_MIPS_R1 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 1) +#define KVM_REG_MIPS_R2 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 2) +#define KVM_REG_MIPS_R3 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 3) +#define KVM_REG_MIPS_R4 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 4) +#define KVM_REG_MIPS_R5 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 5) +#define KVM_REG_MIPS_R6 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 6) +#define KVM_REG_MIPS_R7 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 7) +#define KVM_REG_MIPS_R8 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 8) +#define KVM_REG_MIPS_R9 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 9) +#define KVM_REG_MIPS_R10 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 10) +#define KVM_REG_MIPS_R11 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 11) +#define KVM_REG_MIPS_R12 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 12) +#define KVM_REG_MIPS_R13 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 13) +#define KVM_REG_MIPS_R14 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 14) +#define KVM_REG_MIPS_R15 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 15) +#define KVM_REG_MIPS_R16 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 16) +#define KVM_REG_MIPS_R17 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 17) +#define KVM_REG_MIPS_R18 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 18) +#define KVM_REG_MIPS_R19 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 19) +#define KVM_REG_MIPS_R20 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 20) +#define KVM_REG_MIPS_R21 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 21) +#define KVM_REG_MIPS_R22 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 22) +#define KVM_REG_MIPS_R23 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 23) +#define KVM_REG_MIPS_R24 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 24) +#define KVM_REG_MIPS_R25 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 25) +#define KVM_REG_MIPS_R26 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 26) +#define KVM_REG_MIPS_R27 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 27) +#define KVM_REG_MIPS_R28 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 28) +#define KVM_REG_MIPS_R29 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 29) +#define KVM_REG_MIPS_R30 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 30) +#define KVM_REG_MIPS_R31 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 31) + +#define KVM_REG_MIPS_HI (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 32) +#define KVM_REG_MIPS_LO (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 33) +#define KVM_REG_MIPS_PC (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 34) + + +/* + * KVM_REG_MIPS_KVM - KVM specific control registers. + */ + +/* + * CP0_Count control + * DC: Set 0: Master disable CP0_Count and set COUNT_RESUME to now + * Set 1: Master re-enable CP0_Count with unchanged bias, handling timer + * interrupts since COUNT_RESUME + * This can be used to freeze the timer to get a consistent snapshot of + * the CP0_Count and timer interrupt pending state, while also resuming + * safely without losing time or guest timer interrupts. + * Other: Reserved, do not change. + */ +#define KVM_REG_MIPS_COUNT_CTL (KVM_REG_MIPS_KVM | KVM_REG_SIZE_U64 | 0) +#define KVM_REG_MIPS_COUNT_CTL_DC 0x00000001 + +/* + * CP0_Count resume monotonic nanoseconds + * The monotonic nanosecond time of the last set of COUNT_CTL.DC (master + * disable). Any reads and writes of Count related registers while + * COUNT_CTL.DC=1 will appear to occur at this time. When COUNT_CTL.DC is + * cleared again (master enable) any timer interrupts since this time will be + * emulated. + * Modifications to times in the future are rejected. + */ +#define KVM_REG_MIPS_COUNT_RESUME (KVM_REG_MIPS_KVM | KVM_REG_SIZE_U64 | 1) +/* + * CP0_Count rate in Hz + * Specifies the rate of the CP0_Count timer in Hz. Modifications occur without + * discontinuities in CP0_Count. + */ +#define KVM_REG_MIPS_COUNT_HZ (KVM_REG_MIPS_KVM | KVM_REG_SIZE_U64 | 2) + + +/* + * KVM_REG_MIPS_FPU - Floating Point and MIPS SIMD Architecture (MSA) registers. + * + * bits[15..8] - Register subset (see definitions below). + * bits[7..5] - Must be zero. + * bits[4..0] - Register number within register subset. + */ + +#define KVM_REG_MIPS_FPR (KVM_REG_MIPS_FPU | 0x0000000000000000ULL) +#define KVM_REG_MIPS_FCR (KVM_REG_MIPS_FPU | 0x0000000000000100ULL) +#define KVM_REG_MIPS_MSACR (KVM_REG_MIPS_FPU | 0x0000000000000200ULL) + +/* + * KVM_REG_MIPS_FPR - Floating point / Vector registers. + */ +#define KVM_REG_MIPS_FPR_32(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U32 | (n)) +#define KVM_REG_MIPS_FPR_64(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U64 | (n)) +#define KVM_REG_MIPS_VEC_128(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U128 | (n)) + +/* + * KVM_REG_MIPS_FCR - Floating point control registers. + */ +#define KVM_REG_MIPS_FCR_IR (KVM_REG_MIPS_FCR | KVM_REG_SIZE_U32 | 0) +#define KVM_REG_MIPS_FCR_CSR (KVM_REG_MIPS_FCR | KVM_REG_SIZE_U32 | 31) + +/* + * KVM_REG_MIPS_MSACR - MIPS SIMD Architecture (MSA) control registers. + */ +#define KVM_REG_MIPS_MSA_IR (KVM_REG_MIPS_MSACR | KVM_REG_SIZE_U32 | 0) +#define KVM_REG_MIPS_MSA_CSR (KVM_REG_MIPS_MSACR | KVM_REG_SIZE_U32 | 1) + + +/* + * KVM MIPS specific structures and definitions + * + */ +struct kvm_debug_exit_arch { + __u64 epc; +}; + +/* for KVM_SET_GUEST_DEBUG */ +struct kvm_guest_debug_arch { +}; + +/* definition of registers in kvm_run */ +struct kvm_sync_regs { +}; + +/* dummy definition */ +struct kvm_sregs { +}; + +struct kvm_mips_interrupt { + /* in */ + __u32 cpu; + __u32 irq; +}; + +#endif /* __LINUX_KVM_MIPS_H */ diff --git a/tools/arch/mips/include/uapi/asm/mman.h b/tools/arch/mips/include/uapi/asm/mman.h new file mode 100644 index 000000000..de2206883 --- /dev/null +++ b/tools/arch/mips/include/uapi/asm/mman.h @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H +#define TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H +#define MADV_DODUMP 17 +#define MADV_DOFORK 11 +#define MADV_DONTDUMP 16 +#define MADV_DONTFORK 10 +#define MADV_DONTNEED 4 +#define MADV_FREE 8 +#define MADV_HUGEPAGE 14 +#define MADV_HWPOISON 100 +#define MADV_MERGEABLE 12 +#define MADV_NOHUGEPAGE 15 +#define MADV_NORMAL 0 +#define MADV_RANDOM 1 +#define MADV_REMOVE 9 +#define MADV_SEQUENTIAL 2 +#define MADV_UNMERGEABLE 13 +#define MADV_WILLNEED 3 +#define MAP_ANONYMOUS 0x0800 +#define MAP_DENYWRITE 0x2000 +#define MAP_EXECUTABLE 0x4000 +#define MAP_FILE 0 +#define MAP_FIXED 0x010 +#define MAP_GROWSDOWN 0x1000 +#define MAP_HUGETLB 0x80000 +#define MAP_LOCKED 0x8000 +#define MAP_NONBLOCK 0x20000 +#define MAP_NORESERVE 0x0400 +#define MAP_POPULATE 0x10000 +#define MAP_PRIVATE 0x002 +#define MAP_SHARED 0x001 +#define MAP_STACK 0x40000 +#define PROT_EXEC 0x04 +#define PROT_GROWSDOWN 0x01000000 +#define PROT_GROWSUP 0x02000000 +#define PROT_NONE 0x00 +#define PROT_READ 0x01 +#define PROT_SEM 0x10 +#define PROT_WRITE 0x02 +/* MADV_SOFT_OFFLINE is undefined on mips, fix it for perf */ +#define MADV_SOFT_OFFLINE 101 +/* MAP_32BIT is undefined on mips, fix it for perf */ +#define MAP_32BIT 0 +/* MAP_UNINITIALIZED is undefined on mips, fix it for perf */ +#define MAP_UNINITIALIZED 0 +#endif diff --git a/tools/arch/parisc/include/uapi/asm/bitsperlong.h b/tools/arch/parisc/include/uapi/asm/bitsperlong.h new file mode 100644 index 000000000..23ac75629 --- /dev/null +++ b/tools/arch/parisc/include/uapi/asm/bitsperlong.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_PARISC_BITSPERLONG_H +#define __ASM_PARISC_BITSPERLONG_H + +#if defined(__LP64__) +#define __BITS_PER_LONG 64 +#define SHIFT_PER_LONG 6 +#else +#define __BITS_PER_LONG 32 +#define SHIFT_PER_LONG 5 +#endif + +#include + +#endif /* __ASM_PARISC_BITSPERLONG_H */ diff --git a/tools/arch/parisc/include/uapi/asm/errno.h b/tools/arch/parisc/include/uapi/asm/errno.h new file mode 100644 index 000000000..87245c584 --- /dev/null +++ b/tools/arch/parisc/include/uapi/asm/errno.h @@ -0,0 +1,127 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _PARISC_ERRNO_H +#define _PARISC_ERRNO_H + +#include + +#define ENOMSG 35 /* No message of desired type */ +#define EIDRM 36 /* Identifier removed */ +#define ECHRNG 37 /* Channel number out of range */ +#define EL2NSYNC 38 /* Level 2 not synchronized */ +#define EL3HLT 39 /* Level 3 halted */ +#define EL3RST 40 /* Level 3 reset */ +#define ELNRNG 41 /* Link number out of range */ +#define EUNATCH 42 /* Protocol driver not attached */ +#define ENOCSI 43 /* No CSI structure available */ +#define EL2HLT 44 /* Level 2 halted */ +#define EDEADLK 45 /* Resource deadlock would occur */ +#define EDEADLOCK EDEADLK +#define ENOLCK 46 /* No record locks available */ +#define EILSEQ 47 /* Illegal byte sequence */ + +#define ENONET 50 /* Machine is not on the network */ +#define ENODATA 51 /* No data available */ +#define ETIME 52 /* Timer expired */ +#define ENOSR 53 /* Out of streams resources */ +#define ENOSTR 54 /* Device not a stream */ +#define ENOPKG 55 /* Package not installed */ + +#define ENOLINK 57 /* Link has been severed */ +#define EADV 58 /* Advertise error */ +#define ESRMNT 59 /* Srmount error */ +#define ECOMM 60 /* Communication error on send */ +#define EPROTO 61 /* Protocol error */ + +#define EMULTIHOP 64 /* Multihop attempted */ + +#define EDOTDOT 66 /* RFS specific error */ +#define EBADMSG 67 /* Not a data message */ +#define EUSERS 68 /* Too many users */ +#define EDQUOT 69 /* Quota exceeded */ +#define ESTALE 70 /* Stale file handle */ +#define EREMOTE 71 /* Object is remote */ +#define EOVERFLOW 72 /* Value too large for defined data type */ + +/* these errnos are defined by Linux but not HPUX. */ + +#define EBADE 160 /* Invalid exchange */ +#define EBADR 161 /* Invalid request descriptor */ +#define EXFULL 162 /* Exchange full */ +#define ENOANO 163 /* No anode */ +#define EBADRQC 164 /* Invalid request code */ +#define EBADSLT 165 /* Invalid slot */ +#define EBFONT 166 /* Bad font file format */ +#define ENOTUNIQ 167 /* Name not unique on network */ +#define EBADFD 168 /* File descriptor in bad state */ +#define EREMCHG 169 /* Remote address changed */ +#define ELIBACC 170 /* Can not access a needed shared library */ +#define ELIBBAD 171 /* Accessing a corrupted shared library */ +#define ELIBSCN 172 /* .lib section in a.out corrupted */ +#define ELIBMAX 173 /* Attempting to link in too many shared libraries */ +#define ELIBEXEC 174 /* Cannot exec a shared library directly */ +#define ERESTART 175 /* Interrupted system call should be restarted */ +#define ESTRPIPE 176 /* Streams pipe error */ +#define EUCLEAN 177 /* Structure needs cleaning */ +#define ENOTNAM 178 /* Not a XENIX named type file */ +#define ENAVAIL 179 /* No XENIX semaphores available */ +#define EISNAM 180 /* Is a named type file */ +#define EREMOTEIO 181 /* Remote I/O error */ +#define ENOMEDIUM 182 /* No medium found */ +#define EMEDIUMTYPE 183 /* Wrong medium type */ +#define ENOKEY 184 /* Required key not available */ +#define EKEYEXPIRED 185 /* Key has expired */ +#define EKEYREVOKED 186 /* Key has been revoked */ +#define EKEYREJECTED 187 /* Key was rejected by service */ + +/* We now return you to your regularly scheduled HPUX. */ + +#define ENOSYM 215 /* symbol does not exist in executable */ +#define ENOTSOCK 216 /* Socket operation on non-socket */ +#define EDESTADDRREQ 217 /* Destination address required */ +#define EMSGSIZE 218 /* Message too long */ +#define EPROTOTYPE 219 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 220 /* Protocol not available */ +#define EPROTONOSUPPORT 221 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 222 /* Socket type not supported */ +#define EOPNOTSUPP 223 /* Operation not supported on transport endpoint */ +#define EPFNOSUPPORT 224 /* Protocol family not supported */ +#define EAFNOSUPPORT 225 /* Address family not supported by protocol */ +#define EADDRINUSE 226 /* Address already in use */ +#define EADDRNOTAVAIL 227 /* Cannot assign requested address */ +#define ENETDOWN 228 /* Network is down */ +#define ENETUNREACH 229 /* Network is unreachable */ +#define ENETRESET 230 /* Network dropped connection because of reset */ +#define ECONNABORTED 231 /* Software caused connection abort */ +#define ECONNRESET 232 /* Connection reset by peer */ +#define ENOBUFS 233 /* No buffer space available */ +#define EISCONN 234 /* Transport endpoint is already connected */ +#define ENOTCONN 235 /* Transport endpoint is not connected */ +#define ESHUTDOWN 236 /* Cannot send after transport endpoint shutdown */ +#define ETOOMANYREFS 237 /* Too many references: cannot splice */ +#define ETIMEDOUT 238 /* Connection timed out */ +#define ECONNREFUSED 239 /* Connection refused */ +#define EREFUSED ECONNREFUSED /* for HP's NFS apparently */ +#define EREMOTERELEASE 240 /* Remote peer released connection */ +#define EHOSTDOWN 241 /* Host is down */ +#define EHOSTUNREACH 242 /* No route to host */ + +#define EALREADY 244 /* Operation already in progress */ +#define EINPROGRESS 245 /* Operation now in progress */ +#define EWOULDBLOCK EAGAIN /* Operation would block (Not HPUX compliant) */ +#define ENOTEMPTY 247 /* Directory not empty */ +#define ENAMETOOLONG 248 /* File name too long */ +#define ELOOP 249 /* Too many symbolic links encountered */ +#define ENOSYS 251 /* Function not implemented */ + +#define ECANCELLED 253 /* aio request was canceled before complete (POSIX.4 / HPUX) */ +#define ECANCELED ECANCELLED /* SuSv3 and Solaris wants one 'L' */ + +/* for robust mutexes */ +#define EOWNERDEAD 254 /* Owner died */ +#define ENOTRECOVERABLE 255 /* State not recoverable */ + +#define ERFKILL 256 /* Operation not possible due to RF-kill */ + +#define EHWPOISON 257 /* Memory page has hardware error */ + +#endif diff --git a/tools/arch/parisc/include/uapi/asm/mman.h b/tools/arch/parisc/include/uapi/asm/mman.h new file mode 100644 index 000000000..1bd78758b --- /dev/null +++ b/tools/arch/parisc/include/uapi/asm/mman.h @@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H +#define TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H +#define MADV_DODUMP 70 +#define MADV_DOFORK 11 +#define MADV_DONTDUMP 69 +#define MADV_DONTFORK 10 +#define MADV_DONTNEED 4 +#define MADV_FREE 8 +#define MADV_HUGEPAGE 67 +#define MADV_MERGEABLE 65 +#define MADV_NOHUGEPAGE 68 +#define MADV_NORMAL 0 +#define MADV_RANDOM 1 +#define MADV_REMOVE 9 +#define MADV_SEQUENTIAL 2 +#define MADV_UNMERGEABLE 66 +#define MADV_WILLNEED 3 +#define MAP_ANONYMOUS 0x10 +#define MAP_DENYWRITE 0x0800 +#define MAP_EXECUTABLE 0x1000 +#define MAP_FILE 0 +#define MAP_FIXED 0x04 +#define MAP_GROWSDOWN 0x8000 +#define MAP_HUGETLB 0x80000 +#define MAP_LOCKED 0x2000 +#define MAP_NONBLOCK 0x20000 +#define MAP_NORESERVE 0x4000 +#define MAP_POPULATE 0x10000 +#define MAP_PRIVATE 0x02 +#define MAP_SHARED 0x01 +#define MAP_STACK 0x40000 +#define PROT_EXEC 0x4 +#define PROT_GROWSDOWN 0x01000000 +#define PROT_GROWSUP 0x02000000 +#define PROT_NONE 0x0 +#define PROT_READ 0x1 +#define PROT_SEM 0x8 +#define PROT_WRITE 0x2 +#define MADV_HWPOISON 100 +#define MADV_SOFT_OFFLINE 101 +/* MAP_32BIT is undefined on parisc, fix it for perf */ +#define MAP_32BIT 0 +/* MAP_UNINITIALIZED is undefined on parisc, fix it for perf */ +#define MAP_UNINITIALIZED 0 +#endif diff --git a/tools/arch/powerpc/include/asm/barrier.h b/tools/arch/powerpc/include/asm/barrier.h new file mode 100644 index 000000000..a634da05b --- /dev/null +++ b/tools/arch/powerpc/include/asm/barrier.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copied from the kernel sources: + * + * Copyright (C) 1999 Cort Dougan + */ +#ifndef _TOOLS_LINUX_ASM_POWERPC_BARRIER_H +#define _TOOLS_LINUX_ASM_POWERPC_BARRIER_H + +/* + * Memory barrier. + * The sync instruction guarantees that all memory accesses initiated + * by this processor have been performed (with respect to all other + * mechanisms that access memory). The eieio instruction is a barrier + * providing an ordering (separately) for (a) cacheable stores and (b) + * loads and stores to non-cacheable memory (e.g. I/O devices). + * + * mb() prevents loads and stores being reordered across this point. + * rmb() prevents loads being reordered across this point. + * wmb() prevents stores being reordered across this point. + * + * *mb() variants without smp_ prefix must order all types of memory + * operations with one another. sync is the only instruction sufficient + * to do this. + */ +#define mb() __asm__ __volatile__ ("sync" : : : "memory") +#define rmb() __asm__ __volatile__ ("sync" : : : "memory") +#define wmb() __asm__ __volatile__ ("sync" : : : "memory") + +#endif /* _TOOLS_LINUX_ASM_POWERPC_BARRIER_H */ diff --git a/tools/arch/powerpc/include/uapi/asm/bitsperlong.h b/tools/arch/powerpc/include/uapi/asm/bitsperlong.h new file mode 100644 index 000000000..46ece3ecf --- /dev/null +++ b/tools/arch/powerpc/include/uapi/asm/bitsperlong.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_POWERPC_BITSPERLONG_H +#define __ASM_POWERPC_BITSPERLONG_H + +#if defined(__powerpc64__) +# define __BITS_PER_LONG 64 +#else +# define __BITS_PER_LONG 32 +#endif + +#include + +#endif /* __ASM_POWERPC_BITSPERLONG_H */ diff --git a/tools/arch/powerpc/include/uapi/asm/errno.h b/tools/arch/powerpc/include/uapi/asm/errno.h new file mode 100644 index 000000000..cc7985689 --- /dev/null +++ b/tools/arch/powerpc/include/uapi/asm/errno.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _ASM_POWERPC_ERRNO_H +#define _ASM_POWERPC_ERRNO_H + +#include + +#undef EDEADLOCK +#define EDEADLOCK 58 /* File locking deadlock error */ + +#endif /* _ASM_POWERPC_ERRNO_H */ diff --git a/tools/arch/powerpc/include/uapi/asm/kvm.h b/tools/arch/powerpc/include/uapi/asm/kvm.h new file mode 100644 index 000000000..1b32b56a0 --- /dev/null +++ b/tools/arch/powerpc/include/uapi/asm/kvm.h @@ -0,0 +1,677 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright IBM Corp. 2007 + * + * Authors: Hollis Blanchard + */ + +#ifndef __LINUX_KVM_POWERPC_H +#define __LINUX_KVM_POWERPC_H + +#include + +/* Select powerpc specific features in */ +#define __KVM_HAVE_SPAPR_TCE +#define __KVM_HAVE_PPC_SMT +#define __KVM_HAVE_IRQCHIP +#define __KVM_HAVE_IRQ_LINE +#define __KVM_HAVE_GUEST_DEBUG + +/* Not always available, but if it is, this is the correct offset. */ +#define KVM_COALESCED_MMIO_PAGE_OFFSET 1 + +struct kvm_regs { + __u64 pc; + __u64 cr; + __u64 ctr; + __u64 lr; + __u64 xer; + __u64 msr; + __u64 srr0; + __u64 srr1; + __u64 pid; + + __u64 sprg0; + __u64 sprg1; + __u64 sprg2; + __u64 sprg3; + __u64 sprg4; + __u64 sprg5; + __u64 sprg6; + __u64 sprg7; + + __u64 gpr[32]; +}; + +#define KVM_SREGS_E_IMPL_NONE 0 +#define KVM_SREGS_E_IMPL_FSL 1 + +#define KVM_SREGS_E_FSL_PIDn (1 << 0) /* PID1/PID2 */ + +/* flags for kvm_run.flags */ +#define KVM_RUN_PPC_NMI_DISP_MASK (3 << 0) +#define KVM_RUN_PPC_NMI_DISP_FULLY_RECOV (1 << 0) +#define KVM_RUN_PPC_NMI_DISP_LIMITED_RECOV (2 << 0) +#define KVM_RUN_PPC_NMI_DISP_NOT_RECOV (3 << 0) + +/* + * Feature bits indicate which sections of the sregs struct are valid, + * both in KVM_GET_SREGS and KVM_SET_SREGS. On KVM_SET_SREGS, registers + * corresponding to unset feature bits will not be modified. This allows + * restoring a checkpoint made without that feature, while keeping the + * default values of the new registers. + * + * KVM_SREGS_E_BASE contains: + * CSRR0/1 (refers to SRR2/3 on 40x) + * ESR + * DEAR + * MCSR + * TSR + * TCR + * DEC + * TB + * VRSAVE (USPRG0) + */ +#define KVM_SREGS_E_BASE (1 << 0) + +/* + * KVM_SREGS_E_ARCH206 contains: + * + * PIR + * MCSRR0/1 + * DECAR + * IVPR + */ +#define KVM_SREGS_E_ARCH206 (1 << 1) + +/* + * Contains EPCR, plus the upper half of 64-bit registers + * that are 32-bit on 32-bit implementations. + */ +#define KVM_SREGS_E_64 (1 << 2) + +#define KVM_SREGS_E_SPRG8 (1 << 3) +#define KVM_SREGS_E_MCIVPR (1 << 4) + +/* + * IVORs are used -- contains IVOR0-15, plus additional IVORs + * in combination with an appropriate feature bit. + */ +#define KVM_SREGS_E_IVOR (1 << 5) + +/* + * Contains MAS0-4, MAS6-7, TLBnCFG, MMUCFG. + * Also TLBnPS if MMUCFG[MAVN] = 1. + */ +#define KVM_SREGS_E_ARCH206_MMU (1 << 6) + +/* DBSR, DBCR, IAC, DAC, DVC */ +#define KVM_SREGS_E_DEBUG (1 << 7) + +/* Enhanced debug -- DSRR0/1, SPRG9 */ +#define KVM_SREGS_E_ED (1 << 8) + +/* Embedded Floating Point (SPE) -- IVOR32-34 if KVM_SREGS_E_IVOR */ +#define KVM_SREGS_E_SPE (1 << 9) + +/* + * DEPRECATED! USE ONE_REG FOR THIS ONE! + * External Proxy (EXP) -- EPR + */ +#define KVM_SREGS_EXP (1 << 10) + +/* External PID (E.PD) -- EPSC/EPLC */ +#define KVM_SREGS_E_PD (1 << 11) + +/* Processor Control (E.PC) -- IVOR36-37 if KVM_SREGS_E_IVOR */ +#define KVM_SREGS_E_PC (1 << 12) + +/* Page table (E.PT) -- EPTCFG */ +#define KVM_SREGS_E_PT (1 << 13) + +/* Embedded Performance Monitor (E.PM) -- IVOR35 if KVM_SREGS_E_IVOR */ +#define KVM_SREGS_E_PM (1 << 14) + +/* + * Special updates: + * + * Some registers may change even while a vcpu is not running. + * To avoid losing these changes, by default these registers are + * not updated by KVM_SET_SREGS. To force an update, set the bit + * in u.e.update_special corresponding to the register to be updated. + * + * The update_special field is zero on return from KVM_GET_SREGS. + * + * When restoring a checkpoint, the caller can set update_special + * to 0xffffffff to ensure that everything is restored, even new features + * that the caller doesn't know about. + */ +#define KVM_SREGS_E_UPDATE_MCSR (1 << 0) +#define KVM_SREGS_E_UPDATE_TSR (1 << 1) +#define KVM_SREGS_E_UPDATE_DEC (1 << 2) +#define KVM_SREGS_E_UPDATE_DBSR (1 << 3) + +/* + * In KVM_SET_SREGS, reserved/pad fields must be left untouched from a + * previous KVM_GET_REGS. + * + * Unless otherwise indicated, setting any register with KVM_SET_SREGS + * directly sets its value. It does not trigger any special semantics such + * as write-one-to-clear. Calling KVM_SET_SREGS on an unmodified struct + * just received from KVM_GET_SREGS is always a no-op. + */ +struct kvm_sregs { + __u32 pvr; + union { + struct { + __u64 sdr1; + struct { + struct { + __u64 slbe; + __u64 slbv; + } slb[64]; + } ppc64; + struct { + __u32 sr[16]; + __u64 ibat[8]; + __u64 dbat[8]; + } ppc32; + } s; + struct { + union { + struct { /* KVM_SREGS_E_IMPL_FSL */ + __u32 features; /* KVM_SREGS_E_FSL_ */ + __u32 svr; + __u64 mcar; + __u32 hid0; + + /* KVM_SREGS_E_FSL_PIDn */ + __u32 pid1, pid2; + } fsl; + __u8 pad[256]; + } impl; + + __u32 features; /* KVM_SREGS_E_ */ + __u32 impl_id; /* KVM_SREGS_E_IMPL_ */ + __u32 update_special; /* KVM_SREGS_E_UPDATE_ */ + __u32 pir; /* read-only */ + __u64 sprg8; + __u64 sprg9; /* E.ED */ + __u64 csrr0; + __u64 dsrr0; /* E.ED */ + __u64 mcsrr0; + __u32 csrr1; + __u32 dsrr1; /* E.ED */ + __u32 mcsrr1; + __u32 esr; + __u64 dear; + __u64 ivpr; + __u64 mcivpr; + __u64 mcsr; /* KVM_SREGS_E_UPDATE_MCSR */ + + __u32 tsr; /* KVM_SREGS_E_UPDATE_TSR */ + __u32 tcr; + __u32 decar; + __u32 dec; /* KVM_SREGS_E_UPDATE_DEC */ + + /* + * Userspace can read TB directly, but the + * value reported here is consistent with "dec". + * + * Read-only. + */ + __u64 tb; + + __u32 dbsr; /* KVM_SREGS_E_UPDATE_DBSR */ + __u32 dbcr[3]; + /* + * iac/dac registers are 64bit wide, while this API + * interface provides only lower 32 bits on 64 bit + * processors. ONE_REG interface is added for 64bit + * iac/dac registers. + */ + __u32 iac[4]; + __u32 dac[2]; + __u32 dvc[2]; + __u8 num_iac; /* read-only */ + __u8 num_dac; /* read-only */ + __u8 num_dvc; /* read-only */ + __u8 pad; + + __u32 epr; /* EXP */ + __u32 vrsave; /* a.k.a. USPRG0 */ + __u32 epcr; /* KVM_SREGS_E_64 */ + + __u32 mas0; + __u32 mas1; + __u64 mas2; + __u64 mas7_3; + __u32 mas4; + __u32 mas6; + + __u32 ivor_low[16]; /* IVOR0-15 */ + __u32 ivor_high[18]; /* IVOR32+, plus room to expand */ + + __u32 mmucfg; /* read-only */ + __u32 eptcfg; /* E.PT, read-only */ + __u32 tlbcfg[4];/* read-only */ + __u32 tlbps[4]; /* read-only */ + + __u32 eplc, epsc; /* E.PD */ + } e; + __u8 pad[1020]; + } u; +}; + +struct kvm_fpu { + __u64 fpr[32]; +}; + +/* + * Defines for h/w breakpoint, watchpoint (read, write or both) and + * software breakpoint. + * These are used as "type" in KVM_SET_GUEST_DEBUG ioctl and "status" + * for KVM_DEBUG_EXIT. + */ +#define KVMPPC_DEBUG_NONE 0x0 +#define KVMPPC_DEBUG_BREAKPOINT (1UL << 1) +#define KVMPPC_DEBUG_WATCH_WRITE (1UL << 2) +#define KVMPPC_DEBUG_WATCH_READ (1UL << 3) +struct kvm_debug_exit_arch { + __u64 address; + /* + * exiting to userspace because of h/w breakpoint, watchpoint + * (read, write or both) and software breakpoint. + */ + __u32 status; + __u32 reserved; +}; + +/* for KVM_SET_GUEST_DEBUG */ +struct kvm_guest_debug_arch { + struct { + /* H/W breakpoint/watchpoint address */ + __u64 addr; + /* + * Type denotes h/w breakpoint, read watchpoint, write + * watchpoint or watchpoint (both read and write). + */ + __u32 type; + __u32 reserved; + } bp[16]; +}; + +/* Debug related defines */ +/* + * kvm_guest_debug->control is a 32 bit field. The lower 16 bits are generic + * and upper 16 bits are architecture specific. Architecture specific defines + * that ioctl is for setting hardware breakpoint or software breakpoint. + */ +#define KVM_GUESTDBG_USE_SW_BP 0x00010000 +#define KVM_GUESTDBG_USE_HW_BP 0x00020000 + +/* definition of registers in kvm_run */ +struct kvm_sync_regs { +}; + +#define KVM_INTERRUPT_SET -1U +#define KVM_INTERRUPT_UNSET -2U +#define KVM_INTERRUPT_SET_LEVEL -3U + +#define KVM_CPU_440 1 +#define KVM_CPU_E500V2 2 +#define KVM_CPU_3S_32 3 +#define KVM_CPU_3S_64 4 +#define KVM_CPU_E500MC 5 + +/* for KVM_CAP_SPAPR_TCE */ +struct kvm_create_spapr_tce { + __u64 liobn; + __u32 window_size; +}; + +/* for KVM_CAP_SPAPR_TCE_64 */ +struct kvm_create_spapr_tce_64 { + __u64 liobn; + __u32 page_shift; + __u32 flags; + __u64 offset; /* in pages */ + __u64 size; /* in pages */ +}; + +/* for KVM_ALLOCATE_RMA */ +struct kvm_allocate_rma { + __u64 rma_size; +}; + +/* for KVM_CAP_PPC_RTAS */ +struct kvm_rtas_token_args { + char name[120]; + __u64 token; /* Use a token of 0 to undefine a mapping */ +}; + +struct kvm_book3e_206_tlb_entry { + __u32 mas8; + __u32 mas1; + __u64 mas2; + __u64 mas7_3; +}; + +struct kvm_book3e_206_tlb_params { + /* + * For mmu types KVM_MMU_FSL_BOOKE_NOHV and KVM_MMU_FSL_BOOKE_HV: + * + * - The number of ways of TLB0 must be a power of two between 2 and + * 16. + * - TLB1 must be fully associative. + * - The size of TLB0 must be a multiple of the number of ways, and + * the number of sets must be a power of two. + * - The size of TLB1 may not exceed 64 entries. + * - TLB0 supports 4 KiB pages. + * - The page sizes supported by TLB1 are as indicated by + * TLB1CFG (if MMUCFG[MAVN] = 0) or TLB1PS (if MMUCFG[MAVN] = 1) + * as returned by KVM_GET_SREGS. + * - TLB2 and TLB3 are reserved, and their entries in tlb_sizes[] + * and tlb_ways[] must be zero. + * + * tlb_ways[n] = tlb_sizes[n] means the array is fully associative. + * + * KVM will adjust TLBnCFG based on the sizes configured here, + * though arrays greater than 2048 entries will have TLBnCFG[NENTRY] + * set to zero. + */ + __u32 tlb_sizes[4]; + __u32 tlb_ways[4]; + __u32 reserved[8]; +}; + +/* For KVM_PPC_GET_HTAB_FD */ +struct kvm_get_htab_fd { + __u64 flags; + __u64 start_index; + __u64 reserved[2]; +}; + +/* Values for kvm_get_htab_fd.flags */ +#define KVM_GET_HTAB_BOLTED_ONLY ((__u64)0x1) +#define KVM_GET_HTAB_WRITE ((__u64)0x2) + +/* + * Data read on the file descriptor is formatted as a series of + * records, each consisting of a header followed by a series of + * `n_valid' HPTEs (16 bytes each), which are all valid. Following + * those valid HPTEs there are `n_invalid' invalid HPTEs, which + * are not represented explicitly in the stream. The same format + * is used for writing. + */ +struct kvm_get_htab_header { + __u32 index; + __u16 n_valid; + __u16 n_invalid; +}; + +/* For KVM_PPC_CONFIGURE_V3_MMU */ +struct kvm_ppc_mmuv3_cfg { + __u64 flags; + __u64 process_table; /* second doubleword of partition table entry */ +}; + +/* Flag values for KVM_PPC_CONFIGURE_V3_MMU */ +#define KVM_PPC_MMUV3_RADIX 1 /* 1 = radix mode, 0 = HPT */ +#define KVM_PPC_MMUV3_GTSE 2 /* global translation shootdown enb. */ + +/* For KVM_PPC_GET_RMMU_INFO */ +struct kvm_ppc_rmmu_info { + struct kvm_ppc_radix_geom { + __u8 page_shift; + __u8 level_bits[4]; + __u8 pad[3]; + } geometries[8]; + __u32 ap_encodings[8]; +}; + +/* For KVM_PPC_GET_CPU_CHAR */ +struct kvm_ppc_cpu_char { + __u64 character; /* characteristics of the CPU */ + __u64 behaviour; /* recommended software behaviour */ + __u64 character_mask; /* valid bits in character */ + __u64 behaviour_mask; /* valid bits in behaviour */ +}; + +/* + * Values for character and character_mask. + * These are identical to the values used by H_GET_CPU_CHARACTERISTICS. + */ +#define KVM_PPC_CPU_CHAR_SPEC_BAR_ORI31 (1ULL << 63) +#define KVM_PPC_CPU_CHAR_BCCTRL_SERIALISED (1ULL << 62) +#define KVM_PPC_CPU_CHAR_L1D_FLUSH_ORI30 (1ULL << 61) +#define KVM_PPC_CPU_CHAR_L1D_FLUSH_TRIG2 (1ULL << 60) +#define KVM_PPC_CPU_CHAR_L1D_THREAD_PRIV (1ULL << 59) +#define KVM_PPC_CPU_CHAR_BR_HINT_HONOURED (1ULL << 58) +#define KVM_PPC_CPU_CHAR_MTTRIG_THR_RECONF (1ULL << 57) +#define KVM_PPC_CPU_CHAR_COUNT_CACHE_DIS (1ULL << 56) + +#define KVM_PPC_CPU_BEHAV_FAVOUR_SECURITY (1ULL << 63) +#define KVM_PPC_CPU_BEHAV_L1D_FLUSH_PR (1ULL << 62) +#define KVM_PPC_CPU_BEHAV_BNDS_CHK_SPEC_BAR (1ULL << 61) + +/* Per-vcpu XICS interrupt controller state */ +#define KVM_REG_PPC_ICP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8c) + +#define KVM_REG_PPC_ICP_CPPR_SHIFT 56 /* current proc priority */ +#define KVM_REG_PPC_ICP_CPPR_MASK 0xff +#define KVM_REG_PPC_ICP_XISR_SHIFT 32 /* interrupt status field */ +#define KVM_REG_PPC_ICP_XISR_MASK 0xffffff +#define KVM_REG_PPC_ICP_MFRR_SHIFT 24 /* pending IPI priority */ +#define KVM_REG_PPC_ICP_MFRR_MASK 0xff +#define KVM_REG_PPC_ICP_PPRI_SHIFT 16 /* pending irq priority */ +#define KVM_REG_PPC_ICP_PPRI_MASK 0xff + +/* Device control API: PPC-specific devices */ +#define KVM_DEV_MPIC_GRP_MISC 1 +#define KVM_DEV_MPIC_BASE_ADDR 0 /* 64-bit */ + +#define KVM_DEV_MPIC_GRP_REGISTER 2 /* 32-bit */ +#define KVM_DEV_MPIC_GRP_IRQ_ACTIVE 3 /* 32-bit */ + +/* One-Reg API: PPC-specific registers */ +#define KVM_REG_PPC_HIOR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x1) +#define KVM_REG_PPC_IAC1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x2) +#define KVM_REG_PPC_IAC2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x3) +#define KVM_REG_PPC_IAC3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x4) +#define KVM_REG_PPC_IAC4 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x5) +#define KVM_REG_PPC_DAC1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x6) +#define KVM_REG_PPC_DAC2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x7) +#define KVM_REG_PPC_DABR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8) +#define KVM_REG_PPC_DSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x9) +#define KVM_REG_PPC_PURR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa) +#define KVM_REG_PPC_SPURR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb) +#define KVM_REG_PPC_DAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc) +#define KVM_REG_PPC_DSISR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xd) +#define KVM_REG_PPC_AMR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xe) +#define KVM_REG_PPC_UAMOR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xf) + +#define KVM_REG_PPC_MMCR0 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x10) +#define KVM_REG_PPC_MMCR1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x11) +#define KVM_REG_PPC_MMCRA (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x12) +#define KVM_REG_PPC_MMCR2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x13) +#define KVM_REG_PPC_MMCRS (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x14) +#define KVM_REG_PPC_SIAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x15) +#define KVM_REG_PPC_SDAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x16) +#define KVM_REG_PPC_SIER (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x17) + +#define KVM_REG_PPC_PMC1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x18) +#define KVM_REG_PPC_PMC2 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x19) +#define KVM_REG_PPC_PMC3 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1a) +#define KVM_REG_PPC_PMC4 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1b) +#define KVM_REG_PPC_PMC5 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1c) +#define KVM_REG_PPC_PMC6 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1d) +#define KVM_REG_PPC_PMC7 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1e) +#define KVM_REG_PPC_PMC8 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1f) + +/* 32 floating-point registers */ +#define KVM_REG_PPC_FPR0 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x20) +#define KVM_REG_PPC_FPR(n) (KVM_REG_PPC_FPR0 + (n)) +#define KVM_REG_PPC_FPR31 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x3f) + +/* 32 VMX/Altivec vector registers */ +#define KVM_REG_PPC_VR0 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x40) +#define KVM_REG_PPC_VR(n) (KVM_REG_PPC_VR0 + (n)) +#define KVM_REG_PPC_VR31 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x5f) + +/* 32 double-width FP registers for VSX */ +/* High-order halves overlap with FP regs */ +#define KVM_REG_PPC_VSR0 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x60) +#define KVM_REG_PPC_VSR(n) (KVM_REG_PPC_VSR0 + (n)) +#define KVM_REG_PPC_VSR31 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x7f) + +/* FP and vector status/control registers */ +#define KVM_REG_PPC_FPSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x80) +/* + * VSCR register is documented as a 32-bit register in the ISA, but it can + * only be accesses via a vector register. Expose VSCR as a 32-bit register + * even though the kernel represents it as a 128-bit vector. + */ +#define KVM_REG_PPC_VSCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x81) + +/* Virtual processor areas */ +/* For SLB & DTL, address in high (first) half, length in low half */ +#define KVM_REG_PPC_VPA_ADDR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x82) +#define KVM_REG_PPC_VPA_SLB (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x83) +#define KVM_REG_PPC_VPA_DTL (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x84) + +#define KVM_REG_PPC_EPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x85) +#define KVM_REG_PPC_EPR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x86) + +/* Timer Status Register OR/CLEAR interface */ +#define KVM_REG_PPC_OR_TSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x87) +#define KVM_REG_PPC_CLEAR_TSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x88) +#define KVM_REG_PPC_TCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x89) +#define KVM_REG_PPC_TSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8a) + +/* Debugging: Special instruction for software breakpoint */ +#define KVM_REG_PPC_DEBUG_INST (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8b) + +/* MMU registers */ +#define KVM_REG_PPC_MAS0 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8c) +#define KVM_REG_PPC_MAS1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8d) +#define KVM_REG_PPC_MAS2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8e) +#define KVM_REG_PPC_MAS7_3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8f) +#define KVM_REG_PPC_MAS4 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x90) +#define KVM_REG_PPC_MAS6 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x91) +#define KVM_REG_PPC_MMUCFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x92) +/* + * TLBnCFG fields TLBnCFG_N_ENTRY and TLBnCFG_ASSOC can be changed only using + * KVM_CAP_SW_TLB ioctl + */ +#define KVM_REG_PPC_TLB0CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x93) +#define KVM_REG_PPC_TLB1CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x94) +#define KVM_REG_PPC_TLB2CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x95) +#define KVM_REG_PPC_TLB3CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x96) +#define KVM_REG_PPC_TLB0PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x97) +#define KVM_REG_PPC_TLB1PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x98) +#define KVM_REG_PPC_TLB2PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x99) +#define KVM_REG_PPC_TLB3PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9a) +#define KVM_REG_PPC_EPTCFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9b) + +/* Timebase offset */ +#define KVM_REG_PPC_TB_OFFSET (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x9c) + +/* POWER8 registers */ +#define KVM_REG_PPC_SPMC1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9d) +#define KVM_REG_PPC_SPMC2 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9e) +#define KVM_REG_PPC_IAMR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x9f) +#define KVM_REG_PPC_TFHAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa0) +#define KVM_REG_PPC_TFIAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa1) +#define KVM_REG_PPC_TEXASR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa2) +#define KVM_REG_PPC_FSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa3) +#define KVM_REG_PPC_PSPB (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xa4) +#define KVM_REG_PPC_EBBHR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa5) +#define KVM_REG_PPC_EBBRR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa6) +#define KVM_REG_PPC_BESCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa7) +#define KVM_REG_PPC_TAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa8) +#define KVM_REG_PPC_DPDES (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa9) +#define KVM_REG_PPC_DAWR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xaa) +#define KVM_REG_PPC_DAWRX (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xab) +#define KVM_REG_PPC_CIABR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xac) +#define KVM_REG_PPC_IC (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xad) +#define KVM_REG_PPC_VTB (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xae) +#define KVM_REG_PPC_CSIGR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xaf) +#define KVM_REG_PPC_TACR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb0) +#define KVM_REG_PPC_TCSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb1) +#define KVM_REG_PPC_PID (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb2) +#define KVM_REG_PPC_ACOP (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb3) + +#define KVM_REG_PPC_VRSAVE (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb4) +#define KVM_REG_PPC_LPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb5) +#define KVM_REG_PPC_LPCR_64 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb5) +#define KVM_REG_PPC_PPR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb6) + +/* Architecture compatibility level */ +#define KVM_REG_PPC_ARCH_COMPAT (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb7) + +#define KVM_REG_PPC_DABRX (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb8) +#define KVM_REG_PPC_WORT (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb9) +#define KVM_REG_PPC_SPRG9 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xba) +#define KVM_REG_PPC_DBSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xbb) + +/* POWER9 registers */ +#define KVM_REG_PPC_TIDR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbc) +#define KVM_REG_PPC_PSSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbd) + +#define KVM_REG_PPC_DEC_EXPIRY (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbe) +#define KVM_REG_PPC_ONLINE (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xbf) + +/* Transactional Memory checkpointed state: + * This is all GPRs, all VSX regs and a subset of SPRs + */ +#define KVM_REG_PPC_TM (KVM_REG_PPC | 0x80000000) +/* TM GPRs */ +#define KVM_REG_PPC_TM_GPR0 (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0) +#define KVM_REG_PPC_TM_GPR(n) (KVM_REG_PPC_TM_GPR0 + (n)) +#define KVM_REG_PPC_TM_GPR31 (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x1f) +/* TM VSX */ +#define KVM_REG_PPC_TM_VSR0 (KVM_REG_PPC_TM | KVM_REG_SIZE_U128 | 0x20) +#define KVM_REG_PPC_TM_VSR(n) (KVM_REG_PPC_TM_VSR0 + (n)) +#define KVM_REG_PPC_TM_VSR63 (KVM_REG_PPC_TM | KVM_REG_SIZE_U128 | 0x5f) +/* TM SPRS */ +#define KVM_REG_PPC_TM_CR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x60) +#define KVM_REG_PPC_TM_LR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x61) +#define KVM_REG_PPC_TM_CTR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x62) +#define KVM_REG_PPC_TM_FPSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x63) +#define KVM_REG_PPC_TM_AMR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x64) +#define KVM_REG_PPC_TM_PPR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x65) +#define KVM_REG_PPC_TM_VRSAVE (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x66) +#define KVM_REG_PPC_TM_VSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U32 | 0x67) +#define KVM_REG_PPC_TM_DSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x68) +#define KVM_REG_PPC_TM_TAR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x69) +#define KVM_REG_PPC_TM_XER (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x6a) + +/* PPC64 eXternal Interrupt Controller Specification */ +#define KVM_DEV_XICS_GRP_SOURCES 1 /* 64-bit source attributes */ + +/* Layout of 64-bit source attribute values */ +#define KVM_XICS_DESTINATION_SHIFT 0 +#define KVM_XICS_DESTINATION_MASK 0xffffffffULL +#define KVM_XICS_PRIORITY_SHIFT 32 +#define KVM_XICS_PRIORITY_MASK 0xff +#define KVM_XICS_LEVEL_SENSITIVE (1ULL << 40) +#define KVM_XICS_MASKED (1ULL << 41) +#define KVM_XICS_PENDING (1ULL << 42) +#define KVM_XICS_PRESENTED (1ULL << 43) +#define KVM_XICS_QUEUED (1ULL << 44) + +#endif /* __LINUX_KVM_POWERPC_H */ diff --git a/tools/arch/powerpc/include/uapi/asm/mman.h b/tools/arch/powerpc/include/uapi/asm/mman.h new file mode 100644 index 000000000..f33105bc5 --- /dev/null +++ b/tools/arch/powerpc/include/uapi/asm/mman.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H +#define TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H +#define MAP_DENYWRITE 0x0800 +#define MAP_EXECUTABLE 0x1000 +#define MAP_GROWSDOWN 0x0100 +#define MAP_HUGETLB 0x40000 +#define MAP_LOCKED 0x80 +#define MAP_NONBLOCK 0x10000 +#define MAP_NORESERVE 0x40 +#define MAP_POPULATE 0x8000 +#define MAP_STACK 0x20000 +#include +/* MAP_32BIT is undefined on powerpc, fix it for perf */ +#define MAP_32BIT 0 +#endif diff --git a/tools/arch/powerpc/include/uapi/asm/perf_regs.h b/tools/arch/powerpc/include/uapi/asm/perf_regs.h new file mode 100644 index 000000000..9e52c86cc --- /dev/null +++ b/tools/arch/powerpc/include/uapi/asm/perf_regs.h @@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _UAPI_ASM_POWERPC_PERF_REGS_H +#define _UAPI_ASM_POWERPC_PERF_REGS_H + +enum perf_event_powerpc_regs { + PERF_REG_POWERPC_R0, + PERF_REG_POWERPC_R1, + PERF_REG_POWERPC_R2, + PERF_REG_POWERPC_R3, + PERF_REG_POWERPC_R4, + PERF_REG_POWERPC_R5, + PERF_REG_POWERPC_R6, + PERF_REG_POWERPC_R7, + PERF_REG_POWERPC_R8, + PERF_REG_POWERPC_R9, + PERF_REG_POWERPC_R10, + PERF_REG_POWERPC_R11, + PERF_REG_POWERPC_R12, + PERF_REG_POWERPC_R13, + PERF_REG_POWERPC_R14, + PERF_REG_POWERPC_R15, + PERF_REG_POWERPC_R16, + PERF_REG_POWERPC_R17, + PERF_REG_POWERPC_R18, + PERF_REG_POWERPC_R19, + PERF_REG_POWERPC_R20, + PERF_REG_POWERPC_R21, + PERF_REG_POWERPC_R22, + PERF_REG_POWERPC_R23, + PERF_REG_POWERPC_R24, + PERF_REG_POWERPC_R25, + PERF_REG_POWERPC_R26, + PERF_REG_POWERPC_R27, + PERF_REG_POWERPC_R28, + PERF_REG_POWERPC_R29, + PERF_REG_POWERPC_R30, + PERF_REG_POWERPC_R31, + PERF_REG_POWERPC_NIP, + PERF_REG_POWERPC_MSR, + PERF_REG_POWERPC_ORIG_R3, + PERF_REG_POWERPC_CTR, + PERF_REG_POWERPC_LINK, + PERF_REG_POWERPC_XER, + PERF_REG_POWERPC_CCR, + PERF_REG_POWERPC_SOFTE, + PERF_REG_POWERPC_TRAP, + PERF_REG_POWERPC_DAR, + PERF_REG_POWERPC_DSISR, + PERF_REG_POWERPC_MAX, +}; +#endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */ diff --git a/tools/arch/powerpc/include/uapi/asm/unistd.h b/tools/arch/powerpc/include/uapi/asm/unistd.h new file mode 100644 index 000000000..985534d0b --- /dev/null +++ b/tools/arch/powerpc/include/uapi/asm/unistd.h @@ -0,0 +1,404 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ +/* + * This file contains the system call numbers. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _UAPI_ASM_POWERPC_UNISTD_H_ +#define _UAPI_ASM_POWERPC_UNISTD_H_ + + +#define __NR_restart_syscall 0 +#define __NR_exit 1 +#define __NR_fork 2 +#define __NR_read 3 +#define __NR_write 4 +#define __NR_open 5 +#define __NR_close 6 +#define __NR_waitpid 7 +#define __NR_creat 8 +#define __NR_link 9 +#define __NR_unlink 10 +#define __NR_execve 11 +#define __NR_chdir 12 +#define __NR_time 13 +#define __NR_mknod 14 +#define __NR_chmod 15 +#define __NR_lchown 16 +#define __NR_break 17 +#define __NR_oldstat 18 +#define __NR_lseek 19 +#define __NR_getpid 20 +#define __NR_mount 21 +#define __NR_umount 22 +#define __NR_setuid 23 +#define __NR_getuid 24 +#define __NR_stime 25 +#define __NR_ptrace 26 +#define __NR_alarm 27 +#define __NR_oldfstat 28 +#define __NR_pause 29 +#define __NR_utime 30 +#define __NR_stty 31 +#define __NR_gtty 32 +#define __NR_access 33 +#define __NR_nice 34 +#define __NR_ftime 35 +#define __NR_sync 36 +#define __NR_kill 37 +#define __NR_rename 38 +#define __NR_mkdir 39 +#define __NR_rmdir 40 +#define __NR_dup 41 +#define __NR_pipe 42 +#define __NR_times 43 +#define __NR_prof 44 +#define __NR_brk 45 +#define __NR_setgid 46 +#define __NR_getgid 47 +#define __NR_signal 48 +#define __NR_geteuid 49 +#define __NR_getegid 50 +#define __NR_acct 51 +#define __NR_umount2 52 +#define __NR_lock 53 +#define __NR_ioctl 54 +#define __NR_fcntl 55 +#define __NR_mpx 56 +#define __NR_setpgid 57 +#define __NR_ulimit 58 +#define __NR_oldolduname 59 +#define __NR_umask 60 +#define __NR_chroot 61 +#define __NR_ustat 62 +#define __NR_dup2 63 +#define __NR_getppid 64 +#define __NR_getpgrp 65 +#define __NR_setsid 66 +#define __NR_sigaction 67 +#define __NR_sgetmask 68 +#define __NR_ssetmask 69 +#define __NR_setreuid 70 +#define __NR_setregid 71 +#define __NR_sigsuspend 72 +#define __NR_sigpending 73 +#define __NR_sethostname 74 +#define __NR_setrlimit 75 +#define __NR_getrlimit 76 +#define __NR_getrusage 77 +#define __NR_gettimeofday 78 +#define __NR_settimeofday 79 +#define __NR_getgroups 80 +#define __NR_setgroups 81 +#define __NR_select 82 +#define __NR_symlink 83 +#define __NR_oldlstat 84 +#define __NR_readlink 85 +#define __NR_uselib 86 +#define __NR_swapon 87 +#define __NR_reboot 88 +#define __NR_readdir 89 +#define __NR_mmap 90 +#define __NR_munmap 91 +#define __NR_truncate 92 +#define __NR_ftruncate 93 +#define __NR_fchmod 94 +#define __NR_fchown 95 +#define __NR_getpriority 96 +#define __NR_setpriority 97 +#define __NR_profil 98 +#define __NR_statfs 99 +#define __NR_fstatfs 100 +#define __NR_ioperm 101 +#define __NR_socketcall 102 +#define __NR_syslog 103 +#define __NR_setitimer 104 +#define __NR_getitimer 105 +#define __NR_stat 106 +#define __NR_lstat 107 +#define __NR_fstat 108 +#define __NR_olduname 109 +#define __NR_iopl 110 +#define __NR_vhangup 111 +#define __NR_idle 112 +#define __NR_vm86 113 +#define __NR_wait4 114 +#define __NR_swapoff 115 +#define __NR_sysinfo 116 +#define __NR_ipc 117 +#define __NR_fsync 118 +#define __NR_sigreturn 119 +#define __NR_clone 120 +#define __NR_setdomainname 121 +#define __NR_uname 122 +#define __NR_modify_ldt 123 +#define __NR_adjtimex 124 +#define __NR_mprotect 125 +#define __NR_sigprocmask 126 +#define __NR_create_module 127 +#define __NR_init_module 128 +#define __NR_delete_module 129 +#define __NR_get_kernel_syms 130 +#define __NR_quotactl 131 +#define __NR_getpgid 132 +#define __NR_fchdir 133 +#define __NR_bdflush 134 +#define __NR_sysfs 135 +#define __NR_personality 136 +#define __NR_afs_syscall 137 /* Syscall for Andrew File System */ +#define __NR_setfsuid 138 +#define __NR_setfsgid 139 +#define __NR__llseek 140 +#define __NR_getdents 141 +#define __NR__newselect 142 +#define __NR_flock 143 +#define __NR_msync 144 +#define __NR_readv 145 +#define __NR_writev 146 +#define __NR_getsid 147 +#define __NR_fdatasync 148 +#define __NR__sysctl 149 +#define __NR_mlock 150 +#define __NR_munlock 151 +#define __NR_mlockall 152 +#define __NR_munlockall 153 +#define __NR_sched_setparam 154 +#define __NR_sched_getparam 155 +#define __NR_sched_setscheduler 156 +#define __NR_sched_getscheduler 157 +#define __NR_sched_yield 158 +#define __NR_sched_get_priority_max 159 +#define __NR_sched_get_priority_min 160 +#define __NR_sched_rr_get_interval 161 +#define __NR_nanosleep 162 +#define __NR_mremap 163 +#define __NR_setresuid 164 +#define __NR_getresuid 165 +#define __NR_query_module 166 +#define __NR_poll 167 +#define __NR_nfsservctl 168 +#define __NR_setresgid 169 +#define __NR_getresgid 170 +#define __NR_prctl 171 +#define __NR_rt_sigreturn 172 +#define __NR_rt_sigaction 173 +#define __NR_rt_sigprocmask 174 +#define __NR_rt_sigpending 175 +#define __NR_rt_sigtimedwait 176 +#define __NR_rt_sigqueueinfo 177 +#define __NR_rt_sigsuspend 178 +#define __NR_pread64 179 +#define __NR_pwrite64 180 +#define __NR_chown 181 +#define __NR_getcwd 182 +#define __NR_capget 183 +#define __NR_capset 184 +#define __NR_sigaltstack 185 +#define __NR_sendfile 186 +#define __NR_getpmsg 187 /* some people actually want streams */ +#define __NR_putpmsg 188 /* some people actually want streams */ +#define __NR_vfork 189 +#define __NR_ugetrlimit 190 /* SuS compliant getrlimit */ +#define __NR_readahead 191 +#ifndef __powerpc64__ /* these are 32-bit only */ +#define __NR_mmap2 192 +#define __NR_truncate64 193 +#define __NR_ftruncate64 194 +#define __NR_stat64 195 +#define __NR_lstat64 196 +#define __NR_fstat64 197 +#endif +#define __NR_pciconfig_read 198 +#define __NR_pciconfig_write 199 +#define __NR_pciconfig_iobase 200 +#define __NR_multiplexer 201 +#define __NR_getdents64 202 +#define __NR_pivot_root 203 +#ifndef __powerpc64__ +#define __NR_fcntl64 204 +#endif +#define __NR_madvise 205 +#define __NR_mincore 206 +#define __NR_gettid 207 +#define __NR_tkill 208 +#define __NR_setxattr 209 +#define __NR_lsetxattr 210 +#define __NR_fsetxattr 211 +#define __NR_getxattr 212 +#define __NR_lgetxattr 213 +#define __NR_fgetxattr 214 +#define __NR_listxattr 215 +#define __NR_llistxattr 216 +#define __NR_flistxattr 217 +#define __NR_removexattr 218 +#define __NR_lremovexattr 219 +#define __NR_fremovexattr 220 +#define __NR_futex 221 +#define __NR_sched_setaffinity 222 +#define __NR_sched_getaffinity 223 +/* 224 currently unused */ +#define __NR_tuxcall 225 +#ifndef __powerpc64__ +#define __NR_sendfile64 226 +#endif +#define __NR_io_setup 227 +#define __NR_io_destroy 228 +#define __NR_io_getevents 229 +#define __NR_io_submit 230 +#define __NR_io_cancel 231 +#define __NR_set_tid_address 232 +#define __NR_fadvise64 233 +#define __NR_exit_group 234 +#define __NR_lookup_dcookie 235 +#define __NR_epoll_create 236 +#define __NR_epoll_ctl 237 +#define __NR_epoll_wait 238 +#define __NR_remap_file_pages 239 +#define __NR_timer_create 240 +#define __NR_timer_settime 241 +#define __NR_timer_gettime 242 +#define __NR_timer_getoverrun 243 +#define __NR_timer_delete 244 +#define __NR_clock_settime 245 +#define __NR_clock_gettime 246 +#define __NR_clock_getres 247 +#define __NR_clock_nanosleep 248 +#define __NR_swapcontext 249 +#define __NR_tgkill 250 +#define __NR_utimes 251 +#define __NR_statfs64 252 +#define __NR_fstatfs64 253 +#ifndef __powerpc64__ +#define __NR_fadvise64_64 254 +#endif +#define __NR_rtas 255 +#define __NR_sys_debug_setcontext 256 +/* Number 257 is reserved for vserver */ +#define __NR_migrate_pages 258 +#define __NR_mbind 259 +#define __NR_get_mempolicy 260 +#define __NR_set_mempolicy 261 +#define __NR_mq_open 262 +#define __NR_mq_unlink 263 +#define __NR_mq_timedsend 264 +#define __NR_mq_timedreceive 265 +#define __NR_mq_notify 266 +#define __NR_mq_getsetattr 267 +#define __NR_kexec_load 268 +#define __NR_add_key 269 +#define __NR_request_key 270 +#define __NR_keyctl 271 +#define __NR_waitid 272 +#define __NR_ioprio_set 273 +#define __NR_ioprio_get 274 +#define __NR_inotify_init 275 +#define __NR_inotify_add_watch 276 +#define __NR_inotify_rm_watch 277 +#define __NR_spu_run 278 +#define __NR_spu_create 279 +#define __NR_pselect6 280 +#define __NR_ppoll 281 +#define __NR_unshare 282 +#define __NR_splice 283 +#define __NR_tee 284 +#define __NR_vmsplice 285 +#define __NR_openat 286 +#define __NR_mkdirat 287 +#define __NR_mknodat 288 +#define __NR_fchownat 289 +#define __NR_futimesat 290 +#ifdef __powerpc64__ +#define __NR_newfstatat 291 +#else +#define __NR_fstatat64 291 +#endif +#define __NR_unlinkat 292 +#define __NR_renameat 293 +#define __NR_linkat 294 +#define __NR_symlinkat 295 +#define __NR_readlinkat 296 +#define __NR_fchmodat 297 +#define __NR_faccessat 298 +#define __NR_get_robust_list 299 +#define __NR_set_robust_list 300 +#define __NR_move_pages 301 +#define __NR_getcpu 302 +#define __NR_epoll_pwait 303 +#define __NR_utimensat 304 +#define __NR_signalfd 305 +#define __NR_timerfd_create 306 +#define __NR_eventfd 307 +#define __NR_sync_file_range2 308 +#define __NR_fallocate 309 +#define __NR_subpage_prot 310 +#define __NR_timerfd_settime 311 +#define __NR_timerfd_gettime 312 +#define __NR_signalfd4 313 +#define __NR_eventfd2 314 +#define __NR_epoll_create1 315 +#define __NR_dup3 316 +#define __NR_pipe2 317 +#define __NR_inotify_init1 318 +#define __NR_perf_event_open 319 +#define __NR_preadv 320 +#define __NR_pwritev 321 +#define __NR_rt_tgsigqueueinfo 322 +#define __NR_fanotify_init 323 +#define __NR_fanotify_mark 324 +#define __NR_prlimit64 325 +#define __NR_socket 326 +#define __NR_bind 327 +#define __NR_connect 328 +#define __NR_listen 329 +#define __NR_accept 330 +#define __NR_getsockname 331 +#define __NR_getpeername 332 +#define __NR_socketpair 333 +#define __NR_send 334 +#define __NR_sendto 335 +#define __NR_recv 336 +#define __NR_recvfrom 337 +#define __NR_shutdown 338 +#define __NR_setsockopt 339 +#define __NR_getsockopt 340 +#define __NR_sendmsg 341 +#define __NR_recvmsg 342 +#define __NR_recvmmsg 343 +#define __NR_accept4 344 +#define __NR_name_to_handle_at 345 +#define __NR_open_by_handle_at 346 +#define __NR_clock_adjtime 347 +#define __NR_syncfs 348 +#define __NR_sendmmsg 349 +#define __NR_setns 350 +#define __NR_process_vm_readv 351 +#define __NR_process_vm_writev 352 +#define __NR_finit_module 353 +#define __NR_kcmp 354 +#define __NR_sched_setattr 355 +#define __NR_sched_getattr 356 +#define __NR_renameat2 357 +#define __NR_seccomp 358 +#define __NR_getrandom 359 +#define __NR_memfd_create 360 +#define __NR_bpf 361 +#define __NR_execveat 362 +#define __NR_switch_endian 363 +#define __NR_userfaultfd 364 +#define __NR_membarrier 365 +#define __NR_mlock2 378 +#define __NR_copy_file_range 379 +#define __NR_preadv2 380 +#define __NR_pwritev2 381 +#define __NR_kexec_file_load 382 +#define __NR_statx 383 +#define __NR_pkey_alloc 384 +#define __NR_pkey_free 385 +#define __NR_pkey_mprotect 386 +#define __NR_rseq 387 +#define __NR_io_pgetevents 388 + +#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ diff --git a/tools/arch/riscv/include/uapi/asm/bitsperlong.h b/tools/arch/riscv/include/uapi/asm/bitsperlong.h new file mode 100644 index 000000000..0b3cb52fd --- /dev/null +++ b/tools/arch/riscv/include/uapi/asm/bitsperlong.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2012 ARM Ltd. + * Copyright (C) 2015 Regents of the University of California + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef _UAPI_ASM_RISCV_BITSPERLONG_H +#define _UAPI_ASM_RISCV_BITSPERLONG_H + +#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8) + +#include + +#endif /* _UAPI_ASM_RISCV_BITSPERLONG_H */ diff --git a/tools/arch/s390/include/asm/barrier.h b/tools/arch/s390/include/asm/barrier.h new file mode 100644 index 000000000..5030c99f4 --- /dev/null +++ b/tools/arch/s390/include/asm/barrier.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copied from the kernel sources: + * + * Copyright IBM Corp. 1999, 2009 + * + * Author(s): Martin Schwidefsky + */ + +#ifndef __TOOLS_LINUX_ASM_BARRIER_H +#define __TOOLS_LINUX_ASM_BARRIER_H + +/* + * Force strict CPU ordering. + * And yes, this is required on UP too when we're talking + * to devices. + */ + +#ifdef CONFIG_HAVE_MARCH_Z196_FEATURES +/* Fast-BCR without checkpoint synchronization */ +#define __ASM_BARRIER "bcr 14,0\n" +#else +#define __ASM_BARRIER "bcr 15,0\n" +#endif + +#define mb() do { asm volatile(__ASM_BARRIER : : : "memory"); } while (0) + +#define rmb() mb() +#define wmb() mb() + +#endif /* __TOOLS_LIB_ASM_BARRIER_H */ diff --git a/tools/arch/s390/include/uapi/asm/bitsperlong.h b/tools/arch/s390/include/uapi/asm/bitsperlong.h new file mode 100644 index 000000000..d2bb62011 --- /dev/null +++ b/tools/arch/s390/include/uapi/asm/bitsperlong.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_S390_BITSPERLONG_H +#define __ASM_S390_BITSPERLONG_H + +#ifndef __s390x__ +#define __BITS_PER_LONG 32 +#else +#define __BITS_PER_LONG 64 +#endif + +#include + +#endif /* __ASM_S390_BITSPERLONG_H */ diff --git a/tools/arch/s390/include/uapi/asm/bpf_perf_event.h b/tools/arch/s390/include/uapi/asm/bpf_perf_event.h new file mode 100644 index 000000000..0a8e37a51 --- /dev/null +++ b/tools/arch/s390/include/uapi/asm/bpf_perf_event.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__ +#define _UAPI__ASM_BPF_PERF_EVENT_H__ + +#include "ptrace.h" + +typedef user_pt_regs bpf_user_pt_regs_t; + +#endif /* _UAPI__ASM_BPF_PERF_EVENT_H__ */ diff --git a/tools/arch/s390/include/uapi/asm/kvm.h b/tools/arch/s390/include/uapi/asm/kvm.h new file mode 100644 index 000000000..9a50f02b9 --- /dev/null +++ b/tools/arch/s390/include/uapi/asm/kvm.h @@ -0,0 +1,277 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __LINUX_KVM_S390_H +#define __LINUX_KVM_S390_H +/* + * KVM s390 specific structures and definitions + * + * Copyright IBM Corp. 2008, 2018 + * + * Author(s): Carsten Otte + * Christian Borntraeger + */ +#include + +#define __KVM_S390 +#define __KVM_HAVE_GUEST_DEBUG + +/* Device control API: s390-specific devices */ +#define KVM_DEV_FLIC_GET_ALL_IRQS 1 +#define KVM_DEV_FLIC_ENQUEUE 2 +#define KVM_DEV_FLIC_CLEAR_IRQS 3 +#define KVM_DEV_FLIC_APF_ENABLE 4 +#define KVM_DEV_FLIC_APF_DISABLE_WAIT 5 +#define KVM_DEV_FLIC_ADAPTER_REGISTER 6 +#define KVM_DEV_FLIC_ADAPTER_MODIFY 7 +#define KVM_DEV_FLIC_CLEAR_IO_IRQ 8 +#define KVM_DEV_FLIC_AISM 9 +#define KVM_DEV_FLIC_AIRQ_INJECT 10 +#define KVM_DEV_FLIC_AISM_ALL 11 +/* + * We can have up to 4*64k pending subchannels + 8 adapter interrupts, + * as well as up to ASYNC_PF_PER_VCPU*KVM_MAX_VCPUS pfault done interrupts. + * There are also sclp and machine checks. This gives us + * sizeof(kvm_s390_irq)*(4*65536+8+64*64+1+1) = 72 * 266250 = 19170000 + * Lets round up to 8192 pages. + */ +#define KVM_S390_MAX_FLOAT_IRQS 266250 +#define KVM_S390_FLIC_MAX_BUFFER 0x2000000 + +struct kvm_s390_io_adapter { + __u32 id; + __u8 isc; + __u8 maskable; + __u8 swap; + __u8 flags; +}; + +#define KVM_S390_ADAPTER_SUPPRESSIBLE 0x01 + +struct kvm_s390_ais_req { + __u8 isc; + __u16 mode; +}; + +struct kvm_s390_ais_all { + __u8 simm; + __u8 nimm; +}; + +#define KVM_S390_IO_ADAPTER_MASK 1 +#define KVM_S390_IO_ADAPTER_MAP 2 +#define KVM_S390_IO_ADAPTER_UNMAP 3 + +struct kvm_s390_io_adapter_req { + __u32 id; + __u8 type; + __u8 mask; + __u16 pad0; + __u64 addr; +}; + +/* kvm attr_group on vm fd */ +#define KVM_S390_VM_MEM_CTRL 0 +#define KVM_S390_VM_TOD 1 +#define KVM_S390_VM_CRYPTO 2 +#define KVM_S390_VM_CPU_MODEL 3 +#define KVM_S390_VM_MIGRATION 4 + +/* kvm attributes for mem_ctrl */ +#define KVM_S390_VM_MEM_ENABLE_CMMA 0 +#define KVM_S390_VM_MEM_CLR_CMMA 1 +#define KVM_S390_VM_MEM_LIMIT_SIZE 2 + +#define KVM_S390_NO_MEM_LIMIT U64_MAX + +/* kvm attributes for KVM_S390_VM_TOD */ +#define KVM_S390_VM_TOD_LOW 0 +#define KVM_S390_VM_TOD_HIGH 1 +#define KVM_S390_VM_TOD_EXT 2 + +struct kvm_s390_vm_tod_clock { + __u8 epoch_idx; + __u64 tod; +}; + +/* kvm attributes for KVM_S390_VM_CPU_MODEL */ +/* processor related attributes are r/w */ +#define KVM_S390_VM_CPU_PROCESSOR 0 +struct kvm_s390_vm_cpu_processor { + __u64 cpuid; + __u16 ibc; + __u8 pad[6]; + __u64 fac_list[256]; +}; + +/* machine related attributes are r/o */ +#define KVM_S390_VM_CPU_MACHINE 1 +struct kvm_s390_vm_cpu_machine { + __u64 cpuid; + __u32 ibc; + __u8 pad[4]; + __u64 fac_mask[256]; + __u64 fac_list[256]; +}; + +#define KVM_S390_VM_CPU_PROCESSOR_FEAT 2 +#define KVM_S390_VM_CPU_MACHINE_FEAT 3 + +#define KVM_S390_VM_CPU_FEAT_NR_BITS 1024 +#define KVM_S390_VM_CPU_FEAT_ESOP 0 +#define KVM_S390_VM_CPU_FEAT_SIEF2 1 +#define KVM_S390_VM_CPU_FEAT_64BSCAO 2 +#define KVM_S390_VM_CPU_FEAT_SIIF 3 +#define KVM_S390_VM_CPU_FEAT_GPERE 4 +#define KVM_S390_VM_CPU_FEAT_GSLS 5 +#define KVM_S390_VM_CPU_FEAT_IB 6 +#define KVM_S390_VM_CPU_FEAT_CEI 7 +#define KVM_S390_VM_CPU_FEAT_IBS 8 +#define KVM_S390_VM_CPU_FEAT_SKEY 9 +#define KVM_S390_VM_CPU_FEAT_CMMA 10 +#define KVM_S390_VM_CPU_FEAT_PFMFI 11 +#define KVM_S390_VM_CPU_FEAT_SIGPIF 12 +#define KVM_S390_VM_CPU_FEAT_KSS 13 +struct kvm_s390_vm_cpu_feat { + __u64 feat[16]; +}; + +#define KVM_S390_VM_CPU_PROCESSOR_SUBFUNC 4 +#define KVM_S390_VM_CPU_MACHINE_SUBFUNC 5 +/* for "test bit" instructions MSB 0 bit ordering, for "query" raw blocks */ +struct kvm_s390_vm_cpu_subfunc { + __u8 plo[32]; /* always */ + __u8 ptff[16]; /* with TOD-clock steering */ + __u8 kmac[16]; /* with MSA */ + __u8 kmc[16]; /* with MSA */ + __u8 km[16]; /* with MSA */ + __u8 kimd[16]; /* with MSA */ + __u8 klmd[16]; /* with MSA */ + __u8 pckmo[16]; /* with MSA3 */ + __u8 kmctr[16]; /* with MSA4 */ + __u8 kmf[16]; /* with MSA4 */ + __u8 kmo[16]; /* with MSA4 */ + __u8 pcc[16]; /* with MSA4 */ + __u8 ppno[16]; /* with MSA5 */ + __u8 kma[16]; /* with MSA8 */ + __u8 reserved[1808]; +}; + +/* kvm attributes for crypto */ +#define KVM_S390_VM_CRYPTO_ENABLE_AES_KW 0 +#define KVM_S390_VM_CRYPTO_ENABLE_DEA_KW 1 +#define KVM_S390_VM_CRYPTO_DISABLE_AES_KW 2 +#define KVM_S390_VM_CRYPTO_DISABLE_DEA_KW 3 + +/* kvm attributes for migration mode */ +#define KVM_S390_VM_MIGRATION_STOP 0 +#define KVM_S390_VM_MIGRATION_START 1 +#define KVM_S390_VM_MIGRATION_STATUS 2 + +/* for KVM_GET_REGS and KVM_SET_REGS */ +struct kvm_regs { + /* general purpose regs for s390 */ + __u64 gprs[16]; +}; + +/* for KVM_GET_SREGS and KVM_SET_SREGS */ +struct kvm_sregs { + __u32 acrs[16]; + __u64 crs[16]; +}; + +/* for KVM_GET_FPU and KVM_SET_FPU */ +struct kvm_fpu { + __u32 fpc; + __u64 fprs[16]; +}; + +#define KVM_GUESTDBG_USE_HW_BP 0x00010000 + +#define KVM_HW_BP 1 +#define KVM_HW_WP_WRITE 2 +#define KVM_SINGLESTEP 4 + +struct kvm_debug_exit_arch { + __u64 addr; + __u8 type; + __u8 pad[7]; /* Should be set to 0 */ +}; + +struct kvm_hw_breakpoint { + __u64 addr; + __u64 phys_addr; + __u64 len; + __u8 type; + __u8 pad[7]; /* Should be set to 0 */ +}; + +/* for KVM_SET_GUEST_DEBUG */ +struct kvm_guest_debug_arch { + __u32 nr_hw_bp; + __u32 pad; /* Should be set to 0 */ + struct kvm_hw_breakpoint __user *hw_bp; +}; + +/* for KVM_SYNC_PFAULT and KVM_REG_S390_PFTOKEN */ +#define KVM_S390_PFAULT_TOKEN_INVALID 0xffffffffffffffffULL + +#define KVM_SYNC_PREFIX (1UL << 0) +#define KVM_SYNC_GPRS (1UL << 1) +#define KVM_SYNC_ACRS (1UL << 2) +#define KVM_SYNC_CRS (1UL << 3) +#define KVM_SYNC_ARCH0 (1UL << 4) +#define KVM_SYNC_PFAULT (1UL << 5) +#define KVM_SYNC_VRS (1UL << 6) +#define KVM_SYNC_RICCB (1UL << 7) +#define KVM_SYNC_FPRS (1UL << 8) +#define KVM_SYNC_GSCB (1UL << 9) +#define KVM_SYNC_BPBC (1UL << 10) +#define KVM_SYNC_ETOKEN (1UL << 11) +/* length and alignment of the sdnx as a power of two */ +#define SDNXC 8 +#define SDNXL (1UL << SDNXC) +/* definition of registers in kvm_run */ +struct kvm_sync_regs { + __u64 prefix; /* prefix register */ + __u64 gprs[16]; /* general purpose registers */ + __u32 acrs[16]; /* access registers */ + __u64 crs[16]; /* control registers */ + __u64 todpr; /* tod programmable register [ARCH0] */ + __u64 cputm; /* cpu timer [ARCH0] */ + __u64 ckc; /* clock comparator [ARCH0] */ + __u64 pp; /* program parameter [ARCH0] */ + __u64 gbea; /* guest breaking-event address [ARCH0] */ + __u64 pft; /* pfault token [PFAULT] */ + __u64 pfs; /* pfault select [PFAULT] */ + __u64 pfc; /* pfault compare [PFAULT] */ + union { + __u64 vrs[32][2]; /* vector registers (KVM_SYNC_VRS) */ + __u64 fprs[16]; /* fp registers (KVM_SYNC_FPRS) */ + }; + __u8 reserved[512]; /* for future vector expansion */ + __u32 fpc; /* valid on KVM_SYNC_VRS or KVM_SYNC_FPRS */ + __u8 bpbc : 1; /* bp mode */ + __u8 reserved2 : 7; + __u8 padding1[51]; /* riccb needs to be 64byte aligned */ + __u8 riccb[64]; /* runtime instrumentation controls block */ + __u8 padding2[192]; /* sdnx needs to be 256byte aligned */ + union { + __u8 sdnx[SDNXL]; /* state description annex */ + struct { + __u64 reserved1[2]; + __u64 gscb[4]; + __u64 etoken; + __u64 etoken_extension; + }; + }; +}; + +#define KVM_REG_S390_TODPR (KVM_REG_S390 | KVM_REG_SIZE_U32 | 0x1) +#define KVM_REG_S390_EPOCHDIFF (KVM_REG_S390 | KVM_REG_SIZE_U64 | 0x2) +#define KVM_REG_S390_CPU_TIMER (KVM_REG_S390 | KVM_REG_SIZE_U64 | 0x3) +#define KVM_REG_S390_CLOCK_COMP (KVM_REG_S390 | KVM_REG_SIZE_U64 | 0x4) +#define KVM_REG_S390_PFTOKEN (KVM_REG_S390 | KVM_REG_SIZE_U64 | 0x5) +#define KVM_REG_S390_PFCOMPARE (KVM_REG_S390 | KVM_REG_SIZE_U64 | 0x6) +#define KVM_REG_S390_PFSELECT (KVM_REG_S390 | KVM_REG_SIZE_U64 | 0x7) +#define KVM_REG_S390_PP (KVM_REG_S390 | KVM_REG_SIZE_U64 | 0x8) +#define KVM_REG_S390_GBEA (KVM_REG_S390 | KVM_REG_SIZE_U64 | 0x9) +#endif diff --git a/tools/arch/s390/include/uapi/asm/kvm_perf.h b/tools/arch/s390/include/uapi/asm/kvm_perf.h new file mode 100644 index 000000000..84606b8cc --- /dev/null +++ b/tools/arch/s390/include/uapi/asm/kvm_perf.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * Definitions for perf-kvm on s390 + * + * Copyright 2014 IBM Corp. + * Author(s): Alexander Yarygin + */ + +#ifndef __LINUX_KVM_PERF_S390_H +#define __LINUX_KVM_PERF_S390_H + +#include + +#define DECODE_STR_LEN 40 + +#define VCPU_ID "id" + +#define KVM_ENTRY_TRACE "kvm:kvm_s390_sie_enter" +#define KVM_EXIT_TRACE "kvm:kvm_s390_sie_exit" +#define KVM_EXIT_REASON "icptcode" + +#endif diff --git a/tools/arch/s390/include/uapi/asm/mman.h b/tools/arch/s390/include/uapi/asm/mman.h new file mode 100644 index 000000000..4ec32e425 --- /dev/null +++ b/tools/arch/s390/include/uapi/asm/mman.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H +#define TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H +#include +/* MAP_32BIT is undefined on s390, fix it for perf */ +#define MAP_32BIT 0 +#endif diff --git a/tools/arch/s390/include/uapi/asm/perf_regs.h b/tools/arch/s390/include/uapi/asm/perf_regs.h new file mode 100644 index 000000000..d17dd9e5d --- /dev/null +++ b/tools/arch/s390/include/uapi/asm/perf_regs.h @@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _ASM_S390_PERF_REGS_H +#define _ASM_S390_PERF_REGS_H + +enum perf_event_s390_regs { + PERF_REG_S390_R0, + PERF_REG_S390_R1, + PERF_REG_S390_R2, + PERF_REG_S390_R3, + PERF_REG_S390_R4, + PERF_REG_S390_R5, + PERF_REG_S390_R6, + PERF_REG_S390_R7, + PERF_REG_S390_R8, + PERF_REG_S390_R9, + PERF_REG_S390_R10, + PERF_REG_S390_R11, + PERF_REG_S390_R12, + PERF_REG_S390_R13, + PERF_REG_S390_R14, + PERF_REG_S390_R15, + PERF_REG_S390_FP0, + PERF_REG_S390_FP1, + PERF_REG_S390_FP2, + PERF_REG_S390_FP3, + PERF_REG_S390_FP4, + PERF_REG_S390_FP5, + PERF_REG_S390_FP6, + PERF_REG_S390_FP7, + PERF_REG_S390_FP8, + PERF_REG_S390_FP9, + PERF_REG_S390_FP10, + PERF_REG_S390_FP11, + PERF_REG_S390_FP12, + PERF_REG_S390_FP13, + PERF_REG_S390_FP14, + PERF_REG_S390_FP15, + PERF_REG_S390_MASK, + PERF_REG_S390_PC, + + PERF_REG_S390_MAX +}; + +#endif /* _ASM_S390_PERF_REGS_H */ diff --git a/tools/arch/s390/include/uapi/asm/ptrace.h b/tools/arch/s390/include/uapi/asm/ptrace.h new file mode 100644 index 000000000..543dd70e1 --- /dev/null +++ b/tools/arch/s390/include/uapi/asm/ptrace.h @@ -0,0 +1,457 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * S390 version + * Copyright IBM Corp. 1999, 2000 + * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) + */ + +#ifndef _UAPI_S390_PTRACE_H +#define _UAPI_S390_PTRACE_H + +/* + * Offsets in the user_regs_struct. They are used for the ptrace + * system call and in entry.S + */ +#ifndef __s390x__ + +#define PT_PSWMASK 0x00 +#define PT_PSWADDR 0x04 +#define PT_GPR0 0x08 +#define PT_GPR1 0x0C +#define PT_GPR2 0x10 +#define PT_GPR3 0x14 +#define PT_GPR4 0x18 +#define PT_GPR5 0x1C +#define PT_GPR6 0x20 +#define PT_GPR7 0x24 +#define PT_GPR8 0x28 +#define PT_GPR9 0x2C +#define PT_GPR10 0x30 +#define PT_GPR11 0x34 +#define PT_GPR12 0x38 +#define PT_GPR13 0x3C +#define PT_GPR14 0x40 +#define PT_GPR15 0x44 +#define PT_ACR0 0x48 +#define PT_ACR1 0x4C +#define PT_ACR2 0x50 +#define PT_ACR3 0x54 +#define PT_ACR4 0x58 +#define PT_ACR5 0x5C +#define PT_ACR6 0x60 +#define PT_ACR7 0x64 +#define PT_ACR8 0x68 +#define PT_ACR9 0x6C +#define PT_ACR10 0x70 +#define PT_ACR11 0x74 +#define PT_ACR12 0x78 +#define PT_ACR13 0x7C +#define PT_ACR14 0x80 +#define PT_ACR15 0x84 +#define PT_ORIGGPR2 0x88 +#define PT_FPC 0x90 +/* + * A nasty fact of life that the ptrace api + * only supports passing of longs. + */ +#define PT_FPR0_HI 0x98 +#define PT_FPR0_LO 0x9C +#define PT_FPR1_HI 0xA0 +#define PT_FPR1_LO 0xA4 +#define PT_FPR2_HI 0xA8 +#define PT_FPR2_LO 0xAC +#define PT_FPR3_HI 0xB0 +#define PT_FPR3_LO 0xB4 +#define PT_FPR4_HI 0xB8 +#define PT_FPR4_LO 0xBC +#define PT_FPR5_HI 0xC0 +#define PT_FPR5_LO 0xC4 +#define PT_FPR6_HI 0xC8 +#define PT_FPR6_LO 0xCC +#define PT_FPR7_HI 0xD0 +#define PT_FPR7_LO 0xD4 +#define PT_FPR8_HI 0xD8 +#define PT_FPR8_LO 0XDC +#define PT_FPR9_HI 0xE0 +#define PT_FPR9_LO 0xE4 +#define PT_FPR10_HI 0xE8 +#define PT_FPR10_LO 0xEC +#define PT_FPR11_HI 0xF0 +#define PT_FPR11_LO 0xF4 +#define PT_FPR12_HI 0xF8 +#define PT_FPR12_LO 0xFC +#define PT_FPR13_HI 0x100 +#define PT_FPR13_LO 0x104 +#define PT_FPR14_HI 0x108 +#define PT_FPR14_LO 0x10C +#define PT_FPR15_HI 0x110 +#define PT_FPR15_LO 0x114 +#define PT_CR_9 0x118 +#define PT_CR_10 0x11C +#define PT_CR_11 0x120 +#define PT_IEEE_IP 0x13C +#define PT_LASTOFF PT_IEEE_IP +#define PT_ENDREGS 0x140-1 + +#define GPR_SIZE 4 +#define CR_SIZE 4 + +#define STACK_FRAME_OVERHEAD 96 /* size of minimum stack frame */ + +#else /* __s390x__ */ + +#define PT_PSWMASK 0x00 +#define PT_PSWADDR 0x08 +#define PT_GPR0 0x10 +#define PT_GPR1 0x18 +#define PT_GPR2 0x20 +#define PT_GPR3 0x28 +#define PT_GPR4 0x30 +#define PT_GPR5 0x38 +#define PT_GPR6 0x40 +#define PT_GPR7 0x48 +#define PT_GPR8 0x50 +#define PT_GPR9 0x58 +#define PT_GPR10 0x60 +#define PT_GPR11 0x68 +#define PT_GPR12 0x70 +#define PT_GPR13 0x78 +#define PT_GPR14 0x80 +#define PT_GPR15 0x88 +#define PT_ACR0 0x90 +#define PT_ACR1 0x94 +#define PT_ACR2 0x98 +#define PT_ACR3 0x9C +#define PT_ACR4 0xA0 +#define PT_ACR5 0xA4 +#define PT_ACR6 0xA8 +#define PT_ACR7 0xAC +#define PT_ACR8 0xB0 +#define PT_ACR9 0xB4 +#define PT_ACR10 0xB8 +#define PT_ACR11 0xBC +#define PT_ACR12 0xC0 +#define PT_ACR13 0xC4 +#define PT_ACR14 0xC8 +#define PT_ACR15 0xCC +#define PT_ORIGGPR2 0xD0 +#define PT_FPC 0xD8 +#define PT_FPR0 0xE0 +#define PT_FPR1 0xE8 +#define PT_FPR2 0xF0 +#define PT_FPR3 0xF8 +#define PT_FPR4 0x100 +#define PT_FPR5 0x108 +#define PT_FPR6 0x110 +#define PT_FPR7 0x118 +#define PT_FPR8 0x120 +#define PT_FPR9 0x128 +#define PT_FPR10 0x130 +#define PT_FPR11 0x138 +#define PT_FPR12 0x140 +#define PT_FPR13 0x148 +#define PT_FPR14 0x150 +#define PT_FPR15 0x158 +#define PT_CR_9 0x160 +#define PT_CR_10 0x168 +#define PT_CR_11 0x170 +#define PT_IEEE_IP 0x1A8 +#define PT_LASTOFF PT_IEEE_IP +#define PT_ENDREGS 0x1B0-1 + +#define GPR_SIZE 8 +#define CR_SIZE 8 + +#define STACK_FRAME_OVERHEAD 160 /* size of minimum stack frame */ + +#endif /* __s390x__ */ + +#define NUM_GPRS 16 +#define NUM_FPRS 16 +#define NUM_CRS 16 +#define NUM_ACRS 16 + +#define NUM_CR_WORDS 3 + +#define FPR_SIZE 8 +#define FPC_SIZE 4 +#define FPC_PAD_SIZE 4 /* gcc insists on aligning the fpregs */ +#define ACR_SIZE 4 + + +#define PTRACE_OLDSETOPTIONS 21 + +#ifndef __ASSEMBLY__ +#include +#include + +typedef union { + float f; + double d; + __u64 ui; + struct + { + __u32 hi; + __u32 lo; + } fp; +} freg_t; + +typedef struct { + __u32 fpc; + __u32 pad; + freg_t fprs[NUM_FPRS]; +} s390_fp_regs; + +#define FPC_EXCEPTION_MASK 0xF8000000 +#define FPC_FLAGS_MASK 0x00F80000 +#define FPC_DXC_MASK 0x0000FF00 +#define FPC_RM_MASK 0x00000003 + +/* this typedef defines how a Program Status Word looks like */ +typedef struct { + unsigned long mask; + unsigned long addr; +} __attribute__ ((aligned(8))) psw_t; + +#ifndef __s390x__ + +#define PSW_MASK_PER 0x40000000UL +#define PSW_MASK_DAT 0x04000000UL +#define PSW_MASK_IO 0x02000000UL +#define PSW_MASK_EXT 0x01000000UL +#define PSW_MASK_KEY 0x00F00000UL +#define PSW_MASK_BASE 0x00080000UL /* always one */ +#define PSW_MASK_MCHECK 0x00040000UL +#define PSW_MASK_WAIT 0x00020000UL +#define PSW_MASK_PSTATE 0x00010000UL +#define PSW_MASK_ASC 0x0000C000UL +#define PSW_MASK_CC 0x00003000UL +#define PSW_MASK_PM 0x00000F00UL +#define PSW_MASK_RI 0x00000000UL +#define PSW_MASK_EA 0x00000000UL +#define PSW_MASK_BA 0x00000000UL + +#define PSW_MASK_USER 0x0000FF00UL + +#define PSW_ADDR_AMODE 0x80000000UL +#define PSW_ADDR_INSN 0x7FFFFFFFUL + +#define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 20) + +#define PSW_ASC_PRIMARY 0x00000000UL +#define PSW_ASC_ACCREG 0x00004000UL +#define PSW_ASC_SECONDARY 0x00008000UL +#define PSW_ASC_HOME 0x0000C000UL + +#else /* __s390x__ */ + +#define PSW_MASK_PER 0x4000000000000000UL +#define PSW_MASK_DAT 0x0400000000000000UL +#define PSW_MASK_IO 0x0200000000000000UL +#define PSW_MASK_EXT 0x0100000000000000UL +#define PSW_MASK_BASE 0x0000000000000000UL +#define PSW_MASK_KEY 0x00F0000000000000UL +#define PSW_MASK_MCHECK 0x0004000000000000UL +#define PSW_MASK_WAIT 0x0002000000000000UL +#define PSW_MASK_PSTATE 0x0001000000000000UL +#define PSW_MASK_ASC 0x0000C00000000000UL +#define PSW_MASK_CC 0x0000300000000000UL +#define PSW_MASK_PM 0x00000F0000000000UL +#define PSW_MASK_RI 0x0000008000000000UL +#define PSW_MASK_EA 0x0000000100000000UL +#define PSW_MASK_BA 0x0000000080000000UL + +#define PSW_MASK_USER 0x0000FF0180000000UL + +#define PSW_ADDR_AMODE 0x0000000000000000UL +#define PSW_ADDR_INSN 0xFFFFFFFFFFFFFFFFUL + +#define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 52) + +#define PSW_ASC_PRIMARY 0x0000000000000000UL +#define PSW_ASC_ACCREG 0x0000400000000000UL +#define PSW_ASC_SECONDARY 0x0000800000000000UL +#define PSW_ASC_HOME 0x0000C00000000000UL + +#endif /* __s390x__ */ + + +/* + * The s390_regs structure is used to define the elf_gregset_t. + */ +typedef struct { + psw_t psw; + unsigned long gprs[NUM_GPRS]; + unsigned int acrs[NUM_ACRS]; + unsigned long orig_gpr2; +} s390_regs; + +/* + * The user_pt_regs structure exports the beginning of + * the in-kernel pt_regs structure to user space. + */ +typedef struct { + unsigned long args[1]; + psw_t psw; + unsigned long gprs[NUM_GPRS]; +} user_pt_regs; + +/* + * Now for the user space program event recording (trace) definitions. + * The following structures are used only for the ptrace interface, don't + * touch or even look at it if you don't want to modify the user-space + * ptrace interface. In particular stay away from it for in-kernel PER. + */ +typedef struct { + unsigned long cr[NUM_CR_WORDS]; +} per_cr_words; + +#define PER_EM_MASK 0xE8000000UL + +typedef struct { +#ifdef __s390x__ + unsigned : 32; +#endif /* __s390x__ */ + unsigned em_branching : 1; + unsigned em_instruction_fetch : 1; + /* + * Switching on storage alteration automatically fixes + * the storage alteration event bit in the users std. + */ + unsigned em_storage_alteration : 1; + unsigned em_gpr_alt_unused : 1; + unsigned em_store_real_address : 1; + unsigned : 3; + unsigned branch_addr_ctl : 1; + unsigned : 1; + unsigned storage_alt_space_ctl : 1; + unsigned : 21; + unsigned long starting_addr; + unsigned long ending_addr; +} per_cr_bits; + +typedef struct { + unsigned short perc_atmid; + unsigned long address; + unsigned char access_id; +} per_lowcore_words; + +typedef struct { + unsigned perc_branching : 1; + unsigned perc_instruction_fetch : 1; + unsigned perc_storage_alteration : 1; + unsigned perc_gpr_alt_unused : 1; + unsigned perc_store_real_address : 1; + unsigned : 3; + unsigned atmid_psw_bit_31 : 1; + unsigned atmid_validity_bit : 1; + unsigned atmid_psw_bit_32 : 1; + unsigned atmid_psw_bit_5 : 1; + unsigned atmid_psw_bit_16 : 1; + unsigned atmid_psw_bit_17 : 1; + unsigned si : 2; + unsigned long address; + unsigned : 4; + unsigned access_id : 4; +} per_lowcore_bits; + +typedef struct { + union { + per_cr_words words; + per_cr_bits bits; + } control_regs; + /* + * The single_step and instruction_fetch bits are obsolete, + * the kernel always sets them to zero. To enable single + * stepping use ptrace(PTRACE_SINGLESTEP) instead. + */ + unsigned single_step : 1; + unsigned instruction_fetch : 1; + unsigned : 30; + /* + * These addresses are copied into cr10 & cr11 if single + * stepping is switched off + */ + unsigned long starting_addr; + unsigned long ending_addr; + union { + per_lowcore_words words; + per_lowcore_bits bits; + } lowcore; +} per_struct; + +typedef struct { + unsigned int len; + unsigned long kernel_addr; + unsigned long process_addr; +} ptrace_area; + +/* + * S/390 specific non posix ptrace requests. I chose unusual values so + * they are unlikely to clash with future ptrace definitions. + */ +#define PTRACE_PEEKUSR_AREA 0x5000 +#define PTRACE_POKEUSR_AREA 0x5001 +#define PTRACE_PEEKTEXT_AREA 0x5002 +#define PTRACE_PEEKDATA_AREA 0x5003 +#define PTRACE_POKETEXT_AREA 0x5004 +#define PTRACE_POKEDATA_AREA 0x5005 +#define PTRACE_GET_LAST_BREAK 0x5006 +#define PTRACE_PEEK_SYSTEM_CALL 0x5007 +#define PTRACE_POKE_SYSTEM_CALL 0x5008 +#define PTRACE_ENABLE_TE 0x5009 +#define PTRACE_DISABLE_TE 0x5010 +#define PTRACE_TE_ABORT_RAND 0x5011 + +/* + * The numbers chosen here are somewhat arbitrary but absolutely MUST + * not overlap with any of the number assigned in . + */ +#define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */ + +/* + * PT_PROT definition is loosely based on hppa bsd definition in + * gdb/hppab-nat.c + */ +#define PTRACE_PROT 21 + +typedef enum { + ptprot_set_access_watchpoint, + ptprot_set_write_watchpoint, + ptprot_disable_watchpoint +} ptprot_flags; + +typedef struct { + unsigned long lowaddr; + unsigned long hiaddr; + ptprot_flags prot; +} ptprot_area; + +/* Sequence of bytes for breakpoint illegal instruction. */ +#define S390_BREAKPOINT {0x0,0x1} +#define S390_BREAKPOINT_U16 ((__u16)0x0001) +#define S390_SYSCALL_OPCODE ((__u16)0x0a00) +#define S390_SYSCALL_SIZE 2 + +/* + * The user_regs_struct defines the way the user registers are + * store on the stack for signal handling. + */ +struct user_regs_struct { + psw_t psw; + unsigned long gprs[NUM_GPRS]; + unsigned int acrs[NUM_ACRS]; + unsigned long orig_gpr2; + s390_fp_regs fp_regs; + /* + * These per registers are in here so that gdb can modify them + * itself as there is no "official" ptrace interface for hardware + * watchpoints. This is the way intel does it. + */ + per_struct per_info; + unsigned long ieee_instruction_pointer; /* obsolete, always 0 */ +}; + +#endif /* __ASSEMBLY__ */ + +#endif /* _UAPI_S390_PTRACE_H */ diff --git a/tools/arch/s390/include/uapi/asm/sie.h b/tools/arch/s390/include/uapi/asm/sie.h new file mode 100644 index 000000000..6ca1e68d7 --- /dev/null +++ b/tools/arch/s390/include/uapi/asm/sie.h @@ -0,0 +1,252 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _UAPI_ASM_S390_SIE_H +#define _UAPI_ASM_S390_SIE_H + +#define diagnose_codes \ + { 0x10, "DIAG (0x10) release pages" }, \ + { 0x44, "DIAG (0x44) time slice end" }, \ + { 0x9c, "DIAG (0x9c) time slice end directed" }, \ + { 0x204, "DIAG (0x204) logical-cpu utilization" }, \ + { 0x258, "DIAG (0x258) page-reference services" }, \ + { 0x288, "DIAG (0x288) watchdog functions" }, \ + { 0x308, "DIAG (0x308) ipl functions" }, \ + { 0x500, "DIAG (0x500) KVM virtio functions" }, \ + { 0x501, "DIAG (0x501) KVM breakpoint" } + +#define sigp_order_codes \ + { 0x01, "SIGP sense" }, \ + { 0x02, "SIGP external call" }, \ + { 0x03, "SIGP emergency signal" }, \ + { 0x04, "SIGP start" }, \ + { 0x05, "SIGP stop" }, \ + { 0x06, "SIGP restart" }, \ + { 0x09, "SIGP stop and store status" }, \ + { 0x0b, "SIGP initial cpu reset" }, \ + { 0x0c, "SIGP cpu reset" }, \ + { 0x0d, "SIGP set prefix" }, \ + { 0x0e, "SIGP store status at address" }, \ + { 0x12, "SIGP set architecture" }, \ + { 0x13, "SIGP conditional emergency signal" }, \ + { 0x15, "SIGP sense running" }, \ + { 0x16, "SIGP set multithreading"}, \ + { 0x17, "SIGP store additional status ait address"} + +#define icpt_prog_codes \ + { 0x0001, "Prog Operation" }, \ + { 0x0002, "Prog Privileged Operation" }, \ + { 0x0003, "Prog Execute" }, \ + { 0x0004, "Prog Protection" }, \ + { 0x0005, "Prog Addressing" }, \ + { 0x0006, "Prog Specification" }, \ + { 0x0007, "Prog Data" }, \ + { 0x0008, "Prog Fixedpoint overflow" }, \ + { 0x0009, "Prog Fixedpoint divide" }, \ + { 0x000A, "Prog Decimal overflow" }, \ + { 0x000B, "Prog Decimal divide" }, \ + { 0x000C, "Prog HFP exponent overflow" }, \ + { 0x000D, "Prog HFP exponent underflow" }, \ + { 0x000E, "Prog HFP significance" }, \ + { 0x000F, "Prog HFP divide" }, \ + { 0x0010, "Prog Segment translation" }, \ + { 0x0011, "Prog Page translation" }, \ + { 0x0012, "Prog Translation specification" }, \ + { 0x0013, "Prog Special operation" }, \ + { 0x0015, "Prog Operand" }, \ + { 0x0016, "Prog Trace table" }, \ + { 0x0017, "Prog ASNtranslation specification" }, \ + { 0x001C, "Prog Spaceswitch event" }, \ + { 0x001D, "Prog HFP square root" }, \ + { 0x001F, "Prog PCtranslation specification" }, \ + { 0x0020, "Prog AFX translation" }, \ + { 0x0021, "Prog ASX translation" }, \ + { 0x0022, "Prog LX translation" }, \ + { 0x0023, "Prog EX translation" }, \ + { 0x0024, "Prog Primary authority" }, \ + { 0x0025, "Prog Secondary authority" }, \ + { 0x0026, "Prog LFXtranslation exception" }, \ + { 0x0027, "Prog LSXtranslation exception" }, \ + { 0x0028, "Prog ALET specification" }, \ + { 0x0029, "Prog ALEN translation" }, \ + { 0x002A, "Prog ALE sequence" }, \ + { 0x002B, "Prog ASTE validity" }, \ + { 0x002C, "Prog ASTE sequence" }, \ + { 0x002D, "Prog Extended authority" }, \ + { 0x002E, "Prog LSTE sequence" }, \ + { 0x002F, "Prog ASTE instance" }, \ + { 0x0030, "Prog Stack full" }, \ + { 0x0031, "Prog Stack empty" }, \ + { 0x0032, "Prog Stack specification" }, \ + { 0x0033, "Prog Stack type" }, \ + { 0x0034, "Prog Stack operation" }, \ + { 0x0039, "Prog Region first translation" }, \ + { 0x003A, "Prog Region second translation" }, \ + { 0x003B, "Prog Region third translation" }, \ + { 0x0040, "Prog Monitor event" }, \ + { 0x0080, "Prog PER event" }, \ + { 0x0119, "Prog Crypto operation" } + +#define exit_code_ipa0(ipa0, opcode, mnemonic) \ + { (ipa0 << 8 | opcode), #ipa0 " " mnemonic } +#define exit_code(opcode, mnemonic) \ + { opcode, mnemonic } + +#define icpt_insn_codes \ + exit_code_ipa0(0x01, 0x01, "PR"), \ + exit_code_ipa0(0x01, 0x04, "PTFF"), \ + exit_code_ipa0(0x01, 0x07, "SCKPF"), \ + exit_code_ipa0(0xAA, 0x00, "RINEXT"), \ + exit_code_ipa0(0xAA, 0x01, "RION"), \ + exit_code_ipa0(0xAA, 0x02, "TRIC"), \ + exit_code_ipa0(0xAA, 0x03, "RIOFF"), \ + exit_code_ipa0(0xAA, 0x04, "RIEMIT"), \ + exit_code_ipa0(0xB2, 0x02, "STIDP"), \ + exit_code_ipa0(0xB2, 0x04, "SCK"), \ + exit_code_ipa0(0xB2, 0x05, "STCK"), \ + exit_code_ipa0(0xB2, 0x06, "SCKC"), \ + exit_code_ipa0(0xB2, 0x07, "STCKC"), \ + exit_code_ipa0(0xB2, 0x08, "SPT"), \ + exit_code_ipa0(0xB2, 0x09, "STPT"), \ + exit_code_ipa0(0xB2, 0x0d, "PTLB"), \ + exit_code_ipa0(0xB2, 0x10, "SPX"), \ + exit_code_ipa0(0xB2, 0x11, "STPX"), \ + exit_code_ipa0(0xB2, 0x12, "STAP"), \ + exit_code_ipa0(0xB2, 0x14, "SIE"), \ + exit_code_ipa0(0xB2, 0x16, "SETR"), \ + exit_code_ipa0(0xB2, 0x17, "STETR"), \ + exit_code_ipa0(0xB2, 0x18, "PC"), \ + exit_code_ipa0(0xB2, 0x20, "SERVC"), \ + exit_code_ipa0(0xB2, 0x21, "IPTE"), \ + exit_code_ipa0(0xB2, 0x28, "PT"), \ + exit_code_ipa0(0xB2, 0x29, "ISKE"), \ + exit_code_ipa0(0xB2, 0x2a, "RRBE"), \ + exit_code_ipa0(0xB2, 0x2b, "SSKE"), \ + exit_code_ipa0(0xB2, 0x2c, "TB"), \ + exit_code_ipa0(0xB2, 0x2e, "PGIN"), \ + exit_code_ipa0(0xB2, 0x2f, "PGOUT"), \ + exit_code_ipa0(0xB2, 0x30, "CSCH"), \ + exit_code_ipa0(0xB2, 0x31, "HSCH"), \ + exit_code_ipa0(0xB2, 0x32, "MSCH"), \ + exit_code_ipa0(0xB2, 0x33, "SSCH"), \ + exit_code_ipa0(0xB2, 0x34, "STSCH"), \ + exit_code_ipa0(0xB2, 0x35, "TSCH"), \ + exit_code_ipa0(0xB2, 0x36, "TPI"), \ + exit_code_ipa0(0xB2, 0x37, "SAL"), \ + exit_code_ipa0(0xB2, 0x38, "RSCH"), \ + exit_code_ipa0(0xB2, 0x39, "STCRW"), \ + exit_code_ipa0(0xB2, 0x3a, "STCPS"), \ + exit_code_ipa0(0xB2, 0x3b, "RCHP"), \ + exit_code_ipa0(0xB2, 0x3c, "SCHM"), \ + exit_code_ipa0(0xB2, 0x40, "BAKR"), \ + exit_code_ipa0(0xB2, 0x48, "PALB"), \ + exit_code_ipa0(0xB2, 0x4c, "TAR"), \ + exit_code_ipa0(0xB2, 0x50, "CSP"), \ + exit_code_ipa0(0xB2, 0x54, "MVPG"), \ + exit_code_ipa0(0xB2, 0x56, "STHYI"), \ + exit_code_ipa0(0xB2, 0x58, "BSG"), \ + exit_code_ipa0(0xB2, 0x5a, "BSA"), \ + exit_code_ipa0(0xB2, 0x5f, "CHSC"), \ + exit_code_ipa0(0xB2, 0x74, "SIGA"), \ + exit_code_ipa0(0xB2, 0x76, "XSCH"), \ + exit_code_ipa0(0xB2, 0x78, "STCKE"), \ + exit_code_ipa0(0xB2, 0x7c, "STCKF"), \ + exit_code_ipa0(0xB2, 0x7d, "STSI"), \ + exit_code_ipa0(0xB2, 0xb0, "STFLE"), \ + exit_code_ipa0(0xB2, 0xb1, "STFL"), \ + exit_code_ipa0(0xB2, 0xb2, "LPSWE"), \ + exit_code_ipa0(0xB2, 0xf8, "TEND"), \ + exit_code_ipa0(0xB2, 0xfc, "TABORT"), \ + exit_code_ipa0(0xB9, 0x1e, "KMAC"), \ + exit_code_ipa0(0xB9, 0x28, "PCKMO"), \ + exit_code_ipa0(0xB9, 0x2a, "KMF"), \ + exit_code_ipa0(0xB9, 0x2b, "KMO"), \ + exit_code_ipa0(0xB9, 0x2d, "KMCTR"), \ + exit_code_ipa0(0xB9, 0x2e, "KM"), \ + exit_code_ipa0(0xB9, 0x2f, "KMC"), \ + exit_code_ipa0(0xB9, 0x3e, "KIMD"), \ + exit_code_ipa0(0xB9, 0x3f, "KLMD"), \ + exit_code_ipa0(0xB9, 0x8a, "CSPG"), \ + exit_code_ipa0(0xB9, 0x8d, "EPSW"), \ + exit_code_ipa0(0xB9, 0x8e, "IDTE"), \ + exit_code_ipa0(0xB9, 0x8f, "CRDTE"), \ + exit_code_ipa0(0xB9, 0x9c, "EQBS"), \ + exit_code_ipa0(0xB9, 0xa2, "PTF"), \ + exit_code_ipa0(0xB9, 0xab, "ESSA"), \ + exit_code_ipa0(0xB9, 0xae, "RRBM"), \ + exit_code_ipa0(0xB9, 0xaf, "PFMF"), \ + exit_code_ipa0(0xE3, 0x03, "LRAG"), \ + exit_code_ipa0(0xE3, 0x13, "LRAY"), \ + exit_code_ipa0(0xE3, 0x25, "NTSTG"), \ + exit_code_ipa0(0xE5, 0x00, "LASP"), \ + exit_code_ipa0(0xE5, 0x01, "TPROT"), \ + exit_code_ipa0(0xE5, 0x60, "TBEGIN"), \ + exit_code_ipa0(0xE5, 0x61, "TBEGINC"), \ + exit_code_ipa0(0xEB, 0x25, "STCTG"), \ + exit_code_ipa0(0xEB, 0x2f, "LCTLG"), \ + exit_code_ipa0(0xEB, 0x60, "LRIC"), \ + exit_code_ipa0(0xEB, 0x61, "STRIC"), \ + exit_code_ipa0(0xEB, 0x62, "MRIC"), \ + exit_code_ipa0(0xEB, 0x8a, "SQBS"), \ + exit_code_ipa0(0xC8, 0x01, "ECTG"), \ + exit_code(0x0a, "SVC"), \ + exit_code(0x80, "SSM"), \ + exit_code(0x82, "LPSW"), \ + exit_code(0x83, "DIAG"), \ + exit_code(0xae, "SIGP"), \ + exit_code(0xac, "STNSM"), \ + exit_code(0xad, "STOSM"), \ + exit_code(0xb1, "LRA"), \ + exit_code(0xb6, "STCTL"), \ + exit_code(0xb7, "LCTL"), \ + exit_code(0xee, "PLO") + +#define sie_intercept_code \ + { 0x00, "Host interruption" }, \ + { 0x04, "Instruction" }, \ + { 0x08, "Program interruption" }, \ + { 0x0c, "Instruction and program interruption" }, \ + { 0x10, "External request" }, \ + { 0x14, "External interruption" }, \ + { 0x18, "I/O request" }, \ + { 0x1c, "Wait state" }, \ + { 0x20, "Validity" }, \ + { 0x28, "Stop request" }, \ + { 0x2c, "Operation exception" }, \ + { 0x38, "Partial-execution" }, \ + { 0x3c, "I/O interruption" }, \ + { 0x40, "I/O instruction" }, \ + { 0x48, "Timing subset" } + +/* + * This is the simple interceptable instructions decoder. + * + * It will be used as userspace interface and it can be used in places + * that does not allow to use general decoder functions, + * such as trace events declarations. + * + * Some userspace tools may want to parse this code + * and would be confused by switch(), if() and other statements, + * but they can understand conditional operator. + */ +#define INSN_DECODE_IPA0(ipa0, insn, rshift, mask) \ + (insn >> 56) == (ipa0) ? \ + ((ipa0 << 8) | ((insn >> rshift) & mask)) : + +#define INSN_DECODE(insn) (insn >> 56) + +/* + * The macro icpt_insn_decoder() takes an intercepted instruction + * and returns a key, which can be used to find a mnemonic name + * of the instruction in the icpt_insn_codes table. + */ +#define icpt_insn_decoder(insn) ( \ + INSN_DECODE_IPA0(0x01, insn, 48, 0xff) \ + INSN_DECODE_IPA0(0xaa, insn, 48, 0x0f) \ + INSN_DECODE_IPA0(0xb2, insn, 48, 0xff) \ + INSN_DECODE_IPA0(0xb9, insn, 48, 0xff) \ + INSN_DECODE_IPA0(0xe3, insn, 48, 0xff) \ + INSN_DECODE_IPA0(0xe5, insn, 48, 0xff) \ + INSN_DECODE_IPA0(0xeb, insn, 16, 0xff) \ + INSN_DECODE_IPA0(0xc8, insn, 48, 0x0f) \ + INSN_DECODE(insn)) + +#endif /* _UAPI_ASM_S390_SIE_H */ diff --git a/tools/arch/sh/include/asm/barrier.h b/tools/arch/sh/include/asm/barrier.h new file mode 100644 index 000000000..bde5221af --- /dev/null +++ b/tools/arch/sh/include/asm/barrier.h @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copied from the kernel sources: + * + * Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima + * Copyright (C) 2002 Paul Mundt + */ +#ifndef __TOOLS_LINUX_ASM_SH_BARRIER_H +#define __TOOLS_LINUX_ASM_SH_BARRIER_H + +/* + * A brief note on ctrl_barrier(), the control register write barrier. + * + * Legacy SH cores typically require a sequence of 8 nops after + * modification of a control register in order for the changes to take + * effect. On newer cores (like the sh4a and sh5) this is accomplished + * with icbi. + * + * Also note that on sh4a in the icbi case we can forego a synco for the + * write barrier, as it's not necessary for control registers. + * + * Historically we have only done this type of barrier for the MMUCR, but + * it's also necessary for the CCR, so we make it generic here instead. + */ +#if defined(__SH4A__) || defined(__SH5__) +#define mb() __asm__ __volatile__ ("synco": : :"memory") +#define rmb() mb() +#define wmb() mb() +#endif + +#include + +#endif /* __TOOLS_LINUX_ASM_SH_BARRIER_H */ diff --git a/tools/arch/sh/include/uapi/asm/mman.h b/tools/arch/sh/include/uapi/asm/mman.h new file mode 100644 index 000000000..88c0e2930 --- /dev/null +++ b/tools/arch/sh/include/uapi/asm/mman.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H +#define TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H +#include +/* MAP_32BIT is undefined on sh, fix it for perf */ +#define MAP_32BIT 0 +#endif diff --git a/tools/arch/sparc/include/asm/barrier.h b/tools/arch/sparc/include/asm/barrier.h new file mode 100644 index 000000000..95d161846 --- /dev/null +++ b/tools/arch/sparc/include/asm/barrier.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef ___TOOLS_LINUX_ASM_SPARC_BARRIER_H +#define ___TOOLS_LINUX_ASM_SPARC_BARRIER_H +#if defined(__sparc__) && defined(__arch64__) +#include "barrier_64.h" +#else +#include "barrier_32.h" +#endif +#endif diff --git a/tools/arch/sparc/include/asm/barrier_32.h b/tools/arch/sparc/include/asm/barrier_32.h new file mode 100644 index 000000000..cc19ed1dd --- /dev/null +++ b/tools/arch/sparc/include/asm/barrier_32.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __TOOLS_PERF_SPARC_BARRIER_H +#define __TOOLS_PERF_SPARC_BARRIER_H + +#include + +#endif /* !(__TOOLS_PERF_SPARC_BARRIER_H) */ diff --git a/tools/arch/sparc/include/asm/barrier_64.h b/tools/arch/sparc/include/asm/barrier_64.h new file mode 100644 index 000000000..ba6134428 --- /dev/null +++ b/tools/arch/sparc/include/asm/barrier_64.h @@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __TOOLS_LINUX_SPARC64_BARRIER_H +#define __TOOLS_LINUX_SPARC64_BARRIER_H + +/* Copied from the kernel sources to tools/: + * + * These are here in an effort to more fully work around Spitfire Errata + * #51. Essentially, if a memory barrier occurs soon after a mispredicted + * branch, the chip can stop executing instructions until a trap occurs. + * Therefore, if interrupts are disabled, the chip can hang forever. + * + * It used to be believed that the memory barrier had to be right in the + * delay slot, but a case has been traced recently wherein the memory barrier + * was one instruction after the branch delay slot and the chip still hung. + * The offending sequence was the following in sym_wakeup_done() of the + * sym53c8xx_2 driver: + * + * call sym_ccb_from_dsa, 0 + * movge %icc, 0, %l0 + * brz,pn %o0, .LL1303 + * mov %o0, %l2 + * membar #LoadLoad + * + * The branch has to be mispredicted for the bug to occur. Therefore, we put + * the memory barrier explicitly into a "branch always, predicted taken" + * delay slot to avoid the problem case. + */ +#define membar_safe(type) \ +do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \ + " membar " type "\n" \ + "1:\n" \ + : : : "memory"); \ +} while (0) + +/* The kernel always executes in TSO memory model these days, + * and furthermore most sparc64 chips implement more stringent + * memory ordering than required by the specifications. + */ +#define mb() membar_safe("#StoreLoad") +#define rmb() __asm__ __volatile__("":::"memory") +#define wmb() __asm__ __volatile__("":::"memory") + +#endif /* !(__TOOLS_LINUX_SPARC64_BARRIER_H) */ diff --git a/tools/arch/sparc/include/uapi/asm/bitsperlong.h b/tools/arch/sparc/include/uapi/asm/bitsperlong.h new file mode 100644 index 000000000..3b4e61740 --- /dev/null +++ b/tools/arch/sparc/include/uapi/asm/bitsperlong.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_ALPHA_BITSPERLONG_H +#define __ASM_ALPHA_BITSPERLONG_H + +#if defined(__sparc__) && defined(__arch64__) +#define __BITS_PER_LONG 64 +#else +#define __BITS_PER_LONG 32 +#endif + +#include + +#endif /* __ASM_ALPHA_BITSPERLONG_H */ diff --git a/tools/arch/sparc/include/uapi/asm/errno.h b/tools/arch/sparc/include/uapi/asm/errno.h new file mode 100644 index 000000000..81a732b90 --- /dev/null +++ b/tools/arch/sparc/include/uapi/asm/errno.h @@ -0,0 +1,118 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _SPARC_ERRNO_H +#define _SPARC_ERRNO_H + +/* These match the SunOS error numbering scheme. */ + +#include + +#define EWOULDBLOCK EAGAIN /* Operation would block */ +#define EINPROGRESS 36 /* Operation now in progress */ +#define EALREADY 37 /* Operation already in progress */ +#define ENOTSOCK 38 /* Socket operation on non-socket */ +#define EDESTADDRREQ 39 /* Destination address required */ +#define EMSGSIZE 40 /* Message too long */ +#define EPROTOTYPE 41 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 42 /* Protocol not available */ +#define EPROTONOSUPPORT 43 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ +#define EOPNOTSUPP 45 /* Op not supported on transport endpoint */ +#define EPFNOSUPPORT 46 /* Protocol family not supported */ +#define EAFNOSUPPORT 47 /* Address family not supported by protocol */ +#define EADDRINUSE 48 /* Address already in use */ +#define EADDRNOTAVAIL 49 /* Cannot assign requested address */ +#define ENETDOWN 50 /* Network is down */ +#define ENETUNREACH 51 /* Network is unreachable */ +#define ENETRESET 52 /* Net dropped connection because of reset */ +#define ECONNABORTED 53 /* Software caused connection abort */ +#define ECONNRESET 54 /* Connection reset by peer */ +#define ENOBUFS 55 /* No buffer space available */ +#define EISCONN 56 /* Transport endpoint is already connected */ +#define ENOTCONN 57 /* Transport endpoint is not connected */ +#define ESHUTDOWN 58 /* No send after transport endpoint shutdown */ +#define ETOOMANYREFS 59 /* Too many references: cannot splice */ +#define ETIMEDOUT 60 /* Connection timed out */ +#define ECONNREFUSED 61 /* Connection refused */ +#define ELOOP 62 /* Too many symbolic links encountered */ +#define ENAMETOOLONG 63 /* File name too long */ +#define EHOSTDOWN 64 /* Host is down */ +#define EHOSTUNREACH 65 /* No route to host */ +#define ENOTEMPTY 66 /* Directory not empty */ +#define EPROCLIM 67 /* SUNOS: Too many processes */ +#define EUSERS 68 /* Too many users */ +#define EDQUOT 69 /* Quota exceeded */ +#define ESTALE 70 /* Stale file handle */ +#define EREMOTE 71 /* Object is remote */ +#define ENOSTR 72 /* Device not a stream */ +#define ETIME 73 /* Timer expired */ +#define ENOSR 74 /* Out of streams resources */ +#define ENOMSG 75 /* No message of desired type */ +#define EBADMSG 76 /* Not a data message */ +#define EIDRM 77 /* Identifier removed */ +#define EDEADLK 78 /* Resource deadlock would occur */ +#define ENOLCK 79 /* No record locks available */ +#define ENONET 80 /* Machine is not on the network */ +#define ERREMOTE 81 /* SunOS: Too many lvls of remote in path */ +#define ENOLINK 82 /* Link has been severed */ +#define EADV 83 /* Advertise error */ +#define ESRMNT 84 /* Srmount error */ +#define ECOMM 85 /* Communication error on send */ +#define EPROTO 86 /* Protocol error */ +#define EMULTIHOP 87 /* Multihop attempted */ +#define EDOTDOT 88 /* RFS specific error */ +#define EREMCHG 89 /* Remote address changed */ +#define ENOSYS 90 /* Function not implemented */ + +/* The rest have no SunOS equivalent. */ +#define ESTRPIPE 91 /* Streams pipe error */ +#define EOVERFLOW 92 /* Value too large for defined data type */ +#define EBADFD 93 /* File descriptor in bad state */ +#define ECHRNG 94 /* Channel number out of range */ +#define EL2NSYNC 95 /* Level 2 not synchronized */ +#define EL3HLT 96 /* Level 3 halted */ +#define EL3RST 97 /* Level 3 reset */ +#define ELNRNG 98 /* Link number out of range */ +#define EUNATCH 99 /* Protocol driver not attached */ +#define ENOCSI 100 /* No CSI structure available */ +#define EL2HLT 101 /* Level 2 halted */ +#define EBADE 102 /* Invalid exchange */ +#define EBADR 103 /* Invalid request descriptor */ +#define EXFULL 104 /* Exchange full */ +#define ENOANO 105 /* No anode */ +#define EBADRQC 106 /* Invalid request code */ +#define EBADSLT 107 /* Invalid slot */ +#define EDEADLOCK 108 /* File locking deadlock error */ +#define EBFONT 109 /* Bad font file format */ +#define ELIBEXEC 110 /* Cannot exec a shared library directly */ +#define ENODATA 111 /* No data available */ +#define ELIBBAD 112 /* Accessing a corrupted shared library */ +#define ENOPKG 113 /* Package not installed */ +#define ELIBACC 114 /* Can not access a needed shared library */ +#define ENOTUNIQ 115 /* Name not unique on network */ +#define ERESTART 116 /* Interrupted syscall should be restarted */ +#define EUCLEAN 117 /* Structure needs cleaning */ +#define ENOTNAM 118 /* Not a XENIX named type file */ +#define ENAVAIL 119 /* No XENIX semaphores available */ +#define EISNAM 120 /* Is a named type file */ +#define EREMOTEIO 121 /* Remote I/O error */ +#define EILSEQ 122 /* Illegal byte sequence */ +#define ELIBMAX 123 /* Atmpt to link in too many shared libs */ +#define ELIBSCN 124 /* .lib section in a.out corrupted */ + +#define ENOMEDIUM 125 /* No medium found */ +#define EMEDIUMTYPE 126 /* Wrong medium type */ +#define ECANCELED 127 /* Operation Cancelled */ +#define ENOKEY 128 /* Required key not available */ +#define EKEYEXPIRED 129 /* Key has expired */ +#define EKEYREVOKED 130 /* Key has been revoked */ +#define EKEYREJECTED 131 /* Key was rejected by service */ + +/* for robust mutexes */ +#define EOWNERDEAD 132 /* Owner died */ +#define ENOTRECOVERABLE 133 /* State not recoverable */ + +#define ERFKILL 134 /* Operation not possible due to RF-kill */ + +#define EHWPOISON 135 /* Memory page has hardware error */ + +#endif diff --git a/tools/arch/sparc/include/uapi/asm/mman.h b/tools/arch/sparc/include/uapi/asm/mman.h new file mode 100644 index 000000000..38920eed8 --- /dev/null +++ b/tools/arch/sparc/include/uapi/asm/mman.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H +#define TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H +#define MAP_DENYWRITE 0x0800 +#define MAP_EXECUTABLE 0x1000 +#define MAP_GROWSDOWN 0x0200 +#define MAP_HUGETLB 0x40000 +#define MAP_LOCKED 0x100 +#define MAP_NONBLOCK 0x10000 +#define MAP_NORESERVE 0x40 +#define MAP_POPULATE 0x8000 +#define MAP_STACK 0x20000 +#include +/* MAP_32BIT is undefined on sparc, fix it for perf */ +#define MAP_32BIT 0 +#endif diff --git a/tools/arch/x86/include/asm/atomic.h b/tools/arch/x86/include/asm/atomic.h new file mode 100644 index 000000000..1f5e26aae --- /dev/null +++ b/tools/arch/x86/include/asm/atomic.h @@ -0,0 +1,73 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _TOOLS_LINUX_ASM_X86_ATOMIC_H +#define _TOOLS_LINUX_ASM_X86_ATOMIC_H + +#include +#include +#include "rmwcc.h" + +#define LOCK_PREFIX "\n\tlock; " + +#include + +/* + * Atomic operations that C can't guarantee us. Useful for + * resource counting etc.. + */ + +#define ATOMIC_INIT(i) { (i) } + +/** + * atomic_read - read atomic variable + * @v: pointer of type atomic_t + * + * Atomically reads the value of @v. + */ +static inline int atomic_read(const atomic_t *v) +{ + return READ_ONCE((v)->counter); +} + +/** + * atomic_set - set atomic variable + * @v: pointer of type atomic_t + * @i: required value + * + * Atomically sets the value of @v to @i. + */ +static inline void atomic_set(atomic_t *v, int i) +{ + v->counter = i; +} + +/** + * atomic_inc - increment atomic variable + * @v: pointer of type atomic_t + * + * Atomically increments @v by 1. + */ +static inline void atomic_inc(atomic_t *v) +{ + asm volatile(LOCK_PREFIX "incl %0" + : "+m" (v->counter)); +} + +/** + * atomic_dec_and_test - decrement and test + * @v: pointer of type atomic_t + * + * Atomically decrements @v by 1 and + * returns true if the result is 0, or false for all other + * cases. + */ +static inline int atomic_dec_and_test(atomic_t *v) +{ + GEN_UNARY_RMWcc(LOCK_PREFIX "decl", v->counter, "%0", "e"); +} + +static __always_inline int atomic_cmpxchg(atomic_t *v, int old, int new) +{ + return cmpxchg(&v->counter, old, new); +} + +#endif /* _TOOLS_LINUX_ASM_X86_ATOMIC_H */ diff --git a/tools/arch/x86/include/asm/barrier.h b/tools/arch/x86/include/asm/barrier.h new file mode 100644 index 000000000..8774dee27 --- /dev/null +++ b/tools/arch/x86/include/asm/barrier.h @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _TOOLS_LINUX_ASM_X86_BARRIER_H +#define _TOOLS_LINUX_ASM_X86_BARRIER_H + +/* + * Copied from the Linux kernel sources, and also moving code + * out from tools/perf/perf-sys.h so as to make it be located + * in a place similar as in the kernel sources. + * + * Force strict CPU ordering. + * And yes, this is required on UP too when we're talking + * to devices. + */ + +#if defined(__i386__) +/* + * Some non-Intel clones support out of order store. wmb() ceases to be a + * nop for these. + */ +#define mb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") +#define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") +#define wmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") +#elif defined(__x86_64__) +#define mb() asm volatile("mfence":::"memory") +#define rmb() asm volatile("lfence":::"memory") +#define wmb() asm volatile("sfence" ::: "memory") +#endif + +#endif /* _TOOLS_LINUX_ASM_X86_BARRIER_H */ diff --git a/tools/arch/x86/include/asm/cmpxchg.h b/tools/arch/x86/include/asm/cmpxchg.h new file mode 100644 index 000000000..0ed9ca276 --- /dev/null +++ b/tools/arch/x86/include/asm/cmpxchg.h @@ -0,0 +1,90 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef TOOLS_ASM_X86_CMPXCHG_H +#define TOOLS_ASM_X86_CMPXCHG_H + +#include + +/* + * Non-existant functions to indicate usage errors at link time + * (or compile-time if the compiler implements __compiletime_error(). + */ +extern void __cmpxchg_wrong_size(void) + __compiletime_error("Bad argument size for cmpxchg"); + +/* + * Constants for operation sizes. On 32-bit, the 64-bit size it set to + * -1 because sizeof will never return -1, thereby making those switch + * case statements guaranteeed dead code which the compiler will + * eliminate, and allowing the "missing symbol in the default case" to + * indicate a usage error. + */ +#define __X86_CASE_B 1 +#define __X86_CASE_W 2 +#define __X86_CASE_L 4 +#ifdef __x86_64__ +#define __X86_CASE_Q 8 +#else +#define __X86_CASE_Q -1 /* sizeof will never return -1 */ +#endif + +/* + * Atomic compare and exchange. Compare OLD with MEM, if identical, + * store NEW in MEM. Return the initial value in MEM. Success is + * indicated by comparing RETURN with OLD. + */ +#define __raw_cmpxchg(ptr, old, new, size, lock) \ +({ \ + __typeof__(*(ptr)) __ret; \ + __typeof__(*(ptr)) __old = (old); \ + __typeof__(*(ptr)) __new = (new); \ + switch (size) { \ + case __X86_CASE_B: \ + { \ + volatile u8 *__ptr = (volatile u8 *)(ptr); \ + asm volatile(lock "cmpxchgb %2,%1" \ + : "=a" (__ret), "+m" (*__ptr) \ + : "q" (__new), "0" (__old) \ + : "memory"); \ + break; \ + } \ + case __X86_CASE_W: \ + { \ + volatile u16 *__ptr = (volatile u16 *)(ptr); \ + asm volatile(lock "cmpxchgw %2,%1" \ + : "=a" (__ret), "+m" (*__ptr) \ + : "r" (__new), "0" (__old) \ + : "memory"); \ + break; \ + } \ + case __X86_CASE_L: \ + { \ + volatile u32 *__ptr = (volatile u32 *)(ptr); \ + asm volatile(lock "cmpxchgl %2,%1" \ + : "=a" (__ret), "+m" (*__ptr) \ + : "r" (__new), "0" (__old) \ + : "memory"); \ + break; \ + } \ + case __X86_CASE_Q: \ + { \ + volatile u64 *__ptr = (volatile u64 *)(ptr); \ + asm volatile(lock "cmpxchgq %2,%1" \ + : "=a" (__ret), "+m" (*__ptr) \ + : "r" (__new), "0" (__old) \ + : "memory"); \ + break; \ + } \ + default: \ + __cmpxchg_wrong_size(); \ + } \ + __ret; \ +}) + +#define __cmpxchg(ptr, old, new, size) \ + __raw_cmpxchg((ptr), (old), (new), (size), LOCK_PREFIX) + +#define cmpxchg(ptr, old, new) \ + __cmpxchg(ptr, old, new, sizeof(*(ptr))) + + +#endif /* TOOLS_ASM_X86_CMPXCHG_H */ diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h new file mode 100644 index 000000000..beab4d4e4 --- /dev/null +++ b/tools/arch/x86/include/asm/cpufeatures.h @@ -0,0 +1,381 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_X86_CPUFEATURES_H +#define _ASM_X86_CPUFEATURES_H + +#ifndef _ASM_X86_REQUIRED_FEATURES_H +#include +#endif + +#ifndef _ASM_X86_DISABLED_FEATURES_H +#include +#endif + +/* + * Defines x86 CPU feature bits + */ +#define NCAPINTS 19 /* N 32-bit words worth of info */ +#define NBUGINTS 1 /* N 32-bit bug flags */ + +/* + * Note: If the comment begins with a quoted string, that string is used + * in /proc/cpuinfo instead of the macro name. If the string is "", + * this feature bit is not displayed in /proc/cpuinfo at all. + * + * When adding new features here that depend on other features, + * please update the table in kernel/cpu/cpuid-deps.c as well. + */ + +/* Intel-defined CPU features, CPUID level 0x00000001 (EDX), word 0 */ +#define X86_FEATURE_FPU ( 0*32+ 0) /* Onboard FPU */ +#define X86_FEATURE_VME ( 0*32+ 1) /* Virtual Mode Extensions */ +#define X86_FEATURE_DE ( 0*32+ 2) /* Debugging Extensions */ +#define X86_FEATURE_PSE ( 0*32+ 3) /* Page Size Extensions */ +#define X86_FEATURE_TSC ( 0*32+ 4) /* Time Stamp Counter */ +#define X86_FEATURE_MSR ( 0*32+ 5) /* Model-Specific Registers */ +#define X86_FEATURE_PAE ( 0*32+ 6) /* Physical Address Extensions */ +#define X86_FEATURE_MCE ( 0*32+ 7) /* Machine Check Exception */ +#define X86_FEATURE_CX8 ( 0*32+ 8) /* CMPXCHG8 instruction */ +#define X86_FEATURE_APIC ( 0*32+ 9) /* Onboard APIC */ +#define X86_FEATURE_SEP ( 0*32+11) /* SYSENTER/SYSEXIT */ +#define X86_FEATURE_MTRR ( 0*32+12) /* Memory Type Range Registers */ +#define X86_FEATURE_PGE ( 0*32+13) /* Page Global Enable */ +#define X86_FEATURE_MCA ( 0*32+14) /* Machine Check Architecture */ +#define X86_FEATURE_CMOV ( 0*32+15) /* CMOV instructions (plus FCMOVcc, FCOMI with FPU) */ +#define X86_FEATURE_PAT ( 0*32+16) /* Page Attribute Table */ +#define X86_FEATURE_PSE36 ( 0*32+17) /* 36-bit PSEs */ +#define X86_FEATURE_PN ( 0*32+18) /* Processor serial number */ +#define X86_FEATURE_CLFLUSH ( 0*32+19) /* CLFLUSH instruction */ +#define X86_FEATURE_DS ( 0*32+21) /* "dts" Debug Store */ +#define X86_FEATURE_ACPI ( 0*32+22) /* ACPI via MSR */ +#define X86_FEATURE_MMX ( 0*32+23) /* Multimedia Extensions */ +#define X86_FEATURE_FXSR ( 0*32+24) /* FXSAVE/FXRSTOR, CR4.OSFXSR */ +#define X86_FEATURE_XMM ( 0*32+25) /* "sse" */ +#define X86_FEATURE_XMM2 ( 0*32+26) /* "sse2" */ +#define X86_FEATURE_SELFSNOOP ( 0*32+27) /* "ss" CPU self snoop */ +#define X86_FEATURE_HT ( 0*32+28) /* Hyper-Threading */ +#define X86_FEATURE_ACC ( 0*32+29) /* "tm" Automatic clock control */ +#define X86_FEATURE_IA64 ( 0*32+30) /* IA-64 processor */ +#define X86_FEATURE_PBE ( 0*32+31) /* Pending Break Enable */ + +/* AMD-defined CPU features, CPUID level 0x80000001, word 1 */ +/* Don't duplicate feature flags which are redundant with Intel! */ +#define X86_FEATURE_SYSCALL ( 1*32+11) /* SYSCALL/SYSRET */ +#define X86_FEATURE_MP ( 1*32+19) /* MP Capable */ +#define X86_FEATURE_NX ( 1*32+20) /* Execute Disable */ +#define X86_FEATURE_MMXEXT ( 1*32+22) /* AMD MMX extensions */ +#define X86_FEATURE_FXSR_OPT ( 1*32+25) /* FXSAVE/FXRSTOR optimizations */ +#define X86_FEATURE_GBPAGES ( 1*32+26) /* "pdpe1gb" GB pages */ +#define X86_FEATURE_RDTSCP ( 1*32+27) /* RDTSCP */ +#define X86_FEATURE_LM ( 1*32+29) /* Long Mode (x86-64, 64-bit support) */ +#define X86_FEATURE_3DNOWEXT ( 1*32+30) /* AMD 3DNow extensions */ +#define X86_FEATURE_3DNOW ( 1*32+31) /* 3DNow */ + +/* Transmeta-defined CPU features, CPUID level 0x80860001, word 2 */ +#define X86_FEATURE_RECOVERY ( 2*32+ 0) /* CPU in recovery mode */ +#define X86_FEATURE_LONGRUN ( 2*32+ 1) /* Longrun power control */ +#define X86_FEATURE_LRTI ( 2*32+ 3) /* LongRun table interface */ + +/* Other features, Linux-defined mapping, word 3 */ +/* This range is used for feature bits which conflict or are synthesized */ +#define X86_FEATURE_CXMMX ( 3*32+ 0) /* Cyrix MMX extensions */ +#define X86_FEATURE_K6_MTRR ( 3*32+ 1) /* AMD K6 nonstandard MTRRs */ +#define X86_FEATURE_CYRIX_ARR ( 3*32+ 2) /* Cyrix ARRs (= MTRRs) */ +#define X86_FEATURE_CENTAUR_MCR ( 3*32+ 3) /* Centaur MCRs (= MTRRs) */ + +/* CPU types for specific tunings: */ +#define X86_FEATURE_K8 ( 3*32+ 4) /* "" Opteron, Athlon64 */ +#define X86_FEATURE_K7 ( 3*32+ 5) /* "" Athlon */ +#define X86_FEATURE_P3 ( 3*32+ 6) /* "" P3 */ +#define X86_FEATURE_P4 ( 3*32+ 7) /* "" P4 */ +#define X86_FEATURE_CONSTANT_TSC ( 3*32+ 8) /* TSC ticks at a constant rate */ +#define X86_FEATURE_UP ( 3*32+ 9) /* SMP kernel running on UP */ +#define X86_FEATURE_ART ( 3*32+10) /* Always running timer (ART) */ +#define X86_FEATURE_ARCH_PERFMON ( 3*32+11) /* Intel Architectural PerfMon */ +#define X86_FEATURE_PEBS ( 3*32+12) /* Precise-Event Based Sampling */ +#define X86_FEATURE_BTS ( 3*32+13) /* Branch Trace Store */ +#define X86_FEATURE_SYSCALL32 ( 3*32+14) /* "" syscall in IA32 userspace */ +#define X86_FEATURE_SYSENTER32 ( 3*32+15) /* "" sysenter in IA32 userspace */ +#define X86_FEATURE_REP_GOOD ( 3*32+16) /* REP microcode works well */ +#define X86_FEATURE_MFENCE_RDTSC ( 3*32+17) /* "" MFENCE synchronizes RDTSC */ +#define X86_FEATURE_LFENCE_RDTSC ( 3*32+18) /* "" LFENCE synchronizes RDTSC */ +#define X86_FEATURE_ACC_POWER ( 3*32+19) /* AMD Accumulated Power Mechanism */ +#define X86_FEATURE_NOPL ( 3*32+20) /* The NOPL (0F 1F) instructions */ +#define X86_FEATURE_ALWAYS ( 3*32+21) /* "" Always-present feature */ +#define X86_FEATURE_XTOPOLOGY ( 3*32+22) /* CPU topology enum extensions */ +#define X86_FEATURE_TSC_RELIABLE ( 3*32+23) /* TSC is known to be reliable */ +#define X86_FEATURE_NONSTOP_TSC ( 3*32+24) /* TSC does not stop in C states */ +#define X86_FEATURE_CPUID ( 3*32+25) /* CPU has CPUID instruction itself */ +#define X86_FEATURE_EXTD_APICID ( 3*32+26) /* Extended APICID (8 bits) */ +#define X86_FEATURE_AMD_DCM ( 3*32+27) /* AMD multi-node processor */ +#define X86_FEATURE_APERFMPERF ( 3*32+28) /* P-State hardware coordination feedback capability (APERF/MPERF MSRs) */ +#define X86_FEATURE_NONSTOP_TSC_S3 ( 3*32+30) /* TSC doesn't stop in S3 state */ +#define X86_FEATURE_TSC_KNOWN_FREQ ( 3*32+31) /* TSC has known frequency */ + +/* Intel-defined CPU features, CPUID level 0x00000001 (ECX), word 4 */ +#define X86_FEATURE_XMM3 ( 4*32+ 0) /* "pni" SSE-3 */ +#define X86_FEATURE_PCLMULQDQ ( 4*32+ 1) /* PCLMULQDQ instruction */ +#define X86_FEATURE_DTES64 ( 4*32+ 2) /* 64-bit Debug Store */ +#define X86_FEATURE_MWAIT ( 4*32+ 3) /* "monitor" MONITOR/MWAIT support */ +#define X86_FEATURE_DSCPL ( 4*32+ 4) /* "ds_cpl" CPL-qualified (filtered) Debug Store */ +#define X86_FEATURE_VMX ( 4*32+ 5) /* Hardware virtualization */ +#define X86_FEATURE_SMX ( 4*32+ 6) /* Safer Mode eXtensions */ +#define X86_FEATURE_EST ( 4*32+ 7) /* Enhanced SpeedStep */ +#define X86_FEATURE_TM2 ( 4*32+ 8) /* Thermal Monitor 2 */ +#define X86_FEATURE_SSSE3 ( 4*32+ 9) /* Supplemental SSE-3 */ +#define X86_FEATURE_CID ( 4*32+10) /* Context ID */ +#define X86_FEATURE_SDBG ( 4*32+11) /* Silicon Debug */ +#define X86_FEATURE_FMA ( 4*32+12) /* Fused multiply-add */ +#define X86_FEATURE_CX16 ( 4*32+13) /* CMPXCHG16B instruction */ +#define X86_FEATURE_XTPR ( 4*32+14) /* Send Task Priority Messages */ +#define X86_FEATURE_PDCM ( 4*32+15) /* Perf/Debug Capabilities MSR */ +#define X86_FEATURE_PCID ( 4*32+17) /* Process Context Identifiers */ +#define X86_FEATURE_DCA ( 4*32+18) /* Direct Cache Access */ +#define X86_FEATURE_XMM4_1 ( 4*32+19) /* "sse4_1" SSE-4.1 */ +#define X86_FEATURE_XMM4_2 ( 4*32+20) /* "sse4_2" SSE-4.2 */ +#define X86_FEATURE_X2APIC ( 4*32+21) /* X2APIC */ +#define X86_FEATURE_MOVBE ( 4*32+22) /* MOVBE instruction */ +#define X86_FEATURE_POPCNT ( 4*32+23) /* POPCNT instruction */ +#define X86_FEATURE_TSC_DEADLINE_TIMER ( 4*32+24) /* TSC deadline timer */ +#define X86_FEATURE_AES ( 4*32+25) /* AES instructions */ +#define X86_FEATURE_XSAVE ( 4*32+26) /* XSAVE/XRSTOR/XSETBV/XGETBV instructions */ +#define X86_FEATURE_OSXSAVE ( 4*32+27) /* "" XSAVE instruction enabled in the OS */ +#define X86_FEATURE_AVX ( 4*32+28) /* Advanced Vector Extensions */ +#define X86_FEATURE_F16C ( 4*32+29) /* 16-bit FP conversions */ +#define X86_FEATURE_RDRAND ( 4*32+30) /* RDRAND instruction */ +#define X86_FEATURE_HYPERVISOR ( 4*32+31) /* Running on a hypervisor */ + +/* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */ +#define X86_FEATURE_XSTORE ( 5*32+ 2) /* "rng" RNG present (xstore) */ +#define X86_FEATURE_XSTORE_EN ( 5*32+ 3) /* "rng_en" RNG enabled */ +#define X86_FEATURE_XCRYPT ( 5*32+ 6) /* "ace" on-CPU crypto (xcrypt) */ +#define X86_FEATURE_XCRYPT_EN ( 5*32+ 7) /* "ace_en" on-CPU crypto enabled */ +#define X86_FEATURE_ACE2 ( 5*32+ 8) /* Advanced Cryptography Engine v2 */ +#define X86_FEATURE_ACE2_EN ( 5*32+ 9) /* ACE v2 enabled */ +#define X86_FEATURE_PHE ( 5*32+10) /* PadLock Hash Engine */ +#define X86_FEATURE_PHE_EN ( 5*32+11) /* PHE enabled */ +#define X86_FEATURE_PMM ( 5*32+12) /* PadLock Montgomery Multiplier */ +#define X86_FEATURE_PMM_EN ( 5*32+13) /* PMM enabled */ + +/* More extended AMD flags: CPUID level 0x80000001, ECX, word 6 */ +#define X86_FEATURE_LAHF_LM ( 6*32+ 0) /* LAHF/SAHF in long mode */ +#define X86_FEATURE_CMP_LEGACY ( 6*32+ 1) /* If yes HyperThreading not valid */ +#define X86_FEATURE_SVM ( 6*32+ 2) /* Secure Virtual Machine */ +#define X86_FEATURE_EXTAPIC ( 6*32+ 3) /* Extended APIC space */ +#define X86_FEATURE_CR8_LEGACY ( 6*32+ 4) /* CR8 in 32-bit mode */ +#define X86_FEATURE_ABM ( 6*32+ 5) /* Advanced bit manipulation */ +#define X86_FEATURE_SSE4A ( 6*32+ 6) /* SSE-4A */ +#define X86_FEATURE_MISALIGNSSE ( 6*32+ 7) /* Misaligned SSE mode */ +#define X86_FEATURE_3DNOWPREFETCH ( 6*32+ 8) /* 3DNow prefetch instructions */ +#define X86_FEATURE_OSVW ( 6*32+ 9) /* OS Visible Workaround */ +#define X86_FEATURE_IBS ( 6*32+10) /* Instruction Based Sampling */ +#define X86_FEATURE_XOP ( 6*32+11) /* extended AVX instructions */ +#define X86_FEATURE_SKINIT ( 6*32+12) /* SKINIT/STGI instructions */ +#define X86_FEATURE_WDT ( 6*32+13) /* Watchdog timer */ +#define X86_FEATURE_LWP ( 6*32+15) /* Light Weight Profiling */ +#define X86_FEATURE_FMA4 ( 6*32+16) /* 4 operands MAC instructions */ +#define X86_FEATURE_TCE ( 6*32+17) /* Translation Cache Extension */ +#define X86_FEATURE_NODEID_MSR ( 6*32+19) /* NodeId MSR */ +#define X86_FEATURE_TBM ( 6*32+21) /* Trailing Bit Manipulations */ +#define X86_FEATURE_TOPOEXT ( 6*32+22) /* Topology extensions CPUID leafs */ +#define X86_FEATURE_PERFCTR_CORE ( 6*32+23) /* Core performance counter extensions */ +#define X86_FEATURE_PERFCTR_NB ( 6*32+24) /* NB performance counter extensions */ +#define X86_FEATURE_BPEXT ( 6*32+26) /* Data breakpoint extension */ +#define X86_FEATURE_PTSC ( 6*32+27) /* Performance time-stamp counter */ +#define X86_FEATURE_PERFCTR_LLC ( 6*32+28) /* Last Level Cache performance counter extensions */ +#define X86_FEATURE_MWAITX ( 6*32+29) /* MWAIT extension (MONITORX/MWAITX instructions) */ + +/* + * Auxiliary flags: Linux defined - For features scattered in various + * CPUID levels like 0x6, 0xA etc, word 7. + * + * Reuse free bits when adding new feature flags! + */ +#define X86_FEATURE_RING3MWAIT ( 7*32+ 0) /* Ring 3 MONITOR/MWAIT instructions */ +#define X86_FEATURE_CPUID_FAULT ( 7*32+ 1) /* Intel CPUID faulting */ +#define X86_FEATURE_CPB ( 7*32+ 2) /* AMD Core Performance Boost */ +#define X86_FEATURE_EPB ( 7*32+ 3) /* IA32_ENERGY_PERF_BIAS support */ +#define X86_FEATURE_CAT_L3 ( 7*32+ 4) /* Cache Allocation Technology L3 */ +#define X86_FEATURE_CAT_L2 ( 7*32+ 5) /* Cache Allocation Technology L2 */ +#define X86_FEATURE_CDP_L3 ( 7*32+ 6) /* Code and Data Prioritization L3 */ +#define X86_FEATURE_INVPCID_SINGLE ( 7*32+ 7) /* Effectively INVPCID && CR4.PCIDE=1 */ +#define X86_FEATURE_HW_PSTATE ( 7*32+ 8) /* AMD HW-PState */ +#define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */ +#define X86_FEATURE_SME ( 7*32+10) /* AMD Secure Memory Encryption */ +#define X86_FEATURE_PTI ( 7*32+11) /* Kernel Page Table Isolation enabled */ +#define X86_FEATURE_RETPOLINE ( 7*32+12) /* "" Generic Retpoline mitigation for Spectre variant 2 */ +#define X86_FEATURE_RETPOLINE_LFENCE ( 7*32+13) /* "" Use LFENCEs for Spectre variant 2 */ +#define X86_FEATURE_INTEL_PPIN ( 7*32+14) /* Intel Processor Inventory Number */ +#define X86_FEATURE_CDP_L2 ( 7*32+15) /* Code and Data Prioritization L2 */ +#define X86_FEATURE_MSR_SPEC_CTRL ( 7*32+16) /* "" MSR SPEC_CTRL is implemented */ +#define X86_FEATURE_SSBD ( 7*32+17) /* Speculative Store Bypass Disable */ +#define X86_FEATURE_MBA ( 7*32+18) /* Memory Bandwidth Allocation */ +#define X86_FEATURE_RSB_CTXSW ( 7*32+19) /* "" Fill RSB on context switches */ +#define X86_FEATURE_SEV ( 7*32+20) /* AMD Secure Encrypted Virtualization */ +#define X86_FEATURE_USE_IBPB ( 7*32+21) /* "" Indirect Branch Prediction Barrier enabled */ +#define X86_FEATURE_USE_IBRS_FW ( 7*32+22) /* "" Use IBRS during runtime firmware calls */ +#define X86_FEATURE_SPEC_STORE_BYPASS_DISABLE ( 7*32+23) /* "" Disable Speculative Store Bypass. */ +#define X86_FEATURE_LS_CFG_SSBD ( 7*32+24) /* "" AMD SSBD implementation via LS_CFG MSR */ +#define X86_FEATURE_IBRS ( 7*32+25) /* Indirect Branch Restricted Speculation */ +#define X86_FEATURE_IBPB ( 7*32+26) /* Indirect Branch Prediction Barrier */ +#define X86_FEATURE_STIBP ( 7*32+27) /* Single Thread Indirect Branch Predictors */ +#define X86_FEATURE_ZEN ( 7*32+28) /* "" CPU is AMD family 0x17 (Zen) */ +#define X86_FEATURE_L1TF_PTEINV ( 7*32+29) /* "" L1TF workaround PTE inversion */ +#define X86_FEATURE_IBRS_ENHANCED ( 7*32+30) /* Enhanced IBRS */ + +/* Virtualization flags: Linux defined, word 8 */ +#define X86_FEATURE_TPR_SHADOW ( 8*32+ 0) /* Intel TPR Shadow */ +#define X86_FEATURE_VNMI ( 8*32+ 1) /* Intel Virtual NMI */ +#define X86_FEATURE_FLEXPRIORITY ( 8*32+ 2) /* Intel FlexPriority */ +#define X86_FEATURE_EPT ( 8*32+ 3) /* Intel Extended Page Table */ +#define X86_FEATURE_VPID ( 8*32+ 4) /* Intel Virtual Processor ID */ + +#define X86_FEATURE_VMMCALL ( 8*32+15) /* Prefer VMMCALL to VMCALL */ +#define X86_FEATURE_XENPV ( 8*32+16) /* "" Xen paravirtual guest */ +#define X86_FEATURE_EPT_AD ( 8*32+17) /* Intel Extended Page Table access-dirty bit */ + +/* Intel-defined CPU features, CPUID level 0x00000007:0 (EBX), word 9 */ +#define X86_FEATURE_FSGSBASE ( 9*32+ 0) /* RDFSBASE, WRFSBASE, RDGSBASE, WRGSBASE instructions*/ +#define X86_FEATURE_TSC_ADJUST ( 9*32+ 1) /* TSC adjustment MSR 0x3B */ +#define X86_FEATURE_BMI1 ( 9*32+ 3) /* 1st group bit manipulation extensions */ +#define X86_FEATURE_HLE ( 9*32+ 4) /* Hardware Lock Elision */ +#define X86_FEATURE_AVX2 ( 9*32+ 5) /* AVX2 instructions */ +#define X86_FEATURE_SMEP ( 9*32+ 7) /* Supervisor Mode Execution Protection */ +#define X86_FEATURE_BMI2 ( 9*32+ 8) /* 2nd group bit manipulation extensions */ +#define X86_FEATURE_ERMS ( 9*32+ 9) /* Enhanced REP MOVSB/STOSB instructions */ +#define X86_FEATURE_INVPCID ( 9*32+10) /* Invalidate Processor Context ID */ +#define X86_FEATURE_RTM ( 9*32+11) /* Restricted Transactional Memory */ +#define X86_FEATURE_CQM ( 9*32+12) /* Cache QoS Monitoring */ +#define X86_FEATURE_MPX ( 9*32+14) /* Memory Protection Extension */ +#define X86_FEATURE_RDT_A ( 9*32+15) /* Resource Director Technology Allocation */ +#define X86_FEATURE_AVX512F ( 9*32+16) /* AVX-512 Foundation */ +#define X86_FEATURE_AVX512DQ ( 9*32+17) /* AVX-512 DQ (Double/Quad granular) Instructions */ +#define X86_FEATURE_RDSEED ( 9*32+18) /* RDSEED instruction */ +#define X86_FEATURE_ADX ( 9*32+19) /* ADCX and ADOX instructions */ +#define X86_FEATURE_SMAP ( 9*32+20) /* Supervisor Mode Access Prevention */ +#define X86_FEATURE_AVX512IFMA ( 9*32+21) /* AVX-512 Integer Fused Multiply-Add instructions */ +#define X86_FEATURE_CLFLUSHOPT ( 9*32+23) /* CLFLUSHOPT instruction */ +#define X86_FEATURE_CLWB ( 9*32+24) /* CLWB instruction */ +#define X86_FEATURE_INTEL_PT ( 9*32+25) /* Intel Processor Trace */ +#define X86_FEATURE_AVX512PF ( 9*32+26) /* AVX-512 Prefetch */ +#define X86_FEATURE_AVX512ER ( 9*32+27) /* AVX-512 Exponential and Reciprocal */ +#define X86_FEATURE_AVX512CD ( 9*32+28) /* AVX-512 Conflict Detection */ +#define X86_FEATURE_SHA_NI ( 9*32+29) /* SHA1/SHA256 Instruction Extensions */ +#define X86_FEATURE_AVX512BW ( 9*32+30) /* AVX-512 BW (Byte/Word granular) Instructions */ +#define X86_FEATURE_AVX512VL ( 9*32+31) /* AVX-512 VL (128/256 Vector Length) Extensions */ + +/* Extended state features, CPUID level 0x0000000d:1 (EAX), word 10 */ +#define X86_FEATURE_XSAVEOPT (10*32+ 0) /* XSAVEOPT instruction */ +#define X86_FEATURE_XSAVEC (10*32+ 1) /* XSAVEC instruction */ +#define X86_FEATURE_XGETBV1 (10*32+ 2) /* XGETBV with ECX = 1 instruction */ +#define X86_FEATURE_XSAVES (10*32+ 3) /* XSAVES/XRSTORS instructions */ + +/* Intel-defined CPU QoS Sub-leaf, CPUID level 0x0000000F:0 (EDX), word 11 */ +#define X86_FEATURE_CQM_LLC (11*32+ 1) /* LLC QoS if 1 */ + +/* Intel-defined CPU QoS Sub-leaf, CPUID level 0x0000000F:1 (EDX), word 12 */ +#define X86_FEATURE_CQM_OCCUP_LLC (12*32+ 0) /* LLC occupancy monitoring */ +#define X86_FEATURE_CQM_MBM_TOTAL (12*32+ 1) /* LLC Total MBM monitoring */ +#define X86_FEATURE_CQM_MBM_LOCAL (12*32+ 2) /* LLC Local MBM monitoring */ + +/* AMD-defined CPU features, CPUID level 0x80000008 (EBX), word 13 */ +#define X86_FEATURE_CLZERO (13*32+ 0) /* CLZERO instruction */ +#define X86_FEATURE_IRPERF (13*32+ 1) /* Instructions Retired Count */ +#define X86_FEATURE_XSAVEERPTR (13*32+ 2) /* Always save/restore FP error pointers */ +#define X86_FEATURE_AMD_IBPB (13*32+12) /* "" Indirect Branch Prediction Barrier */ +#define X86_FEATURE_AMD_IBRS (13*32+14) /* "" Indirect Branch Restricted Speculation */ +#define X86_FEATURE_AMD_STIBP (13*32+15) /* "" Single Thread Indirect Branch Predictors */ +#define X86_FEATURE_AMD_SSBD (13*32+24) /* "" Speculative Store Bypass Disable */ +#define X86_FEATURE_VIRT_SSBD (13*32+25) /* Virtualized Speculative Store Bypass Disable */ +#define X86_FEATURE_AMD_SSB_NO (13*32+26) /* "" Speculative Store Bypass is fixed in hardware. */ + +/* Thermal and Power Management Leaf, CPUID level 0x00000006 (EAX), word 14 */ +#define X86_FEATURE_DTHERM (14*32+ 0) /* Digital Thermal Sensor */ +#define X86_FEATURE_IDA (14*32+ 1) /* Intel Dynamic Acceleration */ +#define X86_FEATURE_ARAT (14*32+ 2) /* Always Running APIC Timer */ +#define X86_FEATURE_PLN (14*32+ 4) /* Intel Power Limit Notification */ +#define X86_FEATURE_PTS (14*32+ 6) /* Intel Package Thermal Status */ +#define X86_FEATURE_HWP (14*32+ 7) /* Intel Hardware P-states */ +#define X86_FEATURE_HWP_NOTIFY (14*32+ 8) /* HWP Notification */ +#define X86_FEATURE_HWP_ACT_WINDOW (14*32+ 9) /* HWP Activity Window */ +#define X86_FEATURE_HWP_EPP (14*32+10) /* HWP Energy Perf. Preference */ +#define X86_FEATURE_HWP_PKG_REQ (14*32+11) /* HWP Package Level Request */ + +/* AMD SVM Feature Identification, CPUID level 0x8000000a (EDX), word 15 */ +#define X86_FEATURE_NPT (15*32+ 0) /* Nested Page Table support */ +#define X86_FEATURE_LBRV (15*32+ 1) /* LBR Virtualization support */ +#define X86_FEATURE_SVML (15*32+ 2) /* "svm_lock" SVM locking MSR */ +#define X86_FEATURE_NRIPS (15*32+ 3) /* "nrip_save" SVM next_rip save */ +#define X86_FEATURE_TSCRATEMSR (15*32+ 4) /* "tsc_scale" TSC scaling support */ +#define X86_FEATURE_VMCBCLEAN (15*32+ 5) /* "vmcb_clean" VMCB clean bits support */ +#define X86_FEATURE_FLUSHBYASID (15*32+ 6) /* flush-by-ASID support */ +#define X86_FEATURE_DECODEASSISTS (15*32+ 7) /* Decode Assists support */ +#define X86_FEATURE_PAUSEFILTER (15*32+10) /* filtered pause intercept */ +#define X86_FEATURE_PFTHRESHOLD (15*32+12) /* pause filter threshold */ +#define X86_FEATURE_AVIC (15*32+13) /* Virtual Interrupt Controller */ +#define X86_FEATURE_V_VMSAVE_VMLOAD (15*32+15) /* Virtual VMSAVE VMLOAD */ +#define X86_FEATURE_VGIF (15*32+16) /* Virtual GIF */ + +/* Intel-defined CPU features, CPUID level 0x00000007:0 (ECX), word 16 */ +#define X86_FEATURE_AVX512VBMI (16*32+ 1) /* AVX512 Vector Bit Manipulation instructions*/ +#define X86_FEATURE_UMIP (16*32+ 2) /* User Mode Instruction Protection */ +#define X86_FEATURE_PKU (16*32+ 3) /* Protection Keys for Userspace */ +#define X86_FEATURE_OSPKE (16*32+ 4) /* OS Protection Keys Enable */ +#define X86_FEATURE_AVX512_VBMI2 (16*32+ 6) /* Additional AVX512 Vector Bit Manipulation Instructions */ +#define X86_FEATURE_GFNI (16*32+ 8) /* Galois Field New Instructions */ +#define X86_FEATURE_VAES (16*32+ 9) /* Vector AES */ +#define X86_FEATURE_VPCLMULQDQ (16*32+10) /* Carry-Less Multiplication Double Quadword */ +#define X86_FEATURE_AVX512_VNNI (16*32+11) /* Vector Neural Network Instructions */ +#define X86_FEATURE_AVX512_BITALG (16*32+12) /* Support for VPOPCNT[B,W] and VPSHUF-BITQMB instructions */ +#define X86_FEATURE_TME (16*32+13) /* Intel Total Memory Encryption */ +#define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14) /* POPCNT for vectors of DW/QW */ +#define X86_FEATURE_LA57 (16*32+16) /* 5-level page tables */ +#define X86_FEATURE_RDPID (16*32+22) /* RDPID instruction */ +#define X86_FEATURE_CLDEMOTE (16*32+25) /* CLDEMOTE instruction */ + +/* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */ +#define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0) /* MCA overflow recovery support */ +#define X86_FEATURE_SUCCOR (17*32+ 1) /* Uncorrectable error containment and recovery */ +#define X86_FEATURE_SMCA (17*32+ 3) /* Scalable MCA */ + +/* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */ +#define X86_FEATURE_AVX512_4VNNIW (18*32+ 2) /* AVX-512 Neural Network Instructions */ +#define X86_FEATURE_AVX512_4FMAPS (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */ +#define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */ +#define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */ +#define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */ +#define X86_FEATURE_FLUSH_L1D (18*32+28) /* Flush L1D cache */ +#define X86_FEATURE_ARCH_CAPABILITIES (18*32+29) /* IA32_ARCH_CAPABILITIES MSR (Intel) */ +#define X86_FEATURE_SPEC_CTRL_SSBD (18*32+31) /* "" Speculative Store Bypass Disable */ + +/* + * BUG word(s) + */ +#define X86_BUG(x) (NCAPINTS*32 + (x)) + +#define X86_BUG_F00F X86_BUG(0) /* Intel F00F */ +#define X86_BUG_FDIV X86_BUG(1) /* FPU FDIV */ +#define X86_BUG_COMA X86_BUG(2) /* Cyrix 6x86 coma */ +#define X86_BUG_AMD_TLB_MMATCH X86_BUG(3) /* "tlb_mmatch" AMD Erratum 383 */ +#define X86_BUG_AMD_APIC_C1E X86_BUG(4) /* "apic_c1e" AMD Erratum 400 */ +#define X86_BUG_11AP X86_BUG(5) /* Bad local APIC aka 11AP */ +#define X86_BUG_FXSAVE_LEAK X86_BUG(6) /* FXSAVE leaks FOP/FIP/FOP */ +#define X86_BUG_CLFLUSH_MONITOR X86_BUG(7) /* AAI65, CLFLUSH required before MONITOR */ +#define X86_BUG_SYSRET_SS_ATTRS X86_BUG(8) /* SYSRET doesn't fix up SS attrs */ +#ifdef CONFIG_X86_32 +/* + * 64-bit kernels don't use X86_BUG_ESPFIX. Make the define conditional + * to avoid confusion. + */ +#define X86_BUG_ESPFIX X86_BUG(9) /* "" IRET to 16-bit SS corrupts ESP/RSP high bits */ +#endif +#define X86_BUG_NULL_SEG X86_BUG(10) /* Nulling a selector preserves the base */ +#define X86_BUG_SWAPGS_FENCE X86_BUG(11) /* SWAPGS without input dep on GS */ +#define X86_BUG_MONITOR X86_BUG(12) /* IPI required to wake up remote CPU */ +#define X86_BUG_AMD_E400 X86_BUG(13) /* CPU is among the affected by Erratum 400 */ +#define X86_BUG_CPU_MELTDOWN X86_BUG(14) /* CPU is affected by meltdown attack and needs kernel page table isolation */ +#define X86_BUG_SPECTRE_V1 X86_BUG(15) /* CPU is affected by Spectre variant 1 attack with conditional branches */ +#define X86_BUG_SPECTRE_V2 X86_BUG(16) /* CPU is affected by Spectre variant 2 attack with indirect branches */ +#define X86_BUG_SPEC_STORE_BYPASS X86_BUG(17) /* CPU is affected by speculative store bypass attack */ +#define X86_BUG_L1TF X86_BUG(18) /* CPU is affected by L1 Terminal Fault */ + +#endif /* _ASM_X86_CPUFEATURES_H */ diff --git a/tools/arch/x86/include/asm/disabled-features.h b/tools/arch/x86/include/asm/disabled-features.h new file mode 100644 index 000000000..33833d190 --- /dev/null +++ b/tools/arch/x86/include/asm/disabled-features.h @@ -0,0 +1,83 @@ +#ifndef _ASM_X86_DISABLED_FEATURES_H +#define _ASM_X86_DISABLED_FEATURES_H + +/* These features, although they might be available in a CPU + * will not be used because the compile options to support + * them are not present. + * + * This code allows them to be checked and disabled at + * compile time without an explicit #ifdef. Use + * cpu_feature_enabled(). + */ + +#ifdef CONFIG_X86_INTEL_MPX +# define DISABLE_MPX 0 +#else +# define DISABLE_MPX (1<<(X86_FEATURE_MPX & 31)) +#endif + +#ifdef CONFIG_X86_INTEL_UMIP +# define DISABLE_UMIP 0 +#else +# define DISABLE_UMIP (1<<(X86_FEATURE_UMIP & 31)) +#endif + +#ifdef CONFIG_X86_64 +# define DISABLE_VME (1<<(X86_FEATURE_VME & 31)) +# define DISABLE_K6_MTRR (1<<(X86_FEATURE_K6_MTRR & 31)) +# define DISABLE_CYRIX_ARR (1<<(X86_FEATURE_CYRIX_ARR & 31)) +# define DISABLE_CENTAUR_MCR (1<<(X86_FEATURE_CENTAUR_MCR & 31)) +# define DISABLE_PCID 0 +#else +# define DISABLE_VME 0 +# define DISABLE_K6_MTRR 0 +# define DISABLE_CYRIX_ARR 0 +# define DISABLE_CENTAUR_MCR 0 +# define DISABLE_PCID (1<<(X86_FEATURE_PCID & 31)) +#endif /* CONFIG_X86_64 */ + +#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS +# define DISABLE_PKU 0 +# define DISABLE_OSPKE 0 +#else +# define DISABLE_PKU (1<<(X86_FEATURE_PKU & 31)) +# define DISABLE_OSPKE (1<<(X86_FEATURE_OSPKE & 31)) +#endif /* CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS */ + +#ifdef CONFIG_X86_5LEVEL +# define DISABLE_LA57 0 +#else +# define DISABLE_LA57 (1<<(X86_FEATURE_LA57 & 31)) +#endif + +#ifdef CONFIG_PAGE_TABLE_ISOLATION +# define DISABLE_PTI 0 +#else +# define DISABLE_PTI (1 << (X86_FEATURE_PTI & 31)) +#endif + +/* + * Make sure to add features to the correct mask + */ +#define DISABLED_MASK0 (DISABLE_VME) +#define DISABLED_MASK1 0 +#define DISABLED_MASK2 0 +#define DISABLED_MASK3 (DISABLE_CYRIX_ARR|DISABLE_CENTAUR_MCR|DISABLE_K6_MTRR) +#define DISABLED_MASK4 (DISABLE_PCID) +#define DISABLED_MASK5 0 +#define DISABLED_MASK6 0 +#define DISABLED_MASK7 (DISABLE_PTI) +#define DISABLED_MASK8 0 +#define DISABLED_MASK9 (DISABLE_MPX) +#define DISABLED_MASK10 0 +#define DISABLED_MASK11 0 +#define DISABLED_MASK12 0 +#define DISABLED_MASK13 0 +#define DISABLED_MASK14 0 +#define DISABLED_MASK15 0 +#define DISABLED_MASK16 (DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57|DISABLE_UMIP) +#define DISABLED_MASK17 0 +#define DISABLED_MASK18 0 +#define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 19) + +#endif /* _ASM_X86_DISABLED_FEATURES_H */ diff --git a/tools/arch/x86/include/asm/mcsafe_test.h b/tools/arch/x86/include/asm/mcsafe_test.h new file mode 100644 index 000000000..2ccd588fb --- /dev/null +++ b/tools/arch/x86/include/asm/mcsafe_test.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _MCSAFE_TEST_H_ +#define _MCSAFE_TEST_H_ + +.macro MCSAFE_TEST_CTL +.endm + +.macro MCSAFE_TEST_SRC reg count target +.endm + +.macro MCSAFE_TEST_DST reg count target +.endm +#endif /* _MCSAFE_TEST_H_ */ diff --git a/tools/arch/x86/include/asm/required-features.h b/tools/arch/x86/include/asm/required-features.h new file mode 100644 index 000000000..6847d8540 --- /dev/null +++ b/tools/arch/x86/include/asm/required-features.h @@ -0,0 +1,106 @@ +#ifndef _ASM_X86_REQUIRED_FEATURES_H +#define _ASM_X86_REQUIRED_FEATURES_H + +/* Define minimum CPUID feature set for kernel These bits are checked + really early to actually display a visible error message before the + kernel dies. Make sure to assign features to the proper mask! + + Some requirements that are not in CPUID yet are also in the + CONFIG_X86_MINIMUM_CPU_FAMILY which is checked too. + + The real information is in arch/x86/Kconfig.cpu, this just converts + the CONFIGs into a bitmask */ + +#ifndef CONFIG_MATH_EMULATION +# define NEED_FPU (1<<(X86_FEATURE_FPU & 31)) +#else +# define NEED_FPU 0 +#endif + +#if defined(CONFIG_X86_PAE) || defined(CONFIG_X86_64) +# define NEED_PAE (1<<(X86_FEATURE_PAE & 31)) +#else +# define NEED_PAE 0 +#endif + +#ifdef CONFIG_X86_CMPXCHG64 +# define NEED_CX8 (1<<(X86_FEATURE_CX8 & 31)) +#else +# define NEED_CX8 0 +#endif + +#if defined(CONFIG_X86_CMOV) || defined(CONFIG_X86_64) +# define NEED_CMOV (1<<(X86_FEATURE_CMOV & 31)) +#else +# define NEED_CMOV 0 +#endif + +#ifdef CONFIG_X86_USE_3DNOW +# define NEED_3DNOW (1<<(X86_FEATURE_3DNOW & 31)) +#else +# define NEED_3DNOW 0 +#endif + +#if defined(CONFIG_X86_P6_NOP) || defined(CONFIG_X86_64) +# define NEED_NOPL (1<<(X86_FEATURE_NOPL & 31)) +#else +# define NEED_NOPL 0 +#endif + +#ifdef CONFIG_MATOM +# define NEED_MOVBE (1<<(X86_FEATURE_MOVBE & 31)) +#else +# define NEED_MOVBE 0 +#endif + +#ifdef CONFIG_X86_64 +#ifdef CONFIG_PARAVIRT +/* Paravirtualized systems may not have PSE or PGE available */ +#define NEED_PSE 0 +#define NEED_PGE 0 +#else +#define NEED_PSE (1<<(X86_FEATURE_PSE) & 31) +#define NEED_PGE (1<<(X86_FEATURE_PGE) & 31) +#endif +#define NEED_MSR (1<<(X86_FEATURE_MSR & 31)) +#define NEED_FXSR (1<<(X86_FEATURE_FXSR & 31)) +#define NEED_XMM (1<<(X86_FEATURE_XMM & 31)) +#define NEED_XMM2 (1<<(X86_FEATURE_XMM2 & 31)) +#define NEED_LM (1<<(X86_FEATURE_LM & 31)) +#else +#define NEED_PSE 0 +#define NEED_MSR 0 +#define NEED_PGE 0 +#define NEED_FXSR 0 +#define NEED_XMM 0 +#define NEED_XMM2 0 +#define NEED_LM 0 +#endif + +#define REQUIRED_MASK0 (NEED_FPU|NEED_PSE|NEED_MSR|NEED_PAE|\ + NEED_CX8|NEED_PGE|NEED_FXSR|NEED_CMOV|\ + NEED_XMM|NEED_XMM2) +#define SSE_MASK (NEED_XMM|NEED_XMM2) + +#define REQUIRED_MASK1 (NEED_LM|NEED_3DNOW) + +#define REQUIRED_MASK2 0 +#define REQUIRED_MASK3 (NEED_NOPL) +#define REQUIRED_MASK4 (NEED_MOVBE) +#define REQUIRED_MASK5 0 +#define REQUIRED_MASK6 0 +#define REQUIRED_MASK7 0 +#define REQUIRED_MASK8 0 +#define REQUIRED_MASK9 0 +#define REQUIRED_MASK10 0 +#define REQUIRED_MASK11 0 +#define REQUIRED_MASK12 0 +#define REQUIRED_MASK13 0 +#define REQUIRED_MASK14 0 +#define REQUIRED_MASK15 0 +#define REQUIRED_MASK16 0 +#define REQUIRED_MASK17 0 +#define REQUIRED_MASK18 0 +#define REQUIRED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 19) + +#endif /* _ASM_X86_REQUIRED_FEATURES_H */ diff --git a/tools/arch/x86/include/asm/rmwcc.h b/tools/arch/x86/include/asm/rmwcc.h new file mode 100644 index 000000000..fee7983a9 --- /dev/null +++ b/tools/arch/x86/include/asm/rmwcc.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _TOOLS_LINUX_ASM_X86_RMWcc +#define _TOOLS_LINUX_ASM_X86_RMWcc + +#ifdef CONFIG_CC_HAS_ASM_GOTO + +#define __GEN_RMWcc(fullop, var, cc, ...) \ +do { \ + asm_volatile_goto (fullop "; j" cc " %l[cc_label]" \ + : : "m" (var), ## __VA_ARGS__ \ + : "memory" : cc_label); \ + return 0; \ +cc_label: \ + return 1; \ +} while (0) + +#define GEN_UNARY_RMWcc(op, var, arg0, cc) \ + __GEN_RMWcc(op " " arg0, var, cc) + +#define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \ + __GEN_RMWcc(op " %1, " arg0, var, cc, vcon (val)) + +#else /* !CONFIG_CC_HAS_ASM_GOTO */ + +#define __GEN_RMWcc(fullop, var, cc, ...) \ +do { \ + char c; \ + asm volatile (fullop "; set" cc " %1" \ + : "+m" (var), "=qm" (c) \ + : __VA_ARGS__ : "memory"); \ + return c != 0; \ +} while (0) + +#define GEN_UNARY_RMWcc(op, var, arg0, cc) \ + __GEN_RMWcc(op " " arg0, var, cc) + +#define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \ + __GEN_RMWcc(op " %2, " arg0, var, cc, vcon (val)) + +#endif /* CONFIG_CC_HAS_ASM_GOTO */ + +#endif /* _TOOLS_LINUX_ASM_X86_RMWcc */ diff --git a/tools/arch/x86/include/asm/unistd_32.h b/tools/arch/x86/include/asm/unistd_32.h new file mode 100644 index 000000000..60a89dba0 --- /dev/null +++ b/tools/arch/x86/include/asm/unistd_32.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __NR_perf_event_open +# define __NR_perf_event_open 336 +#endif +#ifndef __NR_futex +# define __NR_futex 240 +#endif +#ifndef __NR_gettid +# define __NR_gettid 224 +#endif +#ifndef __NR_getcpu +# define __NR_getcpu 318 +#endif +#ifndef __NR_setns +# define __NR_setns 346 +#endif diff --git a/tools/arch/x86/include/asm/unistd_64.h b/tools/arch/x86/include/asm/unistd_64.h new file mode 100644 index 000000000..cb52a3a8b --- /dev/null +++ b/tools/arch/x86/include/asm/unistd_64.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __NR_perf_event_open +# define __NR_perf_event_open 298 +#endif +#ifndef __NR_futex +# define __NR_futex 202 +#endif +#ifndef __NR_gettid +# define __NR_gettid 186 +#endif +#ifndef __NR_getcpu +# define __NR_getcpu 309 +#endif +#ifndef __NR_setns +#define __NR_setns 308 +#endif diff --git a/tools/arch/x86/include/uapi/asm/bitsperlong.h b/tools/arch/x86/include/uapi/asm/bitsperlong.h new file mode 100644 index 000000000..f8a92e000 --- /dev/null +++ b/tools/arch/x86/include/uapi/asm/bitsperlong.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_X86_BITSPERLONG_H +#define __ASM_X86_BITSPERLONG_H + +#if defined(__x86_64__) && !defined(__ILP32__) +# define __BITS_PER_LONG 64 +#else +# define __BITS_PER_LONG 32 +#endif + +#include + +#endif /* __ASM_X86_BITSPERLONG_H */ diff --git a/tools/arch/x86/include/uapi/asm/errno.h b/tools/arch/x86/include/uapi/asm/errno.h new file mode 100644 index 000000000..4c82b503d --- /dev/null +++ b/tools/arch/x86/include/uapi/asm/errno.h @@ -0,0 +1 @@ +#include diff --git a/tools/arch/x86/include/uapi/asm/kvm.h b/tools/arch/x86/include/uapi/asm/kvm.h new file mode 100644 index 000000000..fd23d5778 --- /dev/null +++ b/tools/arch/x86/include/uapi/asm/kvm.h @@ -0,0 +1,419 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _ASM_X86_KVM_H +#define _ASM_X86_KVM_H + +/* + * KVM x86 specific structures and definitions + * + */ + +#include +#include + +#define KVM_PIO_PAGE_OFFSET 1 +#define KVM_COALESCED_MMIO_PAGE_OFFSET 2 + +#define DE_VECTOR 0 +#define DB_VECTOR 1 +#define BP_VECTOR 3 +#define OF_VECTOR 4 +#define BR_VECTOR 5 +#define UD_VECTOR 6 +#define NM_VECTOR 7 +#define DF_VECTOR 8 +#define TS_VECTOR 10 +#define NP_VECTOR 11 +#define SS_VECTOR 12 +#define GP_VECTOR 13 +#define PF_VECTOR 14 +#define MF_VECTOR 16 +#define AC_VECTOR 17 +#define MC_VECTOR 18 +#define XM_VECTOR 19 +#define VE_VECTOR 20 + +/* Select x86 specific features in */ +#define __KVM_HAVE_PIT +#define __KVM_HAVE_IOAPIC +#define __KVM_HAVE_IRQ_LINE +#define __KVM_HAVE_MSI +#define __KVM_HAVE_USER_NMI +#define __KVM_HAVE_GUEST_DEBUG +#define __KVM_HAVE_MSIX +#define __KVM_HAVE_MCE +#define __KVM_HAVE_PIT_STATE2 +#define __KVM_HAVE_XEN_HVM +#define __KVM_HAVE_VCPU_EVENTS +#define __KVM_HAVE_DEBUGREGS +#define __KVM_HAVE_XSAVE +#define __KVM_HAVE_XCRS +#define __KVM_HAVE_READONLY_MEM + +/* Architectural interrupt line count. */ +#define KVM_NR_INTERRUPTS 256 + +struct kvm_memory_alias { + __u32 slot; /* this has a different namespace than memory slots */ + __u32 flags; + __u64 guest_phys_addr; + __u64 memory_size; + __u64 target_phys_addr; +}; + +/* for KVM_GET_IRQCHIP and KVM_SET_IRQCHIP */ +struct kvm_pic_state { + __u8 last_irr; /* edge detection */ + __u8 irr; /* interrupt request register */ + __u8 imr; /* interrupt mask register */ + __u8 isr; /* interrupt service register */ + __u8 priority_add; /* highest irq priority */ + __u8 irq_base; + __u8 read_reg_select; + __u8 poll; + __u8 special_mask; + __u8 init_state; + __u8 auto_eoi; + __u8 rotate_on_auto_eoi; + __u8 special_fully_nested_mode; + __u8 init4; /* true if 4 byte init */ + __u8 elcr; /* PIIX edge/trigger selection */ + __u8 elcr_mask; +}; + +#define KVM_IOAPIC_NUM_PINS 24 +struct kvm_ioapic_state { + __u64 base_address; + __u32 ioregsel; + __u32 id; + __u32 irr; + __u32 pad; + union { + __u64 bits; + struct { + __u8 vector; + __u8 delivery_mode:3; + __u8 dest_mode:1; + __u8 delivery_status:1; + __u8 polarity:1; + __u8 remote_irr:1; + __u8 trig_mode:1; + __u8 mask:1; + __u8 reserve:7; + __u8 reserved[4]; + __u8 dest_id; + } fields; + } redirtbl[KVM_IOAPIC_NUM_PINS]; +}; + +#define KVM_IRQCHIP_PIC_MASTER 0 +#define KVM_IRQCHIP_PIC_SLAVE 1 +#define KVM_IRQCHIP_IOAPIC 2 +#define KVM_NR_IRQCHIPS 3 + +#define KVM_RUN_X86_SMM (1 << 0) + +/* for KVM_GET_REGS and KVM_SET_REGS */ +struct kvm_regs { + /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */ + __u64 rax, rbx, rcx, rdx; + __u64 rsi, rdi, rsp, rbp; + __u64 r8, r9, r10, r11; + __u64 r12, r13, r14, r15; + __u64 rip, rflags; +}; + +/* for KVM_GET_LAPIC and KVM_SET_LAPIC */ +#define KVM_APIC_REG_SIZE 0x400 +struct kvm_lapic_state { + char regs[KVM_APIC_REG_SIZE]; +}; + +struct kvm_segment { + __u64 base; + __u32 limit; + __u16 selector; + __u8 type; + __u8 present, dpl, db, s, l, g, avl; + __u8 unusable; + __u8 padding; +}; + +struct kvm_dtable { + __u64 base; + __u16 limit; + __u16 padding[3]; +}; + + +/* for KVM_GET_SREGS and KVM_SET_SREGS */ +struct kvm_sregs { + /* out (KVM_GET_SREGS) / in (KVM_SET_SREGS) */ + struct kvm_segment cs, ds, es, fs, gs, ss; + struct kvm_segment tr, ldt; + struct kvm_dtable gdt, idt; + __u64 cr0, cr2, cr3, cr4, cr8; + __u64 efer; + __u64 apic_base; + __u64 interrupt_bitmap[(KVM_NR_INTERRUPTS + 63) / 64]; +}; + +/* for KVM_GET_FPU and KVM_SET_FPU */ +struct kvm_fpu { + __u8 fpr[8][16]; + __u16 fcw; + __u16 fsw; + __u8 ftwx; /* in fxsave format */ + __u8 pad1; + __u16 last_opcode; + __u64 last_ip; + __u64 last_dp; + __u8 xmm[16][16]; + __u32 mxcsr; + __u32 pad2; +}; + +struct kvm_msr_entry { + __u32 index; + __u32 reserved; + __u64 data; +}; + +/* for KVM_GET_MSRS and KVM_SET_MSRS */ +struct kvm_msrs { + __u32 nmsrs; /* number of msrs in entries */ + __u32 pad; + + struct kvm_msr_entry entries[0]; +}; + +/* for KVM_GET_MSR_INDEX_LIST */ +struct kvm_msr_list { + __u32 nmsrs; /* number of msrs in entries */ + __u32 indices[0]; +}; + + +struct kvm_cpuid_entry { + __u32 function; + __u32 eax; + __u32 ebx; + __u32 ecx; + __u32 edx; + __u32 padding; +}; + +/* for KVM_SET_CPUID */ +struct kvm_cpuid { + __u32 nent; + __u32 padding; + struct kvm_cpuid_entry entries[0]; +}; + +struct kvm_cpuid_entry2 { + __u32 function; + __u32 index; + __u32 flags; + __u32 eax; + __u32 ebx; + __u32 ecx; + __u32 edx; + __u32 padding[3]; +}; + +#define KVM_CPUID_FLAG_SIGNIFCANT_INDEX (1 << 0) +#define KVM_CPUID_FLAG_STATEFUL_FUNC (1 << 1) +#define KVM_CPUID_FLAG_STATE_READ_NEXT (1 << 2) + +/* for KVM_SET_CPUID2 */ +struct kvm_cpuid2 { + __u32 nent; + __u32 padding; + struct kvm_cpuid_entry2 entries[0]; +}; + +/* for KVM_GET_PIT and KVM_SET_PIT */ +struct kvm_pit_channel_state { + __u32 count; /* can be 65536 */ + __u16 latched_count; + __u8 count_latched; + __u8 status_latched; + __u8 status; + __u8 read_state; + __u8 write_state; + __u8 write_latch; + __u8 rw_mode; + __u8 mode; + __u8 bcd; + __u8 gate; + __s64 count_load_time; +}; + +struct kvm_debug_exit_arch { + __u32 exception; + __u32 pad; + __u64 pc; + __u64 dr6; + __u64 dr7; +}; + +#define KVM_GUESTDBG_USE_SW_BP 0x00010000 +#define KVM_GUESTDBG_USE_HW_BP 0x00020000 +#define KVM_GUESTDBG_INJECT_DB 0x00040000 +#define KVM_GUESTDBG_INJECT_BP 0x00080000 + +/* for KVM_SET_GUEST_DEBUG */ +struct kvm_guest_debug_arch { + __u64 debugreg[8]; +}; + +struct kvm_pit_state { + struct kvm_pit_channel_state channels[3]; +}; + +#define KVM_PIT_FLAGS_HPET_LEGACY 0x00000001 + +struct kvm_pit_state2 { + struct kvm_pit_channel_state channels[3]; + __u32 flags; + __u32 reserved[9]; +}; + +struct kvm_reinject_control { + __u8 pit_reinject; + __u8 reserved[31]; +}; + +/* When set in flags, include corresponding fields on KVM_SET_VCPU_EVENTS */ +#define KVM_VCPUEVENT_VALID_NMI_PENDING 0x00000001 +#define KVM_VCPUEVENT_VALID_SIPI_VECTOR 0x00000002 +#define KVM_VCPUEVENT_VALID_SHADOW 0x00000004 +#define KVM_VCPUEVENT_VALID_SMM 0x00000008 + +/* Interrupt shadow states */ +#define KVM_X86_SHADOW_INT_MOV_SS 0x01 +#define KVM_X86_SHADOW_INT_STI 0x02 + +/* for KVM_GET/SET_VCPU_EVENTS */ +struct kvm_vcpu_events { + struct { + __u8 injected; + __u8 nr; + __u8 has_error_code; + __u8 pad; + __u32 error_code; + } exception; + struct { + __u8 injected; + __u8 nr; + __u8 soft; + __u8 shadow; + } interrupt; + struct { + __u8 injected; + __u8 pending; + __u8 masked; + __u8 pad; + } nmi; + __u32 sipi_vector; + __u32 flags; + struct { + __u8 smm; + __u8 pending; + __u8 smm_inside_nmi; + __u8 latched_init; + } smi; + __u32 reserved[9]; +}; + +/* for KVM_GET/SET_DEBUGREGS */ +struct kvm_debugregs { + __u64 db[4]; + __u64 dr6; + __u64 dr7; + __u64 flags; + __u64 reserved[9]; +}; + +/* for KVM_CAP_XSAVE */ +struct kvm_xsave { + __u32 region[1024]; +}; + +#define KVM_MAX_XCRS 16 + +struct kvm_xcr { + __u32 xcr; + __u32 reserved; + __u64 value; +}; + +struct kvm_xcrs { + __u32 nr_xcrs; + __u32 flags; + struct kvm_xcr xcrs[KVM_MAX_XCRS]; + __u64 padding[16]; +}; + +#define KVM_SYNC_X86_REGS (1UL << 0) +#define KVM_SYNC_X86_SREGS (1UL << 1) +#define KVM_SYNC_X86_EVENTS (1UL << 2) + +#define KVM_SYNC_X86_VALID_FIELDS \ + (KVM_SYNC_X86_REGS| \ + KVM_SYNC_X86_SREGS| \ + KVM_SYNC_X86_EVENTS) + +/* kvm_sync_regs struct included by kvm_run struct */ +struct kvm_sync_regs { + /* Members of this structure are potentially malicious. + * Care must be taken by code reading, esp. interpreting, + * data fields from them inside KVM to prevent TOCTOU and + * double-fetch types of vulnerabilities. + */ + struct kvm_regs regs; + struct kvm_sregs sregs; + struct kvm_vcpu_events events; +}; + +#define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0) +#define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1) +#define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2) + +#define KVM_STATE_NESTED_GUEST_MODE 0x00000001 +#define KVM_STATE_NESTED_RUN_PENDING 0x00000002 + +#define KVM_STATE_NESTED_SMM_GUEST_MODE 0x00000001 +#define KVM_STATE_NESTED_SMM_VMXON 0x00000002 + +struct kvm_vmx_nested_state { + __u64 vmxon_pa; + __u64 vmcs_pa; + + struct { + __u16 flags; + } smm; +}; + +/* for KVM_CAP_NESTED_STATE */ +struct kvm_nested_state { + /* KVM_STATE_* flags */ + __u16 flags; + + /* 0 for VMX, 1 for SVM. */ + __u16 format; + + /* 128 for SVM, 128 + VMCS size for VMX. */ + __u32 size; + + union { + /* VMXON, VMCS */ + struct kvm_vmx_nested_state vmx; + + /* Pad the header to 128 bytes. */ + __u8 pad[120]; + }; + + __u8 data[0]; +}; + +#endif /* _ASM_X86_KVM_H */ diff --git a/tools/arch/x86/include/uapi/asm/kvm_perf.h b/tools/arch/x86/include/uapi/asm/kvm_perf.h new file mode 100644 index 000000000..125cf5cdf --- /dev/null +++ b/tools/arch/x86/include/uapi/asm/kvm_perf.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _ASM_X86_KVM_PERF_H +#define _ASM_X86_KVM_PERF_H + +#include +#include +#include + +#define DECODE_STR_LEN 20 + +#define VCPU_ID "vcpu_id" + +#define KVM_ENTRY_TRACE "kvm:kvm_entry" +#define KVM_EXIT_TRACE "kvm:kvm_exit" +#define KVM_EXIT_REASON "exit_reason" + +#endif /* _ASM_X86_KVM_PERF_H */ diff --git a/tools/arch/x86/include/uapi/asm/mman.h b/tools/arch/x86/include/uapi/asm/mman.h new file mode 100644 index 000000000..8449778de --- /dev/null +++ b/tools/arch/x86/include/uapi/asm/mman.h @@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H +#define TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H +#define MAP_32BIT 0x40 +#include +#endif diff --git a/tools/arch/x86/include/uapi/asm/perf_regs.h b/tools/arch/x86/include/uapi/asm/perf_regs.h new file mode 100644 index 000000000..f3329cabc --- /dev/null +++ b/tools/arch/x86/include/uapi/asm/perf_regs.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _ASM_X86_PERF_REGS_H +#define _ASM_X86_PERF_REGS_H + +enum perf_event_x86_regs { + PERF_REG_X86_AX, + PERF_REG_X86_BX, + PERF_REG_X86_CX, + PERF_REG_X86_DX, + PERF_REG_X86_SI, + PERF_REG_X86_DI, + PERF_REG_X86_BP, + PERF_REG_X86_SP, + PERF_REG_X86_IP, + PERF_REG_X86_FLAGS, + PERF_REG_X86_CS, + PERF_REG_X86_SS, + PERF_REG_X86_DS, + PERF_REG_X86_ES, + PERF_REG_X86_FS, + PERF_REG_X86_GS, + PERF_REG_X86_R8, + PERF_REG_X86_R9, + PERF_REG_X86_R10, + PERF_REG_X86_R11, + PERF_REG_X86_R12, + PERF_REG_X86_R13, + PERF_REG_X86_R14, + PERF_REG_X86_R15, + + PERF_REG_X86_32_MAX = PERF_REG_X86_GS + 1, + PERF_REG_X86_64_MAX = PERF_REG_X86_R15 + 1, +}; +#endif /* _ASM_X86_PERF_REGS_H */ diff --git a/tools/arch/x86/include/uapi/asm/svm.h b/tools/arch/x86/include/uapi/asm/svm.h new file mode 100644 index 000000000..a9731f8a4 --- /dev/null +++ b/tools/arch/x86/include/uapi/asm/svm.h @@ -0,0 +1,179 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _UAPI__SVM_H +#define _UAPI__SVM_H + +#define SVM_EXIT_READ_CR0 0x000 +#define SVM_EXIT_READ_CR2 0x002 +#define SVM_EXIT_READ_CR3 0x003 +#define SVM_EXIT_READ_CR4 0x004 +#define SVM_EXIT_READ_CR8 0x008 +#define SVM_EXIT_WRITE_CR0 0x010 +#define SVM_EXIT_WRITE_CR2 0x012 +#define SVM_EXIT_WRITE_CR3 0x013 +#define SVM_EXIT_WRITE_CR4 0x014 +#define SVM_EXIT_WRITE_CR8 0x018 +#define SVM_EXIT_READ_DR0 0x020 +#define SVM_EXIT_READ_DR1 0x021 +#define SVM_EXIT_READ_DR2 0x022 +#define SVM_EXIT_READ_DR3 0x023 +#define SVM_EXIT_READ_DR4 0x024 +#define SVM_EXIT_READ_DR5 0x025 +#define SVM_EXIT_READ_DR6 0x026 +#define SVM_EXIT_READ_DR7 0x027 +#define SVM_EXIT_WRITE_DR0 0x030 +#define SVM_EXIT_WRITE_DR1 0x031 +#define SVM_EXIT_WRITE_DR2 0x032 +#define SVM_EXIT_WRITE_DR3 0x033 +#define SVM_EXIT_WRITE_DR4 0x034 +#define SVM_EXIT_WRITE_DR5 0x035 +#define SVM_EXIT_WRITE_DR6 0x036 +#define SVM_EXIT_WRITE_DR7 0x037 +#define SVM_EXIT_EXCP_BASE 0x040 +#define SVM_EXIT_INTR 0x060 +#define SVM_EXIT_NMI 0x061 +#define SVM_EXIT_SMI 0x062 +#define SVM_EXIT_INIT 0x063 +#define SVM_EXIT_VINTR 0x064 +#define SVM_EXIT_CR0_SEL_WRITE 0x065 +#define SVM_EXIT_IDTR_READ 0x066 +#define SVM_EXIT_GDTR_READ 0x067 +#define SVM_EXIT_LDTR_READ 0x068 +#define SVM_EXIT_TR_READ 0x069 +#define SVM_EXIT_IDTR_WRITE 0x06a +#define SVM_EXIT_GDTR_WRITE 0x06b +#define SVM_EXIT_LDTR_WRITE 0x06c +#define SVM_EXIT_TR_WRITE 0x06d +#define SVM_EXIT_RDTSC 0x06e +#define SVM_EXIT_RDPMC 0x06f +#define SVM_EXIT_PUSHF 0x070 +#define SVM_EXIT_POPF 0x071 +#define SVM_EXIT_CPUID 0x072 +#define SVM_EXIT_RSM 0x073 +#define SVM_EXIT_IRET 0x074 +#define SVM_EXIT_SWINT 0x075 +#define SVM_EXIT_INVD 0x076 +#define SVM_EXIT_PAUSE 0x077 +#define SVM_EXIT_HLT 0x078 +#define SVM_EXIT_INVLPG 0x079 +#define SVM_EXIT_INVLPGA 0x07a +#define SVM_EXIT_IOIO 0x07b +#define SVM_EXIT_MSR 0x07c +#define SVM_EXIT_TASK_SWITCH 0x07d +#define SVM_EXIT_FERR_FREEZE 0x07e +#define SVM_EXIT_SHUTDOWN 0x07f +#define SVM_EXIT_VMRUN 0x080 +#define SVM_EXIT_VMMCALL 0x081 +#define SVM_EXIT_VMLOAD 0x082 +#define SVM_EXIT_VMSAVE 0x083 +#define SVM_EXIT_STGI 0x084 +#define SVM_EXIT_CLGI 0x085 +#define SVM_EXIT_SKINIT 0x086 +#define SVM_EXIT_RDTSCP 0x087 +#define SVM_EXIT_ICEBP 0x088 +#define SVM_EXIT_WBINVD 0x089 +#define SVM_EXIT_MONITOR 0x08a +#define SVM_EXIT_MWAIT 0x08b +#define SVM_EXIT_MWAIT_COND 0x08c +#define SVM_EXIT_XSETBV 0x08d +#define SVM_EXIT_NPF 0x400 +#define SVM_EXIT_AVIC_INCOMPLETE_IPI 0x401 +#define SVM_EXIT_AVIC_UNACCELERATED_ACCESS 0x402 + +#define SVM_EXIT_ERR -1 + +#define SVM_EXIT_REASONS \ + { SVM_EXIT_READ_CR0, "read_cr0" }, \ + { SVM_EXIT_READ_CR2, "read_cr2" }, \ + { SVM_EXIT_READ_CR3, "read_cr3" }, \ + { SVM_EXIT_READ_CR4, "read_cr4" }, \ + { SVM_EXIT_READ_CR8, "read_cr8" }, \ + { SVM_EXIT_WRITE_CR0, "write_cr0" }, \ + { SVM_EXIT_WRITE_CR2, "write_cr2" }, \ + { SVM_EXIT_WRITE_CR3, "write_cr3" }, \ + { SVM_EXIT_WRITE_CR4, "write_cr4" }, \ + { SVM_EXIT_WRITE_CR8, "write_cr8" }, \ + { SVM_EXIT_READ_DR0, "read_dr0" }, \ + { SVM_EXIT_READ_DR1, "read_dr1" }, \ + { SVM_EXIT_READ_DR2, "read_dr2" }, \ + { SVM_EXIT_READ_DR3, "read_dr3" }, \ + { SVM_EXIT_READ_DR4, "read_dr4" }, \ + { SVM_EXIT_READ_DR5, "read_dr5" }, \ + { SVM_EXIT_READ_DR6, "read_dr6" }, \ + { SVM_EXIT_READ_DR7, "read_dr7" }, \ + { SVM_EXIT_WRITE_DR0, "write_dr0" }, \ + { SVM_EXIT_WRITE_DR1, "write_dr1" }, \ + { SVM_EXIT_WRITE_DR2, "write_dr2" }, \ + { SVM_EXIT_WRITE_DR3, "write_dr3" }, \ + { SVM_EXIT_WRITE_DR4, "write_dr4" }, \ + { SVM_EXIT_WRITE_DR5, "write_dr5" }, \ + { SVM_EXIT_WRITE_DR6, "write_dr6" }, \ + { SVM_EXIT_WRITE_DR7, "write_dr7" }, \ + { SVM_EXIT_EXCP_BASE + DE_VECTOR, "DE excp" }, \ + { SVM_EXIT_EXCP_BASE + DB_VECTOR, "DB excp" }, \ + { SVM_EXIT_EXCP_BASE + BP_VECTOR, "BP excp" }, \ + { SVM_EXIT_EXCP_BASE + OF_VECTOR, "OF excp" }, \ + { SVM_EXIT_EXCP_BASE + BR_VECTOR, "BR excp" }, \ + { SVM_EXIT_EXCP_BASE + UD_VECTOR, "UD excp" }, \ + { SVM_EXIT_EXCP_BASE + NM_VECTOR, "NM excp" }, \ + { SVM_EXIT_EXCP_BASE + DF_VECTOR, "DF excp" }, \ + { SVM_EXIT_EXCP_BASE + TS_VECTOR, "TS excp" }, \ + { SVM_EXIT_EXCP_BASE + NP_VECTOR, "NP excp" }, \ + { SVM_EXIT_EXCP_BASE + SS_VECTOR, "SS excp" }, \ + { SVM_EXIT_EXCP_BASE + GP_VECTOR, "GP excp" }, \ + { SVM_EXIT_EXCP_BASE + PF_VECTOR, "PF excp" }, \ + { SVM_EXIT_EXCP_BASE + MF_VECTOR, "MF excp" }, \ + { SVM_EXIT_EXCP_BASE + AC_VECTOR, "AC excp" }, \ + { SVM_EXIT_EXCP_BASE + MC_VECTOR, "MC excp" }, \ + { SVM_EXIT_EXCP_BASE + XM_VECTOR, "XF excp" }, \ + { SVM_EXIT_INTR, "interrupt" }, \ + { SVM_EXIT_NMI, "nmi" }, \ + { SVM_EXIT_SMI, "smi" }, \ + { SVM_EXIT_INIT, "init" }, \ + { SVM_EXIT_VINTR, "vintr" }, \ + { SVM_EXIT_CR0_SEL_WRITE, "cr0_sel_write" }, \ + { SVM_EXIT_IDTR_READ, "read_idtr" }, \ + { SVM_EXIT_GDTR_READ, "read_gdtr" }, \ + { SVM_EXIT_LDTR_READ, "read_ldtr" }, \ + { SVM_EXIT_TR_READ, "read_rt" }, \ + { SVM_EXIT_IDTR_WRITE, "write_idtr" }, \ + { SVM_EXIT_GDTR_WRITE, "write_gdtr" }, \ + { SVM_EXIT_LDTR_WRITE, "write_ldtr" }, \ + { SVM_EXIT_TR_WRITE, "write_rt" }, \ + { SVM_EXIT_RDTSC, "rdtsc" }, \ + { SVM_EXIT_RDPMC, "rdpmc" }, \ + { SVM_EXIT_PUSHF, "pushf" }, \ + { SVM_EXIT_POPF, "popf" }, \ + { SVM_EXIT_CPUID, "cpuid" }, \ + { SVM_EXIT_RSM, "rsm" }, \ + { SVM_EXIT_IRET, "iret" }, \ + { SVM_EXIT_SWINT, "swint" }, \ + { SVM_EXIT_INVD, "invd" }, \ + { SVM_EXIT_PAUSE, "pause" }, \ + { SVM_EXIT_HLT, "hlt" }, \ + { SVM_EXIT_INVLPG, "invlpg" }, \ + { SVM_EXIT_INVLPGA, "invlpga" }, \ + { SVM_EXIT_IOIO, "io" }, \ + { SVM_EXIT_MSR, "msr" }, \ + { SVM_EXIT_TASK_SWITCH, "task_switch" }, \ + { SVM_EXIT_FERR_FREEZE, "ferr_freeze" }, \ + { SVM_EXIT_SHUTDOWN, "shutdown" }, \ + { SVM_EXIT_VMRUN, "vmrun" }, \ + { SVM_EXIT_VMMCALL, "hypercall" }, \ + { SVM_EXIT_VMLOAD, "vmload" }, \ + { SVM_EXIT_VMSAVE, "vmsave" }, \ + { SVM_EXIT_STGI, "stgi" }, \ + { SVM_EXIT_CLGI, "clgi" }, \ + { SVM_EXIT_SKINIT, "skinit" }, \ + { SVM_EXIT_RDTSCP, "rdtscp" }, \ + { SVM_EXIT_ICEBP, "icebp" }, \ + { SVM_EXIT_WBINVD, "wbinvd" }, \ + { SVM_EXIT_MONITOR, "monitor" }, \ + { SVM_EXIT_MWAIT, "mwait" }, \ + { SVM_EXIT_XSETBV, "xsetbv" }, \ + { SVM_EXIT_NPF, "npf" }, \ + { SVM_EXIT_AVIC_INCOMPLETE_IPI, "avic_incomplete_ipi" }, \ + { SVM_EXIT_AVIC_UNACCELERATED_ACCESS, "avic_unaccelerated_access" }, \ + { SVM_EXIT_ERR, "invalid_guest_state" } + + +#endif /* _UAPI__SVM_H */ diff --git a/tools/arch/x86/include/uapi/asm/unistd.h b/tools/arch/x86/include/uapi/asm/unistd.h new file mode 100644 index 000000000..30d7d04d7 --- /dev/null +++ b/tools/arch/x86/include/uapi/asm/unistd.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _UAPI_ASM_X86_UNISTD_H +#define _UAPI_ASM_X86_UNISTD_H + +/* x32 syscall flag bit */ +#define __X32_SYSCALL_BIT 0x40000000 + +#ifndef __KERNEL__ +# ifdef __i386__ +# include +# elif defined(__ILP32__) +# include +# else +# include +# endif +#endif + +#endif /* _UAPI_ASM_X86_UNISTD_H */ diff --git a/tools/arch/x86/include/uapi/asm/vmx.h b/tools/arch/x86/include/uapi/asm/vmx.h new file mode 100644 index 000000000..f0b0c90dd --- /dev/null +++ b/tools/arch/x86/include/uapi/asm/vmx.h @@ -0,0 +1,151 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * vmx.h: VMX Architecture related definitions + * Copyright (c) 2004, Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307 USA. + * + * A few random additions are: + * Copyright (C) 2006 Qumranet + * Avi Kivity + * Yaniv Kamay + * + */ +#ifndef _UAPIVMX_H +#define _UAPIVMX_H + + +#define VMX_EXIT_REASONS_FAILED_VMENTRY 0x80000000 + +#define EXIT_REASON_EXCEPTION_NMI 0 +#define EXIT_REASON_EXTERNAL_INTERRUPT 1 +#define EXIT_REASON_TRIPLE_FAULT 2 + +#define EXIT_REASON_PENDING_INTERRUPT 7 +#define EXIT_REASON_NMI_WINDOW 8 +#define EXIT_REASON_TASK_SWITCH 9 +#define EXIT_REASON_CPUID 10 +#define EXIT_REASON_HLT 12 +#define EXIT_REASON_INVD 13 +#define EXIT_REASON_INVLPG 14 +#define EXIT_REASON_RDPMC 15 +#define EXIT_REASON_RDTSC 16 +#define EXIT_REASON_VMCALL 18 +#define EXIT_REASON_VMCLEAR 19 +#define EXIT_REASON_VMLAUNCH 20 +#define EXIT_REASON_VMPTRLD 21 +#define EXIT_REASON_VMPTRST 22 +#define EXIT_REASON_VMREAD 23 +#define EXIT_REASON_VMRESUME 24 +#define EXIT_REASON_VMWRITE 25 +#define EXIT_REASON_VMOFF 26 +#define EXIT_REASON_VMON 27 +#define EXIT_REASON_CR_ACCESS 28 +#define EXIT_REASON_DR_ACCESS 29 +#define EXIT_REASON_IO_INSTRUCTION 30 +#define EXIT_REASON_MSR_READ 31 +#define EXIT_REASON_MSR_WRITE 32 +#define EXIT_REASON_INVALID_STATE 33 +#define EXIT_REASON_MSR_LOAD_FAIL 34 +#define EXIT_REASON_MWAIT_INSTRUCTION 36 +#define EXIT_REASON_MONITOR_TRAP_FLAG 37 +#define EXIT_REASON_MONITOR_INSTRUCTION 39 +#define EXIT_REASON_PAUSE_INSTRUCTION 40 +#define EXIT_REASON_MCE_DURING_VMENTRY 41 +#define EXIT_REASON_TPR_BELOW_THRESHOLD 43 +#define EXIT_REASON_APIC_ACCESS 44 +#define EXIT_REASON_EOI_INDUCED 45 +#define EXIT_REASON_GDTR_IDTR 46 +#define EXIT_REASON_LDTR_TR 47 +#define EXIT_REASON_EPT_VIOLATION 48 +#define EXIT_REASON_EPT_MISCONFIG 49 +#define EXIT_REASON_INVEPT 50 +#define EXIT_REASON_RDTSCP 51 +#define EXIT_REASON_PREEMPTION_TIMER 52 +#define EXIT_REASON_INVVPID 53 +#define EXIT_REASON_WBINVD 54 +#define EXIT_REASON_XSETBV 55 +#define EXIT_REASON_APIC_WRITE 56 +#define EXIT_REASON_RDRAND 57 +#define EXIT_REASON_INVPCID 58 +#define EXIT_REASON_VMFUNC 59 +#define EXIT_REASON_ENCLS 60 +#define EXIT_REASON_RDSEED 61 +#define EXIT_REASON_PML_FULL 62 +#define EXIT_REASON_XSAVES 63 +#define EXIT_REASON_XRSTORS 64 + +#define VMX_EXIT_REASONS \ + { EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, \ + { EXIT_REASON_EXTERNAL_INTERRUPT, "EXTERNAL_INTERRUPT" }, \ + { EXIT_REASON_TRIPLE_FAULT, "TRIPLE_FAULT" }, \ + { EXIT_REASON_PENDING_INTERRUPT, "PENDING_INTERRUPT" }, \ + { EXIT_REASON_NMI_WINDOW, "NMI_WINDOW" }, \ + { EXIT_REASON_TASK_SWITCH, "TASK_SWITCH" }, \ + { EXIT_REASON_CPUID, "CPUID" }, \ + { EXIT_REASON_HLT, "HLT" }, \ + { EXIT_REASON_INVD, "INVD" }, \ + { EXIT_REASON_INVLPG, "INVLPG" }, \ + { EXIT_REASON_RDPMC, "RDPMC" }, \ + { EXIT_REASON_RDTSC, "RDTSC" }, \ + { EXIT_REASON_VMCALL, "VMCALL" }, \ + { EXIT_REASON_VMCLEAR, "VMCLEAR" }, \ + { EXIT_REASON_VMLAUNCH, "VMLAUNCH" }, \ + { EXIT_REASON_VMPTRLD, "VMPTRLD" }, \ + { EXIT_REASON_VMPTRST, "VMPTRST" }, \ + { EXIT_REASON_VMREAD, "VMREAD" }, \ + { EXIT_REASON_VMRESUME, "VMRESUME" }, \ + { EXIT_REASON_VMWRITE, "VMWRITE" }, \ + { EXIT_REASON_VMOFF, "VMOFF" }, \ + { EXIT_REASON_VMON, "VMON" }, \ + { EXIT_REASON_CR_ACCESS, "CR_ACCESS" }, \ + { EXIT_REASON_DR_ACCESS, "DR_ACCESS" }, \ + { EXIT_REASON_IO_INSTRUCTION, "IO_INSTRUCTION" }, \ + { EXIT_REASON_MSR_READ, "MSR_READ" }, \ + { EXIT_REASON_MSR_WRITE, "MSR_WRITE" }, \ + { EXIT_REASON_INVALID_STATE, "INVALID_STATE" }, \ + { EXIT_REASON_MSR_LOAD_FAIL, "MSR_LOAD_FAIL" }, \ + { EXIT_REASON_MWAIT_INSTRUCTION, "MWAIT_INSTRUCTION" }, \ + { EXIT_REASON_MONITOR_TRAP_FLAG, "MONITOR_TRAP_FLAG" }, \ + { EXIT_REASON_MONITOR_INSTRUCTION, "MONITOR_INSTRUCTION" }, \ + { EXIT_REASON_PAUSE_INSTRUCTION, "PAUSE_INSTRUCTION" }, \ + { EXIT_REASON_MCE_DURING_VMENTRY, "MCE_DURING_VMENTRY" }, \ + { EXIT_REASON_TPR_BELOW_THRESHOLD, "TPR_BELOW_THRESHOLD" }, \ + { EXIT_REASON_APIC_ACCESS, "APIC_ACCESS" }, \ + { EXIT_REASON_EOI_INDUCED, "EOI_INDUCED" }, \ + { EXIT_REASON_GDTR_IDTR, "GDTR_IDTR" }, \ + { EXIT_REASON_LDTR_TR, "LDTR_TR" }, \ + { EXIT_REASON_EPT_VIOLATION, "EPT_VIOLATION" }, \ + { EXIT_REASON_EPT_MISCONFIG, "EPT_MISCONFIG" }, \ + { EXIT_REASON_INVEPT, "INVEPT" }, \ + { EXIT_REASON_RDTSCP, "RDTSCP" }, \ + { EXIT_REASON_PREEMPTION_TIMER, "PREEMPTION_TIMER" }, \ + { EXIT_REASON_INVVPID, "INVVPID" }, \ + { EXIT_REASON_WBINVD, "WBINVD" }, \ + { EXIT_REASON_XSETBV, "XSETBV" }, \ + { EXIT_REASON_APIC_WRITE, "APIC_WRITE" }, \ + { EXIT_REASON_RDRAND, "RDRAND" }, \ + { EXIT_REASON_INVPCID, "INVPCID" }, \ + { EXIT_REASON_VMFUNC, "VMFUNC" }, \ + { EXIT_REASON_ENCLS, "ENCLS" }, \ + { EXIT_REASON_RDSEED, "RDSEED" }, \ + { EXIT_REASON_PML_FULL, "PML_FULL" }, \ + { EXIT_REASON_XSAVES, "XSAVES" }, \ + { EXIT_REASON_XRSTORS, "XRSTORS" } + +#define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1 +#define VMX_ABORT_LOAD_HOST_PDPTE_FAIL 2 +#define VMX_ABORT_LOAD_HOST_MSR_FAIL 4 + +#endif /* _UAPIVMX_H */ diff --git a/tools/arch/x86/lib/memcpy_64.S b/tools/arch/x86/lib/memcpy_64.S new file mode 100644 index 000000000..3b24dc052 --- /dev/null +++ b/tools/arch/x86/lib/memcpy_64.S @@ -0,0 +1,297 @@ +/* Copyright 2002 Andi Kleen */ + +#include +#include +#include +#include +#include +#include + +/* + * We build a jump to memcpy_orig by default which gets NOPped out on + * the majority of x86 CPUs which set REP_GOOD. In addition, CPUs which + * have the enhanced REP MOVSB/STOSB feature (ERMS), change those NOPs + * to a jmp to memcpy_erms which does the REP; MOVSB mem copy. + */ + +.weak memcpy + +/* + * memcpy - Copy a memory block. + * + * Input: + * rdi destination + * rsi source + * rdx count + * + * Output: + * rax original destination + */ +ENTRY(__memcpy) +ENTRY(memcpy) + ALTERNATIVE_2 "jmp memcpy_orig", "", X86_FEATURE_REP_GOOD, \ + "jmp memcpy_erms", X86_FEATURE_ERMS + + movq %rdi, %rax + movq %rdx, %rcx + shrq $3, %rcx + andl $7, %edx + rep movsq + movl %edx, %ecx + rep movsb + ret +ENDPROC(memcpy) +ENDPROC(__memcpy) +EXPORT_SYMBOL(memcpy) +EXPORT_SYMBOL(__memcpy) + +/* + * memcpy_erms() - enhanced fast string memcpy. This is faster and + * simpler than memcpy. Use memcpy_erms when possible. + */ +ENTRY(memcpy_erms) + movq %rdi, %rax + movq %rdx, %rcx + rep movsb + ret +ENDPROC(memcpy_erms) + +ENTRY(memcpy_orig) + movq %rdi, %rax + + cmpq $0x20, %rdx + jb .Lhandle_tail + + /* + * We check whether memory false dependence could occur, + * then jump to corresponding copy mode. + */ + cmp %dil, %sil + jl .Lcopy_backward + subq $0x20, %rdx +.Lcopy_forward_loop: + subq $0x20, %rdx + + /* + * Move in blocks of 4x8 bytes: + */ + movq 0*8(%rsi), %r8 + movq 1*8(%rsi), %r9 + movq 2*8(%rsi), %r10 + movq 3*8(%rsi), %r11 + leaq 4*8(%rsi), %rsi + + movq %r8, 0*8(%rdi) + movq %r9, 1*8(%rdi) + movq %r10, 2*8(%rdi) + movq %r11, 3*8(%rdi) + leaq 4*8(%rdi), %rdi + jae .Lcopy_forward_loop + addl $0x20, %edx + jmp .Lhandle_tail + +.Lcopy_backward: + /* + * Calculate copy position to tail. + */ + addq %rdx, %rsi + addq %rdx, %rdi + subq $0x20, %rdx + /* + * At most 3 ALU operations in one cycle, + * so append NOPS in the same 16 bytes trunk. + */ + .p2align 4 +.Lcopy_backward_loop: + subq $0x20, %rdx + movq -1*8(%rsi), %r8 + movq -2*8(%rsi), %r9 + movq -3*8(%rsi), %r10 + movq -4*8(%rsi), %r11 + leaq -4*8(%rsi), %rsi + movq %r8, -1*8(%rdi) + movq %r9, -2*8(%rdi) + movq %r10, -3*8(%rdi) + movq %r11, -4*8(%rdi) + leaq -4*8(%rdi), %rdi + jae .Lcopy_backward_loop + + /* + * Calculate copy position to head. + */ + addl $0x20, %edx + subq %rdx, %rsi + subq %rdx, %rdi +.Lhandle_tail: + cmpl $16, %edx + jb .Lless_16bytes + + /* + * Move data from 16 bytes to 31 bytes. + */ + movq 0*8(%rsi), %r8 + movq 1*8(%rsi), %r9 + movq -2*8(%rsi, %rdx), %r10 + movq -1*8(%rsi, %rdx), %r11 + movq %r8, 0*8(%rdi) + movq %r9, 1*8(%rdi) + movq %r10, -2*8(%rdi, %rdx) + movq %r11, -1*8(%rdi, %rdx) + retq + .p2align 4 +.Lless_16bytes: + cmpl $8, %edx + jb .Lless_8bytes + /* + * Move data from 8 bytes to 15 bytes. + */ + movq 0*8(%rsi), %r8 + movq -1*8(%rsi, %rdx), %r9 + movq %r8, 0*8(%rdi) + movq %r9, -1*8(%rdi, %rdx) + retq + .p2align 4 +.Lless_8bytes: + cmpl $4, %edx + jb .Lless_3bytes + + /* + * Move data from 4 bytes to 7 bytes. + */ + movl (%rsi), %ecx + movl -4(%rsi, %rdx), %r8d + movl %ecx, (%rdi) + movl %r8d, -4(%rdi, %rdx) + retq + .p2align 4 +.Lless_3bytes: + subl $1, %edx + jb .Lend + /* + * Move data from 1 bytes to 3 bytes. + */ + movzbl (%rsi), %ecx + jz .Lstore_1byte + movzbq 1(%rsi), %r8 + movzbq (%rsi, %rdx), %r9 + movb %r8b, 1(%rdi) + movb %r9b, (%rdi, %rdx) +.Lstore_1byte: + movb %cl, (%rdi) + +.Lend: + retq +ENDPROC(memcpy_orig) + +#ifndef CONFIG_UML + +MCSAFE_TEST_CTL + +/* + * __memcpy_mcsafe - memory copy with machine check exception handling + * Note that we only catch machine checks when reading the source addresses. + * Writes to target are posted and don't generate machine checks. + */ +ENTRY(__memcpy_mcsafe) + cmpl $8, %edx + /* Less than 8 bytes? Go to byte copy loop */ + jb .L_no_whole_words + + /* Check for bad alignment of source */ + testl $7, %esi + /* Already aligned */ + jz .L_8byte_aligned + + /* Copy one byte at a time until source is 8-byte aligned */ + movl %esi, %ecx + andl $7, %ecx + subl $8, %ecx + negl %ecx + subl %ecx, %edx +.L_read_leading_bytes: + movb (%rsi), %al + MCSAFE_TEST_SRC %rsi 1 .E_leading_bytes + MCSAFE_TEST_DST %rdi 1 .E_leading_bytes +.L_write_leading_bytes: + movb %al, (%rdi) + incq %rsi + incq %rdi + decl %ecx + jnz .L_read_leading_bytes + +.L_8byte_aligned: + movl %edx, %ecx + andl $7, %edx + shrl $3, %ecx + jz .L_no_whole_words + +.L_read_words: + movq (%rsi), %r8 + MCSAFE_TEST_SRC %rsi 8 .E_read_words + MCSAFE_TEST_DST %rdi 8 .E_write_words +.L_write_words: + movq %r8, (%rdi) + addq $8, %rsi + addq $8, %rdi + decl %ecx + jnz .L_read_words + + /* Any trailing bytes? */ +.L_no_whole_words: + andl %edx, %edx + jz .L_done_memcpy_trap + + /* Copy trailing bytes */ + movl %edx, %ecx +.L_read_trailing_bytes: + movb (%rsi), %al + MCSAFE_TEST_SRC %rsi 1 .E_trailing_bytes + MCSAFE_TEST_DST %rdi 1 .E_trailing_bytes +.L_write_trailing_bytes: + movb %al, (%rdi) + incq %rsi + incq %rdi + decl %ecx + jnz .L_read_trailing_bytes + + /* Copy successful. Return zero */ +.L_done_memcpy_trap: + xorl %eax, %eax + ret +ENDPROC(__memcpy_mcsafe) +EXPORT_SYMBOL_GPL(__memcpy_mcsafe) + + .section .fixup, "ax" + /* + * Return number of bytes not copied for any failure. Note that + * there is no "tail" handling since the source buffer is 8-byte + * aligned and poison is cacheline aligned. + */ +.E_read_words: + shll $3, %ecx +.E_leading_bytes: + addl %edx, %ecx +.E_trailing_bytes: + mov %ecx, %eax + ret + + /* + * For write fault handling, given the destination is unaligned, + * we handle faults on multi-byte writes with a byte-by-byte + * copy up to the write-protected page. + */ +.E_write_words: + shll $3, %ecx + addl %edx, %ecx + movl %ecx, %edx + jmp mcsafe_handle_tail + + .previous + + _ASM_EXTABLE_FAULT(.L_read_leading_bytes, .E_leading_bytes) + _ASM_EXTABLE_FAULT(.L_read_words, .E_read_words) + _ASM_EXTABLE_FAULT(.L_read_trailing_bytes, .E_trailing_bytes) + _ASM_EXTABLE(.L_write_leading_bytes, .E_leading_bytes) + _ASM_EXTABLE(.L_write_words, .E_write_words) + _ASM_EXTABLE(.L_write_trailing_bytes, .E_trailing_bytes) +#endif diff --git a/tools/arch/x86/lib/memset_64.S b/tools/arch/x86/lib/memset_64.S new file mode 100644 index 000000000..f8f3dc0a6 --- /dev/null +++ b/tools/arch/x86/lib/memset_64.S @@ -0,0 +1,139 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright 2002 Andi Kleen, SuSE Labs */ + +#include +#include +#include + +.weak memset + +/* + * ISO C memset - set a memory block to a byte value. This function uses fast + * string to get better performance than the original function. The code is + * simpler and shorter than the original function as well. + * + * rdi destination + * rsi value (char) + * rdx count (bytes) + * + * rax original destination + */ +ENTRY(memset) +ENTRY(__memset) + /* + * Some CPUs support enhanced REP MOVSB/STOSB feature. It is recommended + * to use it when possible. If not available, use fast string instructions. + * + * Otherwise, use original memset function. + */ + ALTERNATIVE_2 "jmp memset_orig", "", X86_FEATURE_REP_GOOD, \ + "jmp memset_erms", X86_FEATURE_ERMS + + movq %rdi,%r9 + movq %rdx,%rcx + andl $7,%edx + shrq $3,%rcx + /* expand byte value */ + movzbl %sil,%esi + movabs $0x0101010101010101,%rax + imulq %rsi,%rax + rep stosq + movl %edx,%ecx + rep stosb + movq %r9,%rax + ret +ENDPROC(memset) +ENDPROC(__memset) + +/* + * ISO C memset - set a memory block to a byte value. This function uses + * enhanced rep stosb to override the fast string function. + * The code is simpler and shorter than the fast string function as well. + * + * rdi destination + * rsi value (char) + * rdx count (bytes) + * + * rax original destination + */ +ENTRY(memset_erms) + movq %rdi,%r9 + movb %sil,%al + movq %rdx,%rcx + rep stosb + movq %r9,%rax + ret +ENDPROC(memset_erms) + +ENTRY(memset_orig) + movq %rdi,%r10 + + /* expand byte value */ + movzbl %sil,%ecx + movabs $0x0101010101010101,%rax + imulq %rcx,%rax + + /* align dst */ + movl %edi,%r9d + andl $7,%r9d + jnz .Lbad_alignment +.Lafter_bad_alignment: + + movq %rdx,%rcx + shrq $6,%rcx + jz .Lhandle_tail + + .p2align 4 +.Lloop_64: + decq %rcx + movq %rax,(%rdi) + movq %rax,8(%rdi) + movq %rax,16(%rdi) + movq %rax,24(%rdi) + movq %rax,32(%rdi) + movq %rax,40(%rdi) + movq %rax,48(%rdi) + movq %rax,56(%rdi) + leaq 64(%rdi),%rdi + jnz .Lloop_64 + + /* Handle tail in loops. The loops should be faster than hard + to predict jump tables. */ + .p2align 4 +.Lhandle_tail: + movl %edx,%ecx + andl $63&(~7),%ecx + jz .Lhandle_7 + shrl $3,%ecx + .p2align 4 +.Lloop_8: + decl %ecx + movq %rax,(%rdi) + leaq 8(%rdi),%rdi + jnz .Lloop_8 + +.Lhandle_7: + andl $7,%edx + jz .Lende + .p2align 4 +.Lloop_1: + decl %edx + movb %al,(%rdi) + leaq 1(%rdi),%rdi + jnz .Lloop_1 + +.Lende: + movq %r10,%rax + ret + +.Lbad_alignment: + cmpq $7,%rdx + jbe .Lhandle_7 + movq %rax,(%rdi) /* unaligned store */ + movq $8,%r8 + subq %r9,%r8 + addq %r8,%rdi + subq %r8,%rdx + jmp .Lafter_bad_alignment +.Lfinal: +ENDPROC(memset_orig) diff --git a/tools/arch/xtensa/include/asm/barrier.h b/tools/arch/xtensa/include/asm/barrier.h new file mode 100644 index 000000000..583800bd7 --- /dev/null +++ b/tools/arch/xtensa/include/asm/barrier.h @@ -0,0 +1,18 @@ +/* + * Copied from the kernel sources to tools/: + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2001 - 2012 Tensilica Inc. + */ + +#ifndef _TOOLS_LINUX_XTENSA_SYSTEM_H +#define _TOOLS_LINUX_XTENSA_SYSTEM_H + +#define mb() ({ __asm__ __volatile__("memw" : : : "memory"); }) +#define rmb() barrier() +#define wmb() mb() + +#endif /* _TOOLS_LINUX_XTENSA_SYSTEM_H */ diff --git a/tools/arch/xtensa/include/uapi/asm/mman.h b/tools/arch/xtensa/include/uapi/asm/mman.h new file mode 100644 index 000000000..34dde6f44 --- /dev/null +++ b/tools/arch/xtensa/include/uapi/asm/mman.h @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H +#define TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H +#define MADV_DODUMP 17 +#define MADV_DOFORK 11 +#define MADV_DONTDUMP 16 +#define MADV_DONTFORK 10 +#define MADV_DONTNEED 4 +#define MADV_FREE 8 +#define MADV_HUGEPAGE 14 +#define MADV_MERGEABLE 12 +#define MADV_NOHUGEPAGE 15 +#define MADV_NORMAL 0 +#define MADV_RANDOM 1 +#define MADV_REMOVE 9 +#define MADV_SEQUENTIAL 2 +#define MADV_UNMERGEABLE 13 +#define MADV_WILLNEED 3 +#define MAP_ANONYMOUS 0x0800 +#define MAP_DENYWRITE 0x2000 +#define MAP_EXECUTABLE 0x4000 +#define MAP_FILE 0 +#define MAP_FIXED 0x010 +#define MAP_GROWSDOWN 0x1000 +#define MAP_HUGETLB 0x80000 +#define MAP_LOCKED 0x8000 +#define MAP_NONBLOCK 0x20000 +#define MAP_NORESERVE 0x0400 +#define MAP_POPULATE 0x10000 +#define MAP_PRIVATE 0x002 +#define MAP_SHARED 0x001 +#define MAP_STACK 0x40000 +#define PROT_EXEC 0x4 +#define PROT_GROWSDOWN 0x01000000 +#define PROT_GROWSUP 0x02000000 +#define PROT_NONE 0x0 +#define PROT_READ 0x1 +#define PROT_SEM 0x10 +#define PROT_WRITE 0x2 +/* MADV_HWPOISON is undefined on xtensa, fix it for perf */ +#define MADV_HWPOISON 100 +/* MADV_SOFT_OFFLINE is undefined on xtensa, fix it for perf */ +#define MADV_SOFT_OFFLINE 101 +/* MAP_32BIT is undefined on xtensa, fix it for perf */ +#define MAP_32BIT 0 +/* MAP_UNINITIALIZED is undefined on xtensa, fix it for perf */ +#define MAP_UNINITIALIZED 0 +#endif diff --git a/tools/bpf/.gitignore b/tools/bpf/.gitignore new file mode 100644 index 000000000..dfe2bd5a4 --- /dev/null +++ b/tools/bpf/.gitignore @@ -0,0 +1,5 @@ +FEATURE-DUMP.bpf +bpf_asm +bpf_dbg +bpf_exp.yacc.* +bpf_jit_disasm diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile new file mode 100644 index 000000000..53b60ad45 --- /dev/null +++ b/tools/bpf/Makefile @@ -0,0 +1,107 @@ +# SPDX-License-Identifier: GPL-2.0 +include ../scripts/Makefile.include + +prefix ?= /usr/local + +CC = gcc +LEX = flex +YACC = bison +MAKE = make +INSTALL ?= install + +CFLAGS += -Wall -O2 +CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/include/uapi -I$(srctree)/include + +ifeq ($(srctree),) +srctree := $(patsubst %/,%,$(dir $(CURDIR))) +srctree := $(patsubst %/,%,$(dir $(srctree))) +endif + +ifeq ($(V),1) + Q = +else + Q = @ +endif + +FEATURE_USER = .bpf +FEATURE_TESTS = libbfd disassembler-four-args +FEATURE_DISPLAY = libbfd disassembler-four-args + +check_feat := 1 +NON_CHECK_FEAT_TARGETS := clean bpftool_clean +ifdef MAKECMDGOALS +ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),) + check_feat := 0 +endif +endif + +ifeq ($(check_feat),1) +ifeq ($(FEATURES_DUMP),) +include $(srctree)/tools/build/Makefile.feature +else +include $(FEATURES_DUMP) +endif +endif + +ifeq ($(feature-disassembler-four-args), 1) +CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE +endif + +$(OUTPUT)%.yacc.c: $(srctree)/tools/bpf/%.y + $(QUIET_BISON)$(YACC) -o $@ -d $< + +$(OUTPUT)%.lex.c: $(srctree)/tools/bpf/%.l + $(QUIET_FLEX)$(LEX) -o $@ $< + +$(OUTPUT)%.o: $(srctree)/tools/bpf/%.c + $(QUIET_CC)$(COMPILE.c) -o $@ $< + +$(OUTPUT)%.yacc.o: $(OUTPUT)%.yacc.c + $(QUIET_CC)$(COMPILE.c) -o $@ $< +$(OUTPUT)%.lex.o: $(OUTPUT)%.lex.c + $(QUIET_CC)$(COMPILE.c) -o $@ $< + +PROGS = $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg $(OUTPUT)bpf_asm + +all: $(PROGS) bpftool + +$(OUTPUT)bpf_jit_disasm: CFLAGS += -DPACKAGE='bpf_jit_disasm' +$(OUTPUT)bpf_jit_disasm: $(OUTPUT)bpf_jit_disasm.o + $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $^ -lopcodes -lbfd -ldl + +$(OUTPUT)bpf_dbg: $(OUTPUT)bpf_dbg.o + $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $^ -lreadline + +$(OUTPUT)bpf_asm: $(OUTPUT)bpf_asm.o $(OUTPUT)bpf_exp.yacc.o $(OUTPUT)bpf_exp.lex.o + $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $^ + +$(OUTPUT)bpf_exp.lex.c: $(OUTPUT)bpf_exp.yacc.c +$(OUTPUT)bpf_exp.yacc.o: $(OUTPUT)bpf_exp.yacc.c +$(OUTPUT)bpf_exp.lex.o: $(OUTPUT)bpf_exp.lex.c + +clean: bpftool_clean + $(call QUIET_CLEAN, bpf-progs) + $(Q)rm -rf $(OUTPUT)*.o $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg \ + $(OUTPUT)bpf_asm $(OUTPUT)bpf_exp.yacc.* $(OUTPUT)bpf_exp.lex.* + $(call QUIET_CLEAN, core-gen) + $(Q)rm -f $(OUTPUT)FEATURE-DUMP.bpf + +install: $(PROGS) bpftool_install + $(call QUIET_INSTALL, bpf_jit_disasm) + $(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(prefix)/bin + $(Q)$(INSTALL) $(OUTPUT)bpf_jit_disasm $(DESTDIR)$(prefix)/bin/bpf_jit_disasm + $(call QUIET_INSTALL, bpf_dbg) + $(Q)$(INSTALL) $(OUTPUT)bpf_dbg $(DESTDIR)$(prefix)/bin/bpf_dbg + $(call QUIET_INSTALL, bpf_asm) + $(Q)$(INSTALL) $(OUTPUT)bpf_asm $(DESTDIR)$(prefix)/bin/bpf_asm + +bpftool: + $(call descend,bpftool) + +bpftool_install: + $(call descend,bpftool,install) + +bpftool_clean: + $(call descend,bpftool,clean) + +.PHONY: all install clean bpftool bpftool_install bpftool_clean diff --git a/tools/bpf/Makefile.helpers b/tools/bpf/Makefile.helpers new file mode 100644 index 000000000..c34fea77f --- /dev/null +++ b/tools/bpf/Makefile.helpers @@ -0,0 +1,59 @@ +ifndef allow-override + include ../scripts/Makefile.include + include ../scripts/utilities.mak +else + # Assume Makefile.helpers is being run from bpftool/Documentation + # subdirectory. Go up two more directories to fetch bpf.h header and + # associated script. + UP2DIR := ../../ +endif + +INSTALL ?= install +RM ?= rm -f +RMDIR ?= rmdir --ignore-fail-on-non-empty + +ifeq ($(V),1) + Q = +else + Q = @ +endif + +prefix ?= /usr/local +mandir ?= $(prefix)/man +man7dir = $(mandir)/man7 + +HELPERS_RST = bpf-helpers.rst +MAN7_RST = $(HELPERS_RST) + +_DOC_MAN7 = $(patsubst %.rst,%.7,$(MAN7_RST)) +DOC_MAN7 = $(addprefix $(OUTPUT),$(_DOC_MAN7)) + +helpers: man7 +man7: $(DOC_MAN7) + +RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null) + +$(OUTPUT)$(HELPERS_RST): $(UP2DIR)../../include/uapi/linux/bpf.h + $(QUIET_GEN)$(UP2DIR)../../scripts/bpf_helpers_doc.py --filename $< > $@ + +$(OUTPUT)%.7: $(OUTPUT)%.rst +ifndef RST2MAN_DEP + $(error "rst2man not found, but required to generate man pages") +endif + $(QUIET_GEN)rst2man $< > $@ + +helpers-clean: + $(call QUIET_CLEAN, eBPF_helpers-manpage) + $(Q)$(RM) $(DOC_MAN7) $(OUTPUT)$(HELPERS_RST) + +helpers-install: helpers + $(call QUIET_INSTALL, eBPF_helpers-manpage) + $(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(man7dir) + $(Q)$(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir) + +helpers-uninstall: + $(call QUIET_UNINST, eBPF_helpers-manpage) + $(Q)$(RM) $(addprefix $(DESTDIR)$(man7dir)/,$(_DOC_MAN7)) + $(Q)$(RMDIR) $(DESTDIR)$(man7dir) + +.PHONY: helpers helpers-clean helpers-install helpers-uninstall diff --git a/tools/bpf/bpf_asm.c b/tools/bpf/bpf_asm.c new file mode 100644 index 000000000..c15aef097 --- /dev/null +++ b/tools/bpf/bpf_asm.c @@ -0,0 +1,52 @@ +/* + * Minimal BPF assembler + * + * Instead of libpcap high-level filter expressions, it can be quite + * useful to define filters in low-level BPF assembler (that is kept + * close to Steven McCanne and Van Jacobson's original BPF paper). + * In particular for BPF JIT implementors, JIT security auditors, or + * just for defining BPF expressions that contain extensions which are + * not supported by compilers. + * + * How to get into it: + * + * 1) read Documentation/networking/filter.txt + * 2) Run `bpf_asm [-c] ` to translate into binary + * blob that is loadable with xt_bpf, cls_bpf et al. Note: -c will + * pretty print a C-like construct. + * + * Copyright 2013 Daniel Borkmann + * Licensed under the GNU General Public License, version 2.0 (GPLv2) + */ + +#include +#include +#include + +extern void bpf_asm_compile(FILE *fp, bool cstyle); + +int main(int argc, char **argv) +{ + FILE *fp = stdin; + bool cstyle = false; + int i; + + for (i = 1; i < argc; i++) { + if (!strncmp("-c", argv[i], 2)) { + cstyle = true; + continue; + } + + fp = fopen(argv[i], "r"); + if (!fp) { + fp = stdin; + continue; + } + + break; + } + + bpf_asm_compile(fp, cstyle); + + return 0; +} diff --git a/tools/bpf/bpf_dbg.c b/tools/bpf/bpf_dbg.c new file mode 100644 index 000000000..61b9aa5d6 --- /dev/null +++ b/tools/bpf/bpf_dbg.c @@ -0,0 +1,1398 @@ +/* + * Minimal BPF debugger + * + * Minimal BPF debugger that mimics the kernel's engine (w/o extensions) + * and allows for single stepping through selected packets from a pcap + * with a provided user filter in order to facilitate verification of a + * BPF program. Besides others, this is useful to verify BPF programs + * before attaching to a live system, and can be used in socket filters, + * cls_bpf, xt_bpf, team driver and e.g. PTP code; in particular when a + * single more complex BPF program is being used. Reasons for a more + * complex BPF program are likely primarily to optimize execution time + * for making a verdict when multiple simple BPF programs are combined + * into one in order to prevent parsing same headers multiple times. + * + * More on how to debug BPF opcodes see Documentation/networking/filter.txt + * which is the main document on BPF. Mini howto for getting started: + * + * 1) `./bpf_dbg` to enter the shell (shell cmds denoted with '>'): + * 2) > load bpf 6,40 0 0 12,21 0 3 20... (output from `bpf_asm` or + * `tcpdump -iem1 -ddd port 22 | tr '\n' ','` to load as filter) + * 3) > load pcap foo.pcap + * 4) > run /disassemble/dump/quit (self-explanatory) + * 5) > breakpoint 2 (sets bp at loaded BPF insns 2, do `run` then; + * multiple bps can be set, of course, a call to `breakpoint` + * w/o args shows currently loaded bps, `breakpoint reset` for + * resetting all breakpoints) + * 6) > select 3 (`run` etc will start from the 3rd packet in the pcap) + * 7) > step [-, +] (performs single stepping through the BPF) + * + * Copyright 2013 Daniel Borkmann + * Licensed under the GNU General Public License, version 2.0 (GPLv2) + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define TCPDUMP_MAGIC 0xa1b2c3d4 + +#define BPF_LDX_B (BPF_LDX | BPF_B) +#define BPF_LDX_W (BPF_LDX | BPF_W) +#define BPF_JMP_JA (BPF_JMP | BPF_JA) +#define BPF_JMP_JEQ (BPF_JMP | BPF_JEQ) +#define BPF_JMP_JGT (BPF_JMP | BPF_JGT) +#define BPF_JMP_JGE (BPF_JMP | BPF_JGE) +#define BPF_JMP_JSET (BPF_JMP | BPF_JSET) +#define BPF_ALU_ADD (BPF_ALU | BPF_ADD) +#define BPF_ALU_SUB (BPF_ALU | BPF_SUB) +#define BPF_ALU_MUL (BPF_ALU | BPF_MUL) +#define BPF_ALU_DIV (BPF_ALU | BPF_DIV) +#define BPF_ALU_MOD (BPF_ALU | BPF_MOD) +#define BPF_ALU_NEG (BPF_ALU | BPF_NEG) +#define BPF_ALU_AND (BPF_ALU | BPF_AND) +#define BPF_ALU_OR (BPF_ALU | BPF_OR) +#define BPF_ALU_XOR (BPF_ALU | BPF_XOR) +#define BPF_ALU_LSH (BPF_ALU | BPF_LSH) +#define BPF_ALU_RSH (BPF_ALU | BPF_RSH) +#define BPF_MISC_TAX (BPF_MISC | BPF_TAX) +#define BPF_MISC_TXA (BPF_MISC | BPF_TXA) +#define BPF_LD_B (BPF_LD | BPF_B) +#define BPF_LD_H (BPF_LD | BPF_H) +#define BPF_LD_W (BPF_LD | BPF_W) + +#ifndef array_size +# define array_size(x) (sizeof(x) / sizeof((x)[0])) +#endif + +#ifndef __check_format_printf +# define __check_format_printf(pos_fmtstr, pos_fmtargs) \ + __attribute__ ((format (printf, (pos_fmtstr), (pos_fmtargs)))) +#endif + +enum { + CMD_OK, + CMD_ERR, + CMD_EX, +}; + +struct shell_cmd { + const char *name; + int (*func)(char *args); +}; + +struct pcap_filehdr { + uint32_t magic; + uint16_t version_major; + uint16_t version_minor; + int32_t thiszone; + uint32_t sigfigs; + uint32_t snaplen; + uint32_t linktype; +}; + +struct pcap_timeval { + int32_t tv_sec; + int32_t tv_usec; +}; + +struct pcap_pkthdr { + struct pcap_timeval ts; + uint32_t caplen; + uint32_t len; +}; + +struct bpf_regs { + uint32_t A; + uint32_t X; + uint32_t M[BPF_MEMWORDS]; + uint32_t R; + bool Rs; + uint16_t Pc; +}; + +static struct sock_filter bpf_image[BPF_MAXINSNS + 1]; +static unsigned int bpf_prog_len; + +static int bpf_breakpoints[64]; +static struct bpf_regs bpf_regs[BPF_MAXINSNS + 1]; +static struct bpf_regs bpf_curr; +static unsigned int bpf_regs_len; + +static int pcap_fd = -1; +static unsigned int pcap_packet; +static size_t pcap_map_size; +static char *pcap_ptr_va_start, *pcap_ptr_va_curr; + +static const char * const op_table[] = { + [BPF_ST] = "st", + [BPF_STX] = "stx", + [BPF_LD_B] = "ldb", + [BPF_LD_H] = "ldh", + [BPF_LD_W] = "ld", + [BPF_LDX] = "ldx", + [BPF_LDX_B] = "ldxb", + [BPF_JMP_JA] = "ja", + [BPF_JMP_JEQ] = "jeq", + [BPF_JMP_JGT] = "jgt", + [BPF_JMP_JGE] = "jge", + [BPF_JMP_JSET] = "jset", + [BPF_ALU_ADD] = "add", + [BPF_ALU_SUB] = "sub", + [BPF_ALU_MUL] = "mul", + [BPF_ALU_DIV] = "div", + [BPF_ALU_MOD] = "mod", + [BPF_ALU_NEG] = "neg", + [BPF_ALU_AND] = "and", + [BPF_ALU_OR] = "or", + [BPF_ALU_XOR] = "xor", + [BPF_ALU_LSH] = "lsh", + [BPF_ALU_RSH] = "rsh", + [BPF_MISC_TAX] = "tax", + [BPF_MISC_TXA] = "txa", + [BPF_RET] = "ret", +}; + +static __check_format_printf(1, 2) int rl_printf(const char *fmt, ...) +{ + int ret; + va_list vl; + + va_start(vl, fmt); + ret = vfprintf(rl_outstream, fmt, vl); + va_end(vl); + + return ret; +} + +static int matches(const char *cmd, const char *pattern) +{ + int len = strlen(cmd); + + if (len > strlen(pattern)) + return -1; + + return memcmp(pattern, cmd, len); +} + +static void hex_dump(const uint8_t *buf, size_t len) +{ + int i; + + rl_printf("%3u: ", 0); + for (i = 0; i < len; i++) { + if (i && !(i % 16)) + rl_printf("\n%3u: ", i); + rl_printf("%02x ", buf[i]); + } + rl_printf("\n"); +} + +static bool bpf_prog_loaded(void) +{ + if (bpf_prog_len == 0) + rl_printf("no bpf program loaded!\n"); + + return bpf_prog_len > 0; +} + +static void bpf_disasm(const struct sock_filter f, unsigned int i) +{ + const char *op, *fmt; + int val = f.k; + char buf[256]; + + switch (f.code) { + case BPF_RET | BPF_K: + op = op_table[BPF_RET]; + fmt = "#%#x"; + break; + case BPF_RET | BPF_A: + op = op_table[BPF_RET]; + fmt = "a"; + break; + case BPF_RET | BPF_X: + op = op_table[BPF_RET]; + fmt = "x"; + break; + case BPF_MISC_TAX: + op = op_table[BPF_MISC_TAX]; + fmt = ""; + break; + case BPF_MISC_TXA: + op = op_table[BPF_MISC_TXA]; + fmt = ""; + break; + case BPF_ST: + op = op_table[BPF_ST]; + fmt = "M[%d]"; + break; + case BPF_STX: + op = op_table[BPF_STX]; + fmt = "M[%d]"; + break; + case BPF_LD_W | BPF_ABS: + op = op_table[BPF_LD_W]; + fmt = "[%d]"; + break; + case BPF_LD_H | BPF_ABS: + op = op_table[BPF_LD_H]; + fmt = "[%d]"; + break; + case BPF_LD_B | BPF_ABS: + op = op_table[BPF_LD_B]; + fmt = "[%d]"; + break; + case BPF_LD_W | BPF_LEN: + op = op_table[BPF_LD_W]; + fmt = "#len"; + break; + case BPF_LD_W | BPF_IND: + op = op_table[BPF_LD_W]; + fmt = "[x+%d]"; + break; + case BPF_LD_H | BPF_IND: + op = op_table[BPF_LD_H]; + fmt = "[x+%d]"; + break; + case BPF_LD_B | BPF_IND: + op = op_table[BPF_LD_B]; + fmt = "[x+%d]"; + break; + case BPF_LD | BPF_IMM: + op = op_table[BPF_LD_W]; + fmt = "#%#x"; + break; + case BPF_LDX | BPF_IMM: + op = op_table[BPF_LDX]; + fmt = "#%#x"; + break; + case BPF_LDX_B | BPF_MSH: + op = op_table[BPF_LDX_B]; + fmt = "4*([%d]&0xf)"; + break; + case BPF_LD | BPF_MEM: + op = op_table[BPF_LD_W]; + fmt = "M[%d]"; + break; + case BPF_LDX | BPF_MEM: + op = op_table[BPF_LDX]; + fmt = "M[%d]"; + break; + case BPF_JMP_JA: + op = op_table[BPF_JMP_JA]; + fmt = "%d"; + val = i + 1 + f.k; + break; + case BPF_JMP_JGT | BPF_X: + op = op_table[BPF_JMP_JGT]; + fmt = "x"; + break; + case BPF_JMP_JGT | BPF_K: + op = op_table[BPF_JMP_JGT]; + fmt = "#%#x"; + break; + case BPF_JMP_JGE | BPF_X: + op = op_table[BPF_JMP_JGE]; + fmt = "x"; + break; + case BPF_JMP_JGE | BPF_K: + op = op_table[BPF_JMP_JGE]; + fmt = "#%#x"; + break; + case BPF_JMP_JEQ | BPF_X: + op = op_table[BPF_JMP_JEQ]; + fmt = "x"; + break; + case BPF_JMP_JEQ | BPF_K: + op = op_table[BPF_JMP_JEQ]; + fmt = "#%#x"; + break; + case BPF_JMP_JSET | BPF_X: + op = op_table[BPF_JMP_JSET]; + fmt = "x"; + break; + case BPF_JMP_JSET | BPF_K: + op = op_table[BPF_JMP_JSET]; + fmt = "#%#x"; + break; + case BPF_ALU_NEG: + op = op_table[BPF_ALU_NEG]; + fmt = ""; + break; + case BPF_ALU_LSH | BPF_X: + op = op_table[BPF_ALU_LSH]; + fmt = "x"; + break; + case BPF_ALU_LSH | BPF_K: + op = op_table[BPF_ALU_LSH]; + fmt = "#%d"; + break; + case BPF_ALU_RSH | BPF_X: + op = op_table[BPF_ALU_RSH]; + fmt = "x"; + break; + case BPF_ALU_RSH | BPF_K: + op = op_table[BPF_ALU_RSH]; + fmt = "#%d"; + break; + case BPF_ALU_ADD | BPF_X: + op = op_table[BPF_ALU_ADD]; + fmt = "x"; + break; + case BPF_ALU_ADD | BPF_K: + op = op_table[BPF_ALU_ADD]; + fmt = "#%d"; + break; + case BPF_ALU_SUB | BPF_X: + op = op_table[BPF_ALU_SUB]; + fmt = "x"; + break; + case BPF_ALU_SUB | BPF_K: + op = op_table[BPF_ALU_SUB]; + fmt = "#%d"; + break; + case BPF_ALU_MUL | BPF_X: + op = op_table[BPF_ALU_MUL]; + fmt = "x"; + break; + case BPF_ALU_MUL | BPF_K: + op = op_table[BPF_ALU_MUL]; + fmt = "#%d"; + break; + case BPF_ALU_DIV | BPF_X: + op = op_table[BPF_ALU_DIV]; + fmt = "x"; + break; + case BPF_ALU_DIV | BPF_K: + op = op_table[BPF_ALU_DIV]; + fmt = "#%d"; + break; + case BPF_ALU_MOD | BPF_X: + op = op_table[BPF_ALU_MOD]; + fmt = "x"; + break; + case BPF_ALU_MOD | BPF_K: + op = op_table[BPF_ALU_MOD]; + fmt = "#%d"; + break; + case BPF_ALU_AND | BPF_X: + op = op_table[BPF_ALU_AND]; + fmt = "x"; + break; + case BPF_ALU_AND | BPF_K: + op = op_table[BPF_ALU_AND]; + fmt = "#%#x"; + break; + case BPF_ALU_OR | BPF_X: + op = op_table[BPF_ALU_OR]; + fmt = "x"; + break; + case BPF_ALU_OR | BPF_K: + op = op_table[BPF_ALU_OR]; + fmt = "#%#x"; + break; + case BPF_ALU_XOR | BPF_X: + op = op_table[BPF_ALU_XOR]; + fmt = "x"; + break; + case BPF_ALU_XOR | BPF_K: + op = op_table[BPF_ALU_XOR]; + fmt = "#%#x"; + break; + default: + op = "nosup"; + fmt = "%#x"; + val = f.code; + break; + } + + memset(buf, 0, sizeof(buf)); + snprintf(buf, sizeof(buf), fmt, val); + buf[sizeof(buf) - 1] = 0; + + if ((BPF_CLASS(f.code) == BPF_JMP && BPF_OP(f.code) != BPF_JA)) + rl_printf("l%d:\t%s %s, l%d, l%d\n", i, op, buf, + i + 1 + f.jt, i + 1 + f.jf); + else + rl_printf("l%d:\t%s %s\n", i, op, buf); +} + +static void bpf_dump_curr(struct bpf_regs *r, struct sock_filter *f) +{ + int i, m = 0; + + rl_printf("pc: [%u]\n", r->Pc); + rl_printf("code: [%u] jt[%u] jf[%u] k[%u]\n", + f->code, f->jt, f->jf, f->k); + rl_printf("curr: "); + bpf_disasm(*f, r->Pc); + + if (f->jt || f->jf) { + rl_printf("jt: "); + bpf_disasm(*(f + f->jt + 1), r->Pc + f->jt + 1); + rl_printf("jf: "); + bpf_disasm(*(f + f->jf + 1), r->Pc + f->jf + 1); + } + + rl_printf("A: [%#08x][%u]\n", r->A, r->A); + rl_printf("X: [%#08x][%u]\n", r->X, r->X); + if (r->Rs) + rl_printf("ret: [%#08x][%u]!\n", r->R, r->R); + + for (i = 0; i < BPF_MEMWORDS; i++) { + if (r->M[i]) { + m++; + rl_printf("M[%d]: [%#08x][%u]\n", i, r->M[i], r->M[i]); + } + } + if (m == 0) + rl_printf("M[0,%d]: [%#08x][%u]\n", BPF_MEMWORDS - 1, 0, 0); +} + +static void bpf_dump_pkt(uint8_t *pkt, uint32_t pkt_caplen, uint32_t pkt_len) +{ + if (pkt_caplen != pkt_len) + rl_printf("cap: %u, len: %u\n", pkt_caplen, pkt_len); + else + rl_printf("len: %u\n", pkt_len); + + hex_dump(pkt, pkt_caplen); +} + +static void bpf_disasm_all(const struct sock_filter *f, unsigned int len) +{ + unsigned int i; + + for (i = 0; i < len; i++) + bpf_disasm(f[i], i); +} + +static void bpf_dump_all(const struct sock_filter *f, unsigned int len) +{ + unsigned int i; + + rl_printf("/* { op, jt, jf, k }, */\n"); + for (i = 0; i < len; i++) + rl_printf("{ %#04x, %2u, %2u, %#010x },\n", + f[i].code, f[i].jt, f[i].jf, f[i].k); +} + +static bool bpf_runnable(struct sock_filter *f, unsigned int len) +{ + int sock, ret, i; + struct sock_fprog bpf = { + .filter = f, + .len = len, + }; + + sock = socket(AF_INET, SOCK_DGRAM, 0); + if (sock < 0) { + rl_printf("cannot open socket!\n"); + return false; + } + ret = setsockopt(sock, SOL_SOCKET, SO_ATTACH_FILTER, &bpf, sizeof(bpf)); + close(sock); + if (ret < 0) { + rl_printf("program not allowed to run by kernel!\n"); + return false; + } + for (i = 0; i < len; i++) { + if (BPF_CLASS(f[i].code) == BPF_LD && + f[i].k > SKF_AD_OFF) { + rl_printf("extensions currently not supported!\n"); + return false; + } + } + + return true; +} + +static void bpf_reset_breakpoints(void) +{ + int i; + + for (i = 0; i < array_size(bpf_breakpoints); i++) + bpf_breakpoints[i] = -1; +} + +static void bpf_set_breakpoints(unsigned int where) +{ + int i; + bool set = false; + + for (i = 0; i < array_size(bpf_breakpoints); i++) { + if (bpf_breakpoints[i] == (int) where) { + rl_printf("breakpoint already set!\n"); + set = true; + break; + } + + if (bpf_breakpoints[i] == -1 && set == false) { + bpf_breakpoints[i] = where; + set = true; + } + } + + if (!set) + rl_printf("too many breakpoints set, reset first!\n"); +} + +static void bpf_dump_breakpoints(void) +{ + int i; + + rl_printf("breakpoints: "); + + for (i = 0; i < array_size(bpf_breakpoints); i++) { + if (bpf_breakpoints[i] < 0) + continue; + rl_printf("%d ", bpf_breakpoints[i]); + } + + rl_printf("\n"); +} + +static void bpf_reset(void) +{ + bpf_regs_len = 0; + + memset(bpf_regs, 0, sizeof(bpf_regs)); + memset(&bpf_curr, 0, sizeof(bpf_curr)); +} + +static void bpf_safe_regs(void) +{ + memcpy(&bpf_regs[bpf_regs_len++], &bpf_curr, sizeof(bpf_curr)); +} + +static bool bpf_restore_regs(int off) +{ + unsigned int index = bpf_regs_len - 1 + off; + + if (index == 0) { + bpf_reset(); + return true; + } else if (index < bpf_regs_len) { + memcpy(&bpf_curr, &bpf_regs[index], sizeof(bpf_curr)); + bpf_regs_len = index; + return true; + } else { + rl_printf("reached bottom of register history stack!\n"); + return false; + } +} + +static uint32_t extract_u32(uint8_t *pkt, uint32_t off) +{ + uint32_t r; + + memcpy(&r, &pkt[off], sizeof(r)); + + return ntohl(r); +} + +static uint16_t extract_u16(uint8_t *pkt, uint32_t off) +{ + uint16_t r; + + memcpy(&r, &pkt[off], sizeof(r)); + + return ntohs(r); +} + +static uint8_t extract_u8(uint8_t *pkt, uint32_t off) +{ + return pkt[off]; +} + +static void set_return(struct bpf_regs *r) +{ + r->R = 0; + r->Rs = true; +} + +static void bpf_single_step(struct bpf_regs *r, struct sock_filter *f, + uint8_t *pkt, uint32_t pkt_caplen, + uint32_t pkt_len) +{ + uint32_t K = f->k; + int d; + + switch (f->code) { + case BPF_RET | BPF_K: + r->R = K; + r->Rs = true; + break; + case BPF_RET | BPF_A: + r->R = r->A; + r->Rs = true; + break; + case BPF_RET | BPF_X: + r->R = r->X; + r->Rs = true; + break; + case BPF_MISC_TAX: + r->X = r->A; + break; + case BPF_MISC_TXA: + r->A = r->X; + break; + case BPF_ST: + r->M[K] = r->A; + break; + case BPF_STX: + r->M[K] = r->X; + break; + case BPF_LD_W | BPF_ABS: + d = pkt_caplen - K; + if (d >= sizeof(uint32_t)) + r->A = extract_u32(pkt, K); + else + set_return(r); + break; + case BPF_LD_H | BPF_ABS: + d = pkt_caplen - K; + if (d >= sizeof(uint16_t)) + r->A = extract_u16(pkt, K); + else + set_return(r); + break; + case BPF_LD_B | BPF_ABS: + d = pkt_caplen - K; + if (d >= sizeof(uint8_t)) + r->A = extract_u8(pkt, K); + else + set_return(r); + break; + case BPF_LD_W | BPF_IND: + d = pkt_caplen - (r->X + K); + if (d >= sizeof(uint32_t)) + r->A = extract_u32(pkt, r->X + K); + break; + case BPF_LD_H | BPF_IND: + d = pkt_caplen - (r->X + K); + if (d >= sizeof(uint16_t)) + r->A = extract_u16(pkt, r->X + K); + else + set_return(r); + break; + case BPF_LD_B | BPF_IND: + d = pkt_caplen - (r->X + K); + if (d >= sizeof(uint8_t)) + r->A = extract_u8(pkt, r->X + K); + else + set_return(r); + break; + case BPF_LDX_B | BPF_MSH: + d = pkt_caplen - K; + if (d >= sizeof(uint8_t)) { + r->X = extract_u8(pkt, K); + r->X = (r->X & 0xf) << 2; + } else + set_return(r); + break; + case BPF_LD_W | BPF_LEN: + r->A = pkt_len; + break; + case BPF_LDX_W | BPF_LEN: + r->A = pkt_len; + break; + case BPF_LD | BPF_IMM: + r->A = K; + break; + case BPF_LDX | BPF_IMM: + r->X = K; + break; + case BPF_LD | BPF_MEM: + r->A = r->M[K]; + break; + case BPF_LDX | BPF_MEM: + r->X = r->M[K]; + break; + case BPF_JMP_JA: + r->Pc += K; + break; + case BPF_JMP_JGT | BPF_X: + r->Pc += r->A > r->X ? f->jt : f->jf; + break; + case BPF_JMP_JGT | BPF_K: + r->Pc += r->A > K ? f->jt : f->jf; + break; + case BPF_JMP_JGE | BPF_X: + r->Pc += r->A >= r->X ? f->jt : f->jf; + break; + case BPF_JMP_JGE | BPF_K: + r->Pc += r->A >= K ? f->jt : f->jf; + break; + case BPF_JMP_JEQ | BPF_X: + r->Pc += r->A == r->X ? f->jt : f->jf; + break; + case BPF_JMP_JEQ | BPF_K: + r->Pc += r->A == K ? f->jt : f->jf; + break; + case BPF_JMP_JSET | BPF_X: + r->Pc += r->A & r->X ? f->jt : f->jf; + break; + case BPF_JMP_JSET | BPF_K: + r->Pc += r->A & K ? f->jt : f->jf; + break; + case BPF_ALU_NEG: + r->A = -r->A; + break; + case BPF_ALU_LSH | BPF_X: + r->A <<= r->X; + break; + case BPF_ALU_LSH | BPF_K: + r->A <<= K; + break; + case BPF_ALU_RSH | BPF_X: + r->A >>= r->X; + break; + case BPF_ALU_RSH | BPF_K: + r->A >>= K; + break; + case BPF_ALU_ADD | BPF_X: + r->A += r->X; + break; + case BPF_ALU_ADD | BPF_K: + r->A += K; + break; + case BPF_ALU_SUB | BPF_X: + r->A -= r->X; + break; + case BPF_ALU_SUB | BPF_K: + r->A -= K; + break; + case BPF_ALU_MUL | BPF_X: + r->A *= r->X; + break; + case BPF_ALU_MUL | BPF_K: + r->A *= K; + break; + case BPF_ALU_DIV | BPF_X: + case BPF_ALU_MOD | BPF_X: + if (r->X == 0) { + set_return(r); + break; + } + goto do_div; + case BPF_ALU_DIV | BPF_K: + case BPF_ALU_MOD | BPF_K: + if (K == 0) { + set_return(r); + break; + } +do_div: + switch (f->code) { + case BPF_ALU_DIV | BPF_X: + r->A /= r->X; + break; + case BPF_ALU_DIV | BPF_K: + r->A /= K; + break; + case BPF_ALU_MOD | BPF_X: + r->A %= r->X; + break; + case BPF_ALU_MOD | BPF_K: + r->A %= K; + break; + } + break; + case BPF_ALU_AND | BPF_X: + r->A &= r->X; + break; + case BPF_ALU_AND | BPF_K: + r->A &= K; + break; + case BPF_ALU_OR | BPF_X: + r->A |= r->X; + break; + case BPF_ALU_OR | BPF_K: + r->A |= K; + break; + case BPF_ALU_XOR | BPF_X: + r->A ^= r->X; + break; + case BPF_ALU_XOR | BPF_K: + r->A ^= K; + break; + } +} + +static bool bpf_pc_has_breakpoint(uint16_t pc) +{ + int i; + + for (i = 0; i < array_size(bpf_breakpoints); i++) { + if (bpf_breakpoints[i] < 0) + continue; + if (bpf_breakpoints[i] == pc) + return true; + } + + return false; +} + +static bool bpf_handle_breakpoint(struct bpf_regs *r, struct sock_filter *f, + uint8_t *pkt, uint32_t pkt_caplen, + uint32_t pkt_len) +{ + rl_printf("-- register dump --\n"); + bpf_dump_curr(r, &f[r->Pc]); + rl_printf("-- packet dump --\n"); + bpf_dump_pkt(pkt, pkt_caplen, pkt_len); + rl_printf("(breakpoint)\n"); + return true; +} + +static int bpf_run_all(struct sock_filter *f, uint16_t bpf_len, uint8_t *pkt, + uint32_t pkt_caplen, uint32_t pkt_len) +{ + bool stop = false; + + while (bpf_curr.Rs == false && stop == false) { + bpf_safe_regs(); + + if (bpf_pc_has_breakpoint(bpf_curr.Pc)) + stop = bpf_handle_breakpoint(&bpf_curr, f, pkt, + pkt_caplen, pkt_len); + + bpf_single_step(&bpf_curr, &f[bpf_curr.Pc], pkt, pkt_caplen, + pkt_len); + bpf_curr.Pc++; + } + + return stop ? -1 : bpf_curr.R; +} + +static int bpf_run_stepping(struct sock_filter *f, uint16_t bpf_len, + uint8_t *pkt, uint32_t pkt_caplen, + uint32_t pkt_len, int next) +{ + bool stop = false; + int i = 1; + + while (bpf_curr.Rs == false && stop == false) { + bpf_safe_regs(); + + if (i++ == next) + stop = bpf_handle_breakpoint(&bpf_curr, f, pkt, + pkt_caplen, pkt_len); + + bpf_single_step(&bpf_curr, &f[bpf_curr.Pc], pkt, pkt_caplen, + pkt_len); + bpf_curr.Pc++; + } + + return stop ? -1 : bpf_curr.R; +} + +static bool pcap_loaded(void) +{ + if (pcap_fd < 0) + rl_printf("no pcap file loaded!\n"); + + return pcap_fd >= 0; +} + +static struct pcap_pkthdr *pcap_curr_pkt(void) +{ + return (void *) pcap_ptr_va_curr; +} + +static bool pcap_next_pkt(void) +{ + struct pcap_pkthdr *hdr = pcap_curr_pkt(); + + if (pcap_ptr_va_curr + sizeof(*hdr) - + pcap_ptr_va_start >= pcap_map_size) + return false; + if (hdr->caplen == 0 || hdr->len == 0 || hdr->caplen > hdr->len) + return false; + if (pcap_ptr_va_curr + sizeof(*hdr) + hdr->caplen - + pcap_ptr_va_start >= pcap_map_size) + return false; + + pcap_ptr_va_curr += (sizeof(*hdr) + hdr->caplen); + return true; +} + +static void pcap_reset_pkt(void) +{ + pcap_ptr_va_curr = pcap_ptr_va_start + sizeof(struct pcap_filehdr); +} + +static int try_load_pcap(const char *file) +{ + struct pcap_filehdr *hdr; + struct stat sb; + int ret; + + pcap_fd = open(file, O_RDONLY); + if (pcap_fd < 0) { + rl_printf("cannot open pcap [%s]!\n", strerror(errno)); + return CMD_ERR; + } + + ret = fstat(pcap_fd, &sb); + if (ret < 0) { + rl_printf("cannot fstat pcap file!\n"); + return CMD_ERR; + } + + if (!S_ISREG(sb.st_mode)) { + rl_printf("not a regular pcap file, duh!\n"); + return CMD_ERR; + } + + pcap_map_size = sb.st_size; + if (pcap_map_size <= sizeof(struct pcap_filehdr)) { + rl_printf("pcap file too small!\n"); + return CMD_ERR; + } + + pcap_ptr_va_start = mmap(NULL, pcap_map_size, PROT_READ, + MAP_SHARED | MAP_LOCKED, pcap_fd, 0); + if (pcap_ptr_va_start == MAP_FAILED) { + rl_printf("mmap of file failed!"); + return CMD_ERR; + } + + hdr = (void *) pcap_ptr_va_start; + if (hdr->magic != TCPDUMP_MAGIC) { + rl_printf("wrong pcap magic!\n"); + return CMD_ERR; + } + + pcap_reset_pkt(); + + return CMD_OK; + +} + +static void try_close_pcap(void) +{ + if (pcap_fd >= 0) { + munmap(pcap_ptr_va_start, pcap_map_size); + close(pcap_fd); + + pcap_ptr_va_start = pcap_ptr_va_curr = NULL; + pcap_map_size = 0; + pcap_packet = 0; + pcap_fd = -1; + } +} + +static int cmd_load_bpf(char *bpf_string) +{ + char sp, *token, separator = ','; + unsigned short bpf_len, i = 0; + struct sock_filter tmp; + + bpf_prog_len = 0; + memset(bpf_image, 0, sizeof(bpf_image)); + + if (sscanf(bpf_string, "%hu%c", &bpf_len, &sp) != 2 || + sp != separator || bpf_len > BPF_MAXINSNS || bpf_len == 0) { + rl_printf("syntax error in head length encoding!\n"); + return CMD_ERR; + } + + token = bpf_string; + while ((token = strchr(token, separator)) && (++token)[0]) { + if (i >= bpf_len) { + rl_printf("program exceeds encoded length!\n"); + return CMD_ERR; + } + + if (sscanf(token, "%hu %hhu %hhu %u,", + &tmp.code, &tmp.jt, &tmp.jf, &tmp.k) != 4) { + rl_printf("syntax error at instruction %d!\n", i); + return CMD_ERR; + } + + bpf_image[i].code = tmp.code; + bpf_image[i].jt = tmp.jt; + bpf_image[i].jf = tmp.jf; + bpf_image[i].k = tmp.k; + + i++; + } + + if (i != bpf_len) { + rl_printf("syntax error exceeding encoded length!\n"); + return CMD_ERR; + } else + bpf_prog_len = bpf_len; + if (!bpf_runnable(bpf_image, bpf_prog_len)) + bpf_prog_len = 0; + + return CMD_OK; +} + +static int cmd_load_pcap(char *file) +{ + char *file_trim, *tmp; + + file_trim = strtok_r(file, " ", &tmp); + if (file_trim == NULL) + return CMD_ERR; + + try_close_pcap(); + + return try_load_pcap(file_trim); +} + +static int cmd_load(char *arg) +{ + char *subcmd, *cont = NULL, *tmp = strdup(arg); + int ret = CMD_OK; + + subcmd = strtok_r(tmp, " ", &cont); + if (subcmd == NULL) + goto out; + if (matches(subcmd, "bpf") == 0) { + bpf_reset(); + bpf_reset_breakpoints(); + + if (!cont) + ret = CMD_ERR; + else + ret = cmd_load_bpf(cont); + } else if (matches(subcmd, "pcap") == 0) { + ret = cmd_load_pcap(cont); + } else { +out: + rl_printf("bpf : load bpf code\n"); + rl_printf("pcap : load pcap file\n"); + ret = CMD_ERR; + } + + free(tmp); + return ret; +} + +static int cmd_step(char *num) +{ + struct pcap_pkthdr *hdr; + int steps, ret; + + if (!bpf_prog_loaded() || !pcap_loaded()) + return CMD_ERR; + + steps = strtol(num, NULL, 10); + if (steps == 0 || strlen(num) == 0) + steps = 1; + if (steps < 0) { + if (!bpf_restore_regs(steps)) + return CMD_ERR; + steps = 1; + } + + hdr = pcap_curr_pkt(); + ret = bpf_run_stepping(bpf_image, bpf_prog_len, + (uint8_t *) hdr + sizeof(*hdr), + hdr->caplen, hdr->len, steps); + if (ret >= 0 || bpf_curr.Rs) { + bpf_reset(); + if (!pcap_next_pkt()) { + rl_printf("(going back to first packet)\n"); + pcap_reset_pkt(); + } else { + rl_printf("(next packet)\n"); + } + } + + return CMD_OK; +} + +static int cmd_select(char *num) +{ + unsigned int which, i; + bool have_next = true; + + if (!pcap_loaded() || strlen(num) == 0) + return CMD_ERR; + + which = strtoul(num, NULL, 10); + if (which == 0) { + rl_printf("packet count starts with 1, clamping!\n"); + which = 1; + } + + pcap_reset_pkt(); + bpf_reset(); + + for (i = 0; i < which && (have_next = pcap_next_pkt()); i++) + /* noop */; + if (!have_next || pcap_curr_pkt() == NULL) { + rl_printf("no packet #%u available!\n", which); + pcap_reset_pkt(); + return CMD_ERR; + } + + return CMD_OK; +} + +static int cmd_breakpoint(char *subcmd) +{ + if (!bpf_prog_loaded()) + return CMD_ERR; + if (strlen(subcmd) == 0) + bpf_dump_breakpoints(); + else if (matches(subcmd, "reset") == 0) + bpf_reset_breakpoints(); + else { + unsigned int where = strtoul(subcmd, NULL, 10); + + if (where < bpf_prog_len) { + bpf_set_breakpoints(where); + rl_printf("breakpoint at: "); + bpf_disasm(bpf_image[where], where); + } + } + + return CMD_OK; +} + +static int cmd_run(char *num) +{ + static uint32_t pass, fail; + bool has_limit = true; + int pkts = 0, i = 0; + + if (!bpf_prog_loaded() || !pcap_loaded()) + return CMD_ERR; + + pkts = strtol(num, NULL, 10); + if (pkts == 0 || strlen(num) == 0) + has_limit = false; + + do { + struct pcap_pkthdr *hdr = pcap_curr_pkt(); + int ret = bpf_run_all(bpf_image, bpf_prog_len, + (uint8_t *) hdr + sizeof(*hdr), + hdr->caplen, hdr->len); + if (ret > 0) + pass++; + else if (ret == 0) + fail++; + else + return CMD_OK; + bpf_reset(); + } while (pcap_next_pkt() && (!has_limit || (has_limit && ++i < pkts))); + + rl_printf("bpf passes:%u fails:%u\n", pass, fail); + + pcap_reset_pkt(); + bpf_reset(); + + pass = fail = 0; + return CMD_OK; +} + +static int cmd_disassemble(char *line_string) +{ + bool single_line = false; + unsigned long line; + + if (!bpf_prog_loaded()) + return CMD_ERR; + if (strlen(line_string) > 0 && + (line = strtoul(line_string, NULL, 10)) < bpf_prog_len) + single_line = true; + if (single_line) + bpf_disasm(bpf_image[line], line); + else + bpf_disasm_all(bpf_image, bpf_prog_len); + + return CMD_OK; +} + +static int cmd_dump(char *dontcare) +{ + if (!bpf_prog_loaded()) + return CMD_ERR; + + bpf_dump_all(bpf_image, bpf_prog_len); + + return CMD_OK; +} + +static int cmd_quit(char *dontcare) +{ + return CMD_EX; +} + +static const struct shell_cmd cmds[] = { + { .name = "load", .func = cmd_load }, + { .name = "select", .func = cmd_select }, + { .name = "step", .func = cmd_step }, + { .name = "run", .func = cmd_run }, + { .name = "breakpoint", .func = cmd_breakpoint }, + { .name = "disassemble", .func = cmd_disassemble }, + { .name = "dump", .func = cmd_dump }, + { .name = "quit", .func = cmd_quit }, +}; + +static int execf(char *arg) +{ + char *cmd, *cont, *tmp = strdup(arg); + int i, ret = 0, len; + + cmd = strtok_r(tmp, " ", &cont); + if (cmd == NULL) + goto out; + len = strlen(cmd); + for (i = 0; i < array_size(cmds); i++) { + if (len != strlen(cmds[i].name)) + continue; + if (strncmp(cmds[i].name, cmd, len) == 0) { + ret = cmds[i].func(cont); + break; + } + } +out: + free(tmp); + return ret; +} + +static char *shell_comp_gen(const char *buf, int state) +{ + static int list_index, len; + + if (!state) { + list_index = 0; + len = strlen(buf); + } + + for (; list_index < array_size(cmds); ) { + const char *name = cmds[list_index].name; + + list_index++; + if (strncmp(name, buf, len) == 0) + return strdup(name); + } + + return NULL; +} + +static char **shell_completion(const char *buf, int start, int end) +{ + char **matches = NULL; + + if (start == 0) + matches = rl_completion_matches(buf, shell_comp_gen); + + return matches; +} + +static void intr_shell(int sig) +{ + if (rl_end) + rl_kill_line(-1, 0); + + rl_crlf(); + rl_refresh_line(0, 0); + rl_free_line_state(); +} + +static void init_shell(FILE *fin, FILE *fout) +{ + char file[128]; + + snprintf(file, sizeof(file), "%s/.bpf_dbg_history", getenv("HOME")); + read_history(file); + + rl_instream = fin; + rl_outstream = fout; + + rl_readline_name = "bpf_dbg"; + rl_terminal_name = getenv("TERM"); + + rl_catch_signals = 0; + rl_catch_sigwinch = 1; + + rl_attempted_completion_function = shell_completion; + + rl_bind_key('\t', rl_complete); + + rl_bind_key_in_map('\t', rl_complete, emacs_meta_keymap); + rl_bind_key_in_map('\033', rl_complete, emacs_meta_keymap); + + snprintf(file, sizeof(file), "%s/.bpf_dbg_init", getenv("HOME")); + rl_read_init_file(file); + + rl_prep_terminal(0); + rl_set_signals(); + + signal(SIGINT, intr_shell); +} + +static void exit_shell(FILE *fin, FILE *fout) +{ + char file[128]; + + snprintf(file, sizeof(file), "%s/.bpf_dbg_history", getenv("HOME")); + write_history(file); + + clear_history(); + rl_deprep_terminal(); + + try_close_pcap(); + + if (fin != stdin) + fclose(fin); + if (fout != stdout) + fclose(fout); +} + +static int run_shell_loop(FILE *fin, FILE *fout) +{ + char *buf; + + init_shell(fin, fout); + + while ((buf = readline("> ")) != NULL) { + int ret = execf(buf); + if (ret == CMD_EX) + break; + if (ret == CMD_OK && strlen(buf) > 0) + add_history(buf); + + free(buf); + } + + exit_shell(fin, fout); + return 0; +} + +int main(int argc, char **argv) +{ + FILE *fin = NULL, *fout = NULL; + + if (argc >= 2) + fin = fopen(argv[1], "r"); + if (argc >= 3) + fout = fopen(argv[2], "w"); + + return run_shell_loop(fin ? : stdin, fout ? : stdout); +} diff --git a/tools/bpf/bpf_exp.l b/tools/bpf/bpf_exp.l new file mode 100644 index 000000000..4da8d053d --- /dev/null +++ b/tools/bpf/bpf_exp.l @@ -0,0 +1,198 @@ +/* + * BPF asm code lexer + * + * This program is free software; you can distribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2 of the License, + * or (at your option) any later version. + * + * Syntax kept close to: + * + * Steven McCanne and Van Jacobson. 1993. The BSD packet filter: a new + * architecture for user-level packet capture. In Proceedings of the + * USENIX Winter 1993 Conference Proceedings on USENIX Winter 1993 + * Conference Proceedings (USENIX'93). USENIX Association, Berkeley, + * CA, USA, 2-2. + * + * Copyright 2013 Daniel Borkmann + * Licensed under the GNU General Public License, version 2.0 (GPLv2) + */ + +%{ + +#include +#include +#include +#include + +#include + +#include "bpf_exp.yacc.h" + +extern void yyerror(const char *str); + +%} + +%option align +%option ecs + +%option nounput +%option noreject +%option noinput +%option noyywrap + +%option 8bit +%option caseless +%option yylineno + +%% + +"ldb" { return OP_LDB; } +"ldh" { return OP_LDH; } +"ld" { return OP_LD; } +"ldi" { return OP_LDI; } +"ldx" { return OP_LDX; } +"ldxi" { return OP_LDXI; } +"ldxb" { return OP_LDXB; } +"st" { return OP_ST; } +"stx" { return OP_STX; } +"jmp" { return OP_JMP; } +"ja" { return OP_JMP; } +"jeq" { return OP_JEQ; } +"jneq" { return OP_JNEQ; } +"jne" { return OP_JNEQ; } +"jlt" { return OP_JLT; } +"jle" { return OP_JLE; } +"jgt" { return OP_JGT; } +"jge" { return OP_JGE; } +"jset" { return OP_JSET; } +"add" { return OP_ADD; } +"sub" { return OP_SUB; } +"mul" { return OP_MUL; } +"div" { return OP_DIV; } +"mod" { return OP_MOD; } +"neg" { return OP_NEG; } +"and" { return OP_AND; } +"xor" { return OP_XOR; } +"or" { return OP_OR; } +"lsh" { return OP_LSH; } +"rsh" { return OP_RSH; } +"ret" { return OP_RET; } +"tax" { return OP_TAX; } +"txa" { return OP_TXA; } + +"#"?("len") { return K_PKT_LEN; } + +"#"?("proto") { + yylval.number = SKF_AD_PROTOCOL; + return extension; + } +"#"?("type") { + yylval.number = SKF_AD_PKTTYPE; + return extension; + } +"#"?("poff") { + yylval.number = SKF_AD_PAY_OFFSET; + return extension; + } +"#"?("ifidx") { + yylval.number = SKF_AD_IFINDEX; + return extension; + } +"#"?("nla") { + yylval.number = SKF_AD_NLATTR; + return extension; + } +"#"?("nlan") { + yylval.number = SKF_AD_NLATTR_NEST; + return extension; + } +"#"?("mark") { + yylval.number = SKF_AD_MARK; + return extension; + } +"#"?("queue") { + yylval.number = SKF_AD_QUEUE; + return extension; + } +"#"?("hatype") { + yylval.number = SKF_AD_HATYPE; + return extension; + } +"#"?("rxhash") { + yylval.number = SKF_AD_RXHASH; + return extension; + } +"#"?("cpu") { + yylval.number = SKF_AD_CPU; + return extension; + } +"#"?("vlan_tci") { + yylval.number = SKF_AD_VLAN_TAG; + return extension; + } +"#"?("vlan_pr") { + yylval.number = SKF_AD_VLAN_TAG_PRESENT; + return extension; + } +"#"?("vlan_avail") { + yylval.number = SKF_AD_VLAN_TAG_PRESENT; + return extension; + } +"#"?("vlan_tpid") { + yylval.number = SKF_AD_VLAN_TPID; + return extension; + } +"#"?("rand") { + yylval.number = SKF_AD_RANDOM; + return extension; + } + +":" { return ':'; } +"," { return ','; } +"#" { return '#'; } +"%" { return '%'; } +"[" { return '['; } +"]" { return ']'; } +"(" { return '('; } +")" { return ')'; } +"x" { return 'x'; } +"a" { return 'a'; } +"+" { return '+'; } +"M" { return 'M'; } +"*" { return '*'; } +"&" { return '&'; } + +([0][x][a-fA-F0-9]+) { + yylval.number = strtoul(yytext, NULL, 16); + return number; + } +([0][b][0-1]+) { + yylval.number = strtol(yytext + 2, NULL, 2); + return number; + } +(([0])|([-+]?[1-9][0-9]*)) { + yylval.number = strtol(yytext, NULL, 10); + return number; + } +([0][0-7]+) { + yylval.number = strtol(yytext + 1, NULL, 8); + return number; + } +[a-zA-Z_][a-zA-Z0-9_]+ { + yylval.label = strdup(yytext); + return label; + } + +"/*"([^\*]|\*[^/])*"*/" { /* NOP */ } +";"[^\n]* { /* NOP */ } +^#.* { /* NOP */ } +[ \t]+ { /* NOP */ } +[ \n]+ { /* NOP */ } + +. { + printf("unknown character \'%s\'", yytext); + yyerror("lex unknown character"); + } + +%% diff --git a/tools/bpf/bpf_exp.y b/tools/bpf/bpf_exp.y new file mode 100644 index 000000000..56ba1de50 --- /dev/null +++ b/tools/bpf/bpf_exp.y @@ -0,0 +1,656 @@ +/* + * BPF asm code parser + * + * This program is free software; you can distribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2 of the License, + * or (at your option) any later version. + * + * Syntax kept close to: + * + * Steven McCanne and Van Jacobson. 1993. The BSD packet filter: a new + * architecture for user-level packet capture. In Proceedings of the + * USENIX Winter 1993 Conference Proceedings on USENIX Winter 1993 + * Conference Proceedings (USENIX'93). USENIX Association, Berkeley, + * CA, USA, 2-2. + * + * Copyright 2013 Daniel Borkmann + * Licensed under the GNU General Public License, version 2.0 (GPLv2) + */ + +%{ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "bpf_exp.yacc.h" + +enum jmp_type { JTL, JFL, JKL }; + +extern FILE *yyin; +extern int yylineno; +extern int yylex(void); +extern void yyerror(const char *str); + +extern void bpf_asm_compile(FILE *fp, bool cstyle); +static void bpf_set_curr_instr(uint16_t op, uint8_t jt, uint8_t jf, uint32_t k); +static void bpf_set_curr_label(char *label); +static void bpf_set_jmp_label(char *label, enum jmp_type type); + +%} + +%union { + char *label; + uint32_t number; +} + +%token OP_LDB OP_LDH OP_LD OP_LDX OP_ST OP_STX OP_JMP OP_JEQ OP_JGT OP_JGE +%token OP_JSET OP_ADD OP_SUB OP_MUL OP_DIV OP_AND OP_OR OP_XOR OP_LSH OP_RSH +%token OP_RET OP_TAX OP_TXA OP_LDXB OP_MOD OP_NEG OP_JNEQ OP_JLT OP_JLE OP_LDI +%token OP_LDXI + +%token K_PKT_LEN + +%token ':' ',' '[' ']' '(' ')' 'x' 'a' '+' 'M' '*' '&' '#' '%' + +%token extension number label + +%type