Hello community,

here is the log from the commit of package cpupower for openSUSE:Factory 
checked in at 2019-04-09 20:19:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/cpupower (Old)
 and      /work/SRC/openSUSE:Factory/.cpupower.new.3908 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "cpupower"

Tue Apr  9 20:19:00 2019 rev:39 rq:692551 version:5.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/cpupower/cpupower.changes        2018-12-07 
14:35:34.835057763 +0100
+++ /work/SRC/openSUSE:Factory/.cpupower.new.3908/cpupower.changes      
2019-04-09 20:19:01.801870574 +0200
@@ -1,0 +2,14 @@
+Mon Apr  8 14:12:34 UTC 2019 - tr...@suse.de
+
+- Update to latest kernel HEAD sources
+  (5.1-rc4, 15ade5d2e7775667cf191cf2f94327a4889f8b9d)
+Patches included mainline:
+D cpupower_fix_compilation_and_sysfs_read_file_mess.patch
+D cpupower_bash-completion_for_cpupower_tool.patch
+Adjusted patches:
+M turbostat_makefile_fix_asm_header.patch
+M x86_perf_makefile_fix_asm_header.patch
+M rapl_monitor.patch
+M cpupower_rapl.patch
+
+-------------------------------------------------------------------

Old:
----
  cpupower-4.19.tar.bz2
  cpupower_bash-completion_for_cpupower_tool.patch
  cpupower_fix_compilation_and_sysfs_read_file_mess.patch
  turbostat-18.07.27.tar.bz2

New:
----
  cpupower-5.1.tar.bz2
  turbostat-19.03.20.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ cpupower.spec ++++++
--- /var/tmp/diff_new_pack.e8sRKP/_old  2019-04-09 20:19:03.145872406 +0200
+++ /var/tmp/diff_new_pack.e8sRKP/_new  2019-04-09 20:19:03.149872411 +0200
@@ -1,7 +1,8 @@
 #
 # spec file for package cpupower
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Author: Thomas Renninger <tr...@suse.de>
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,11 +20,13 @@
 # Use this as version when things are in mainline kernel
 %define version %(rpm -q --qf '%{VERSION}' kernel-source)
 
-%define tsversion      18.07.27
+%define tsversion      19.03.20
 %define pbversion      17.05.11
 
 Name:           cpupower
-Version:        4.19
+# Use this as version when things are in mainline kernel
+%define version %(rpm -q --qf '%VERSION' kernel-source)
+Version:        5.1
 Release:        0
 Summary:        Tools to determine and set CPU Power related Settings
 License:        GPL-2.0-only
@@ -36,8 +39,6 @@
 Patch1:         cpupower_rapl.patch
 Patch2:         rapl_monitor.patch
 Patch3:         cpupower_exclude_kernel_Makefile.patch
-Patch4:         cpupower_fix_compilation_and_sysfs_read_file_mess.patch
-Patch5:         cpupower_bash-completion_for_cpupower_tool.patch
 Patch22:        turbostat_makefile_fix_asm_header.patch
 # Fixes bsc#1048546:
 Patch30:        x86_perf_makefile_fix_asm_header.patch
@@ -85,8 +86,6 @@
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
-%patch4 -p1
-%patch5 -p1
 
 cd ../turbostat-%{tsversion}
 %patch22 -p1

++++++ cpupower-4.19.tar.bz2 -> cpupower-5.1.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cpupower-4.19/Makefile new/cpupower-5.1/Makefile
--- old/cpupower-4.19/Makefile  2018-09-30 16:15:35.000000000 +0200
+++ new/cpupower-5.1/Makefile   2019-04-08 07:51:09.000000000 +0200
@@ -89,6 +89,7 @@
 localedir ?=   /usr/share/locale
 docdir ?=       /usr/share/doc/packages/cpupower
 confdir ?=      /etc/
+bash_completion_dir ?= /usr/share/bash-completion/completions
 
 # Toolchain: what tools do we use, and what options do they need:
 
@@ -96,7 +97,8 @@
 INSTALL = /usr/bin/install -c
 INSTALL_PROGRAM = ${INSTALL}
 INSTALL_DATA  = ${INSTALL} -m 644
-INSTALL_SCRIPT = ${INSTALL_PROGRAM}
+#bash completion scripts get sourced and so they should be rw only.
+INSTALL_SCRIPT = ${INSTALL} -m 644
 
 # If you are running a cross compiler, you may want to set this
 # to something more interesting, like "arm-linux-".  If you want
@@ -129,7 +131,7 @@
 WARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
 WARNINGS += -Wshadow
 
-CFLAGS += -DVERSION=\"$(VERSION)\" -DPACKAGE=\"$(PACKAGE)\" \
+override CFLAGS += -DVERSION=\"$(VERSION)\" -DPACKAGE=\"$(PACKAGE)\" \
                -DPACKAGE_BUGREPORT=\"$(PACKAGE_BUGREPORT)\" -D_GNU_SOURCE
 
 UTIL_OBJS =  utils/helpers/amd.o utils/helpers/msr.o \
@@ -156,12 +158,12 @@
 LIB_OBJS =     lib/cpufreq.o lib/cpupower.o lib/cpuidle.o
 LIB_OBJS :=    $(addprefix $(OUTPUT),$(LIB_OBJS))
 
-CFLAGS +=      -pipe
+override CFLAGS +=     -pipe
 
 ifeq ($(strip $(NLS)),true)
        INSTALL_NLS += install-gmo
        COMPILE_NLS += create-gmo
-       CFLAGS += -DNLS
+       override CFLAGS += -DNLS
 endif
 
 ifeq ($(strip $(CPUFREQ_BENCH)),true)
@@ -175,7 +177,7 @@
         UTIL_SRC += $(LIB_SRC)
 endif
 
-CFLAGS += $(WARNINGS)
+override CFLAGS += $(WARNINGS)
 
 ifeq ($(strip $(V)),false)
        QUIET=@
@@ -188,10 +190,10 @@
 
 # if DEBUG is enabled, then we do not strip or optimize
 ifeq ($(strip $(DEBUG)),true)
-       CFLAGS += -O1 -g -DDEBUG
+       override CFLAGS += -O1 -g -DDEBUG
        STRIPCMD = /bin/true -Since_we_are_debugging
 else
-       CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer
+       override CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer
        STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment
 endif
 
@@ -288,6 +290,8 @@
 install-tools:
        $(INSTALL) -d $(DESTDIR)${bindir}
        $(INSTALL_PROGRAM) $(OUTPUT)cpupower $(DESTDIR)${bindir}
+       $(INSTALL) -d $(DESTDIR)${bash_completion_dir}
+       $(INSTALL_SCRIPT) cpupower-completion.sh 
'$(DESTDIR)${bash_completion_dir}/cpupower'
 
 install-man:
        $(INSTALL_DATA) -D man/cpupower.1 $(DESTDIR)${mandir}/man1/cpupower.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cpupower-4.19/bench/Makefile 
new/cpupower-5.1/bench/Makefile
--- old/cpupower-4.19/bench/Makefile    2018-09-30 16:15:35.000000000 +0200
+++ new/cpupower-5.1/bench/Makefile     2019-04-08 07:51:09.000000000 +0200
@@ -9,7 +9,7 @@
 ifeq ($(strip $(STATIC)),true)
 LIBS = -L../ -L$(OUTPUT) -lm
 OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o 
\
-       $(OUTPUT)../lib/cpufreq.o $(OUTPUT)../lib/sysfs.o
+       $(OUTPUT)../lib/cpufreq.o $(OUTPUT)../lib/cpupower.o
 else
 LIBS = -L../ -L$(OUTPUT) -lm -lcpupower
 OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cpupower-4.19/bench/parse.c 
new/cpupower-5.1/bench/parse.c
--- old/cpupower-4.19/bench/parse.c     2018-09-30 16:15:35.000000000 +0200
+++ new/cpupower-5.1/bench/parse.c      2019-04-08 07:51:09.000000000 +0200
@@ -145,7 +145,7 @@
        config->cpu = 0;
        config->prio = SCHED_HIGH;
        config->verbose = 0;
-       strncpy(config->governor, "ondemand", 8);
+       strncpy(config->governor, "ondemand", sizeof(config->governor));
 
        config->output = stdout;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cpupower-4.19/cpupower-completion.sh 
new/cpupower-5.1/cpupower-completion.sh
--- old/cpupower-4.19/cpupower-completion.sh    1970-01-01 01:00:00.000000000 
+0100
+++ new/cpupower-5.1/cpupower-completion.sh     2019-04-08 07:51:09.000000000 
+0200
@@ -0,0 +1,128 @@
+# -*- shell-script -*-
+# bash completion script for cpupower
+# Taken from git.git's completion script.
+
+_cpupower_commands="frequency-info frequency-set idle-info idle-set set info 
monitor"
+
+_frequency_info ()
+{
+       local flags="-f -w -l -d -p -g -a -s -y -o -m -n --freq --hwfreq 
--hwlimits --driver --policy --governors --related-cpus --affected-cpus --stats 
--latency --proc --human --no-rounding"
+       local prev="${COMP_WORDS[COMP_CWORD-1]}"
+       local cur="${COMP_WORDS[COMP_CWORD]}"
+       case "$prev" in
+               frequency-info) COMPREPLY=($(compgen -W "$flags" -- "$cur")) ;;
+       esac
+}
+
+_frequency_set ()
+{
+       local flags="-f -g --freq --governor -d --min -u --max -r --related"
+       local prev="${COMP_WORDS[COMP_CWORD-1]}"
+       local cur="${COMP_WORDS[COMP_CWORD]}"
+       case "$prev" in
+               -f| --freq | -d | --min | -u | --max)
+               if [ -d /sys/devices/system/cpu/cpufreq/ ] ; then
+                       COMPREPLY=($(compgen -W '$(cat $(ls -d 
/sys/devices/system/cpu/cpufreq/policy* | head 
-1)/scaling_available_frequencies)' -- "$cur"))
+               fi ;;
+               -g| --governor)
+               if [ -d /sys/devices/system/cpu/cpufreq/ ] ; then
+                       COMPREPLY=($(compgen -W '$(cat $(ls -d 
/sys/devices/system/cpu/cpufreq/policy* | head 
-1)/scaling_available_governors)' -- "$cur"))
+               fi;;
+               frequency-set) COMPREPLY=($(compgen -W "$flags" -- "$cur")) ;;
+       esac
+}
+
+_idle_info()
+{
+       local flags="-f --silent"
+       local prev="${COMP_WORDS[COMP_CWORD-1]}"
+       local cur="${COMP_WORDS[COMP_CWORD]}"
+       case "$prev" in
+               idle-info) COMPREPLY=($(compgen -W "$flags" -- "$cur")) ;;
+       esac
+}
+
+_idle_set()
+{
+       local flags="-d --disable -e --enable -D --disable-by-latency -E 
--enable-all"
+       local prev="${COMP_WORDS[COMP_CWORD-1]}"
+       local cur="${COMP_WORDS[COMP_CWORD]}"
+       case "$prev" in
+               idle-set) COMPREPLY=($(compgen -W "$flags" -- "$cur")) ;;
+       esac
+}
+
+_set()
+{
+       local flags="--perf-bias, -b"
+       local prev="${COMP_WORDS[COMP_CWORD-1]}"
+       local cur="${COMP_WORDS[COMP_CWORD]}"
+       case "$prev" in
+               set) COMPREPLY=($(compgen -W "$flags" -- "$cur")) ;;
+       esac
+}
+
+_monitor()
+{
+       local flags="-l -m -i -c -v"
+       local prev="${COMP_WORDS[COMP_CWORD-1]}"
+       local cur="${COMP_WORDS[COMP_CWORD]}"
+       case "$prev" in
+               monitor) COMPREPLY=($(compgen -W "$flags" -- "$cur")) ;;
+       esac
+}
+
+_taskset()
+{
+       local prev_to_prev="${COMP_WORDS[COMP_CWORD-2]}"
+       local prev="${COMP_WORDS[COMP_CWORD-1]}"
+       local cur="${COMP_WORDS[COMP_CWORD]}"
+       case "$prev_to_prev" in
+               -c|--cpu) COMPREPLY=($(compgen -W "$_cpupower_commands" -- 
"$cur")) ;;
+       esac
+       case "$prev" in
+               frequency-info) _frequency_info ;;
+               frequency-set) _frequency_set ;;
+               idle-info) _idle_info ;;
+               idle-set) _idle_set ;;
+               set) _set ;;
+               monitor) _monitor ;;
+       esac
+
+}
+
+_cpupower ()
+{
+       local i
+       local c=1
+       local command
+
+       while test $c -lt $COMP_CWORD; do
+               if test $c == 1; then
+                       command="${COMP_WORDS[c]}"
+               fi
+               c=$((++c))
+       done
+
+       # Complete name of subcommand if the user has not finished typing it 
yet.
+       if test $c -eq $COMP_CWORD -a -z "$command"; then
+               COMPREPLY=($(compgen -W "help -v --version -c --cpu 
$_cpupower_commands" -- "${COMP_WORDS[COMP_CWORD]}"))
+               return
+       fi
+
+       # Complete arguments to subcommands.
+       case "$command" in
+               -v|--version) return ;;
+               -c|--cpu) _taskset ;;
+               help) COMPREPLY=($(compgen -W "$_cpupower_commands" -- 
"${COMP_WORDS[COMP_CWORD]}")) ;;
+               frequency-info) _frequency_info ;;
+               frequency-set) _frequency_set ;;
+               idle-info) _idle_info ;;
+               idle-set) _idle_set ;;
+               set) _set ;;
+               monitor) _monitor ;;
+       esac
+}
+
+complete -o bashdefault -o default -F _cpupower cpupower 2>/dev/null \
+    || complete -o default -F _cpupower cpupower
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cpupower-4.19/debug/x86_64/Makefile 
new/cpupower-5.1/debug/x86_64/Makefile
--- old/cpupower-4.19/debug/x86_64/Makefile     2018-09-30 16:15:35.000000000 
+0200
+++ new/cpupower-5.1/debug/x86_64/Makefile      2019-04-08 07:51:09.000000000 
+0200
@@ -13,10 +13,10 @@
 default: all
 
 $(OUTPUT)centrino-decode: ../i386/centrino-decode.c
-       $(CC) $(CFLAGS) -o $@ $<
+       $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $<
 
 $(OUTPUT)powernow-k8-decode: ../i386/powernow-k8-decode.c
-       $(CC) $(CFLAGS) -o $@ $<
+       $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $<
 
 all: $(OUTPUT)centrino-decode $(OUTPUT)powernow-k8-decode
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cpupower-4.19/lib/cpufreq.c 
new/cpupower-5.1/lib/cpufreq.c
--- old/cpupower-4.19/lib/cpufreq.c     2018-09-30 16:15:35.000000000 +0200
+++ new/cpupower-5.1/lib/cpufreq.c      2019-04-08 07:51:09.000000000 +0200
@@ -28,7 +28,7 @@
 
        snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/cpufreq/%s",
                         cpu, fname);
-       return sysfs_read_file(path, buf, buflen);
+       return cpupower_read_sysfs(path, buf, buflen);
 }
 
 /* helper function to write a new value to a /sys file */
@@ -333,17 +333,20 @@
 }
 
 
-struct cpufreq_available_frequencies
-*cpufreq_get_available_frequencies(unsigned int cpu)
+struct cpufreq_frequencies
+*cpufreq_get_frequencies(const char *type, unsigned int cpu)
 {
-       struct cpufreq_available_frequencies *first = NULL;
-       struct cpufreq_available_frequencies *current = NULL;
+       struct cpufreq_frequencies *first = NULL;
+       struct cpufreq_frequencies *current = NULL;
        char one_value[SYSFS_PATH_MAX];
        char linebuf[MAX_LINE_LEN];
+       char fname[MAX_LINE_LEN];
        unsigned int pos, i;
        unsigned int len;
 
-       len = sysfs_cpufreq_read_file(cpu, "scaling_available_frequencies",
+       snprintf(fname, MAX_LINE_LEN, "scaling_%s_frequencies", type);
+
+       len = sysfs_cpufreq_read_file(cpu, fname,
                                linebuf, sizeof(linebuf));
        if (len == 0)
                return NULL;
@@ -389,9 +392,9 @@
        return NULL;
 }
 
-void cpufreq_put_available_frequencies(struct cpufreq_available_frequencies
-                               *any) {
-       struct cpufreq_available_frequencies *tmp, *next;
+void cpufreq_put_frequencies(struct cpufreq_frequencies *any)
+{
+       struct cpufreq_frequencies *tmp, *next;
 
        if (!any)
                return;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cpupower-4.19/lib/cpufreq.h 
new/cpupower-5.1/lib/cpufreq.h
--- old/cpupower-4.19/lib/cpufreq.h     2018-09-30 16:15:35.000000000 +0200
+++ new/cpupower-5.1/lib/cpufreq.h      2019-04-08 07:51:09.000000000 +0200
@@ -28,10 +28,10 @@
        struct cpufreq_available_governors *first;
 };
 
-struct cpufreq_available_frequencies {
+struct cpufreq_frequencies {
        unsigned long frequency;
-       struct cpufreq_available_frequencies *next;
-       struct cpufreq_available_frequencies *first;
+       struct cpufreq_frequencies *next;
+       struct cpufreq_frequencies *first;
 };
 
 
@@ -129,14 +129,14 @@
  *
  * Only present on _some_ ->target() cpufreq drivers. For information purposes
  * only. Please free allocated memory by calling
- * cpufreq_put_available_frequencies after use.
+ * cpufreq_put_frequencies after use.
  */
 
-struct cpufreq_available_frequencies
-*cpufreq_get_available_frequencies(unsigned int cpu);
+struct cpufreq_frequencies
+*cpufreq_get_frequencies(const char *type, unsigned int cpu);
 
-void cpufreq_put_available_frequencies(
-               struct cpufreq_available_frequencies *first);
+void cpufreq_put_frequencies(
+               struct cpufreq_frequencies *first);
 
 
 /* determine affected CPUs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cpupower-4.19/lib/cpuidle.c 
new/cpupower-5.1/lib/cpuidle.c
--- old/cpupower-4.19/lib/cpuidle.c     2018-09-30 16:15:35.000000000 +0200
+++ new/cpupower-5.1/lib/cpuidle.c      2019-04-08 07:51:09.000000000 +0200
@@ -319,7 +319,7 @@
 
        snprintf(path, sizeof(path), PATH_TO_CPU "cpuidle/%s", fname);
 
-       return sysfs_read_file(path, buf, buflen);
+       return cpupower_read_sysfs(path, buf, buflen);
 }
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cpupower-4.19/lib/cpupower.c 
new/cpupower-5.1/lib/cpupower.c
--- old/cpupower-4.19/lib/cpupower.c    2018-09-30 16:15:35.000000000 +0200
+++ new/cpupower-5.1/lib/cpupower.c     2019-04-08 07:51:09.000000000 +0200
@@ -15,7 +15,7 @@
 #include "cpupower.h"
 #include "cpupower_intern.h"
 
-unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen)
+unsigned int cpupower_read_sysfs(const char *path, char *buf, size_t buflen)
 {
        int fd;
        ssize_t numread;
@@ -95,7 +95,7 @@
 
        snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/topology/%s",
                         cpu, fname);
-       if (sysfs_read_file(path, linebuf, MAX_LINE_LEN) == 0)
+       if (cpupower_read_sysfs(path, linebuf, MAX_LINE_LEN) == 0)
                return -1;
        *result = strtol(linebuf, &endp, 0);
        if (endp == linebuf || errno == ERANGE)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cpupower-4.19/lib/cpupower_intern.h 
new/cpupower-5.1/lib/cpupower_intern.h
--- old/cpupower-4.19/lib/cpupower_intern.h     2018-09-30 16:15:35.000000000 
+0200
+++ new/cpupower-5.1/lib/cpupower_intern.h      2019-04-08 07:51:09.000000000 
+0200
@@ -3,4 +3,4 @@
 #define MAX_LINE_LEN 4096
 #define SYSFS_PATH_MAX 255
 
-unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen);
+unsigned int cpupower_read_sysfs(const char *path, char *buf, size_t buflen);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cpupower-4.19/utils/cpufreq-info.c 
new/cpupower-5.1/utils/cpufreq-info.c
--- old/cpupower-4.19/utils/cpufreq-info.c      2018-09-30 16:15:35.000000000 
+0200
+++ new/cpupower-5.1/utils/cpufreq-info.c       2019-04-08 07:51:09.000000000 
+0200
@@ -161,18 +161,12 @@
        return;
 }
 
-/* --boost / -b */
-
-static int get_boost_mode(unsigned int cpu)
+static int get_boost_mode_x86(unsigned int cpu)
 {
        int support, active, b_states = 0, ret, pstate_no, i;
        /* ToDo: Make this more global */
        unsigned long pstates[MAX_HW_PSTATES] = {0,};
 
-       if (cpupower_cpu_info.vendor != X86_VENDOR_AMD &&
-           cpupower_cpu_info.vendor != X86_VENDOR_INTEL)
-               return 0;
-
        ret = cpufreq_has_boost_support(cpu, &support, &active, &b_states);
        if (ret) {
                printf(_("Error while evaluating Boost Capabilities"
@@ -190,8 +184,9 @@
        printf(_("    Supported: %s\n"), support ? _("yes") : _("no"));
        printf(_("    Active: %s\n"), active ? _("yes") : _("no"));
 
-       if (cpupower_cpu_info.vendor == X86_VENDOR_AMD &&
-           cpupower_cpu_info.family >= 0x10) {
+       if ((cpupower_cpu_info.vendor == X86_VENDOR_AMD &&
+            cpupower_cpu_info.family >= 0x10) ||
+            cpupower_cpu_info.vendor == X86_VENDOR_HYGON) {
                ret = decode_pstates(cpu, cpupower_cpu_info.family, b_states,
                                     pstates, &pstate_no);
                if (ret)
@@ -200,6 +195,8 @@
                printf(_("    Boost States: %d\n"), b_states);
                printf(_("    Total States: %d\n"), pstate_no);
                for (i = 0; i < pstate_no; i++) {
+                       if (!pstates[i])
+                               continue;
                        if (i < b_states)
                                printf(_("    Pstate-Pb%d: %luMHz (boost state)"
                                         "\n"), i, pstates[i]);
@@ -244,6 +241,33 @@
        return 0;
 }
 
+/* --boost / -b */
+
+static int get_boost_mode(unsigned int cpu)
+{
+       struct cpufreq_frequencies *freqs;
+
+       if (cpupower_cpu_info.vendor == X86_VENDOR_AMD ||
+           cpupower_cpu_info.vendor == X86_VENDOR_HYGON ||
+           cpupower_cpu_info.vendor == X86_VENDOR_INTEL)
+               return get_boost_mode_x86(cpu);
+
+       freqs = cpufreq_get_frequencies("boost", cpu);
+       if (freqs) {
+               printf(_("  boost frequency steps: "));
+               while (freqs->next) {
+                       print_speed(freqs->frequency);
+                       printf(", ");
+                       freqs = freqs->next;
+               }
+               print_speed(freqs->frequency);
+               printf("\n");
+               cpufreq_put_frequencies(freqs);
+       }
+
+       return 0;
+}
+
 /* --freq / -f */
 
 static int get_freq_kernel(unsigned int cpu, unsigned int human)
@@ -452,7 +476,7 @@
 
 static void debug_output_one(unsigned int cpu)
 {
-       struct cpufreq_available_frequencies *freqs;
+       struct cpufreq_frequencies *freqs;
 
        get_driver(cpu);
        get_related_cpus(cpu);
@@ -460,7 +484,7 @@
        get_latency(cpu, 1);
        get_hardware_limits(cpu, 1);
 
-       freqs = cpufreq_get_available_frequencies(cpu);
+       freqs = cpufreq_get_frequencies("available", cpu);
        if (freqs) {
                printf(_("  available frequency steps:  "));
                while (freqs->next) {
@@ -470,7 +494,7 @@
                }
                print_speed(freqs->frequency);
                printf("\n");
-               cpufreq_put_available_frequencies(freqs);
+               cpufreq_put_frequencies(freqs);
        }
 
        get_available_governors(cpu);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cpupower-4.19/utils/helpers/amd.c 
new/cpupower-5.1/utils/helpers/amd.c
--- old/cpupower-4.19/utils/helpers/amd.c       2018-09-30 16:15:35.000000000 
+0200
+++ new/cpupower-5.1/utils/helpers/amd.c        2019-04-08 07:51:09.000000000 
+0200
@@ -33,7 +33,7 @@
                unsigned vid:8;
                unsigned iddval:8;
                unsigned idddiv:2;
-               unsigned res1:30;
+               unsigned res1:31;
                unsigned en:1;
        } fam17h_bits;
        unsigned long long val;
@@ -45,7 +45,7 @@
 
        if (family == 0x12)
                t = pstate.val & 0xf;
-       else if (family == 0x17)
+       else if (family == 0x17 || family == 0x18)
                t = pstate.fam17h_bits.did;
        else
                t = pstate.bits.did;
@@ -59,7 +59,7 @@
        int fid, did, cof;
 
        did = get_did(family, pstate);
-       if (family == 0x17) {
+       if (family == 0x17 || family == 0x18) {
                fid = pstate.fam17h_bits.fid;
                cof = 200 * fid / did;
        } else {
@@ -119,6 +119,11 @@
                }
                if (read_msr(cpu, MSR_AMD_PSTATE + i, &pstate.val))
                        return -1;
+               if ((cpu_family == 0x17) && (!pstate.fam17h_bits.en))
+                       continue;
+               else if (!pstate.bits.en)
+                       continue;
+
                pstates[i] = get_cof(cpu_family, pstate);
        }
        *no = i;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cpupower-4.19/utils/helpers/cpuid.c 
new/cpupower-5.1/utils/helpers/cpuid.c
--- old/cpupower-4.19/utils/helpers/cpuid.c     2018-09-30 16:15:35.000000000 
+0200
+++ new/cpupower-5.1/utils/helpers/cpuid.c      2019-04-08 07:51:09.000000000 
+0200
@@ -8,7 +8,7 @@
 #include "helpers/helpers.h"
 
 static const char *cpu_vendor_table[X86_VENDOR_MAX] = {
-       "Unknown", "GenuineIntel", "AuthenticAMD",
+       "Unknown", "GenuineIntel", "AuthenticAMD", "HygonGenuine",
 };
 
 #if defined(__i386__) || defined(__x86_64__)
@@ -109,6 +109,7 @@
        fclose(fp);
        /* Get some useful CPU capabilities from cpuid */
        if (cpu_info->vendor != X86_VENDOR_AMD &&
+           cpu_info->vendor != X86_VENDOR_HYGON &&
            cpu_info->vendor != X86_VENDOR_INTEL)
                return ret;
 
@@ -124,8 +125,9 @@
        if (cpuid_level >= 6 && (cpuid_ecx(6) & 0x1))
                cpu_info->caps |= CPUPOWER_CAP_APERF;
 
-       /* AMD Boost state enable/disable register */
-       if (cpu_info->vendor == X86_VENDOR_AMD) {
+       /* AMD or Hygon Boost state enable/disable register */
+       if (cpu_info->vendor == X86_VENDOR_AMD ||
+           cpu_info->vendor == X86_VENDOR_HYGON) {
                if (ext_cpuid_level >= 0x80000007 &&
                    (cpuid_edx(0x80000007) & (1 << 9)))
                        cpu_info->caps |= CPUPOWER_CAP_AMD_CBP;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cpupower-4.19/utils/helpers/helpers.h 
new/cpupower-5.1/utils/helpers/helpers.h
--- old/cpupower-4.19/utils/helpers/helpers.h   2018-09-30 16:15:35.000000000 
+0200
+++ new/cpupower-5.1/utils/helpers/helpers.h    2019-04-08 07:51:09.000000000 
+0200
@@ -61,7 +61,7 @@
 
 /* cpuid and cpuinfo helpers  **************************/
 enum cpupower_cpu_vendor {X86_VENDOR_UNKNOWN = 0, X86_VENDOR_INTEL,
-                         X86_VENDOR_AMD, X86_VENDOR_MAX};
+                         X86_VENDOR_AMD, X86_VENDOR_HYGON, X86_VENDOR_MAX};
 
 #define CPUPOWER_CAP_INV_TSC           0x00000001
 #define CPUPOWER_CAP_APERF             0x00000002
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cpupower-4.19/utils/helpers/misc.c 
new/cpupower-5.1/utils/helpers/misc.c
--- old/cpupower-4.19/utils/helpers/misc.c      2018-09-30 16:15:35.000000000 
+0200
+++ new/cpupower-5.1/utils/helpers/misc.c       2019-04-08 07:51:09.000000000 
+0200
@@ -26,7 +26,7 @@
                 * has Hardware determined variable increments instead.
                 */
 
-               if (cpu_info.family == 0x17) {
+               if (cpu_info.family == 0x17 || cpu_info.family == 0x18) {
                        if (!read_msr(cpu, MSR_AMD_HWCR, &val)) {
                                if (!(val & CPUPOWER_AMD_CPBDIS))
                                        *active = 1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cpupower-4.19/utils/idle_monitor/mperf_monitor.c 
new/cpupower-5.1/utils/idle_monitor/mperf_monitor.c
--- old/cpupower-4.19/utils/idle_monitor/mperf_monitor.c        2018-09-30 
16:15:35.000000000 +0200
+++ new/cpupower-5.1/utils/idle_monitor/mperf_monitor.c 2019-04-08 
07:51:09.000000000 +0200
@@ -241,7 +241,8 @@
        if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_INV_TSC))
                goto use_sysfs;
 
-       if (cpupower_cpu_info.vendor == X86_VENDOR_AMD) {
+       if (cpupower_cpu_info.vendor == X86_VENDOR_AMD ||
+           cpupower_cpu_info.vendor == X86_VENDOR_HYGON) {
                /* MSR_AMD_HWCR tells us whether TSC runs at P0/mperf
                 * freq.
                 * A test whether hwcr is accessable/available would be:

++++++ cpupower_rapl.patch ++++++
--- /var/tmp/diff_new_pack.e8sRKP/_old  2019-04-09 20:19:03.281872591 +0200
+++ /var/tmp/diff_new_pack.e8sRKP/_new  2019-04-09 20:19:03.281872591 +0200
@@ -25,11 +25,11 @@
 
 Signed-off-by: Thomas Renninger <tr...@suse.com>
 
-Index: cpupower-4.15/Makefile
+Index: cpupower-5.1/Makefile
 ===================================================================
---- cpupower-4.15.orig/Makefile        2018-01-10 20:18:31.000000000 +0100
-+++ cpupower-4.15/Makefile     2018-01-11 16:49:11.946784841 +0100
-@@ -141,7 +141,7 @@ UTIL_OBJS =  utils/helpers/amd.o utils/h
+--- cpupower-5.1.orig/Makefile 2019-04-08 07:51:09.000000000 +0200
++++ cpupower-5.1/Makefile      2019-04-08 16:04:14.350451358 +0200
+@@ -143,7 +143,7 @@ UTIL_OBJS =  utils/helpers/amd.o utils/h
        utils/idle_monitor/mperf_monitor.o 
utils/idle_monitor/cpupower-monitor.o \
        utils/cpupower.o utils/cpufreq-info.o utils/cpufreq-set.o \
        utils/cpupower-set.o utils/cpupower-info.o utils/cpuidle-info.o \
@@ -38,7 +38,7 @@
  
  UTIL_SRC := $(UTIL_OBJS:.o=.c)
  
-@@ -151,9 +151,9 @@ UTIL_HEADERS = utils/helpers/helpers.h u
+@@ -153,9 +153,9 @@ UTIL_HEADERS = utils/helpers/helpers.h u
        utils/helpers/bitmask.h \
        utils/idle_monitor/idle_monitors.h utils/idle_monitor/idle_monitors.def
  
@@ -50,8 +50,8 @@
 +LIB_OBJS =    lib/cpufreq.o lib/cpupower.o lib/cpuidle.o lib/powercap.o
  LIB_OBJS :=   $(addprefix $(OUTPUT),$(LIB_OBJS))
  
- CFLAGS +=     -pipe
-@@ -284,6 +284,7 @@ install-lib:
+ override CFLAGS +=    -pipe
+@@ -286,6 +286,7 @@ install-lib:
        $(INSTALL) -d $(DESTDIR)${includedir}
        $(INSTALL_DATA) lib/cpufreq.h $(DESTDIR)${includedir}/cpufreq.h
        $(INSTALL_DATA) lib/cpuidle.h $(DESTDIR)${includedir}/cpuidle.h
@@ -59,7 +59,7 @@
  
  install-tools:
        $(INSTALL) -d $(DESTDIR)${bindir}
-@@ -298,6 +299,7 @@ install-man:
+@@ -302,6 +303,7 @@ install-man:
        $(INSTALL_DATA) -D man/cpupower-set.1 
$(DESTDIR)${mandir}/man1/cpupower-set.1
        $(INSTALL_DATA) -D man/cpupower-info.1 
$(DESTDIR)${mandir}/man1/cpupower-info.1
        $(INSTALL_DATA) -D man/cpupower-monitor.1 
$(DESTDIR)${mandir}/man1/cpupower-monitor.1
@@ -67,7 +67,7 @@
  
  install-gmo:
        $(INSTALL) -d $(DESTDIR)${localedir}
-@@ -327,6 +329,7 @@ uninstall:
+@@ -331,6 +333,7 @@ uninstall:
        - rm -f $(DESTDIR)${mandir}/man1/cpupower-set.1
        - rm -f $(DESTDIR)${mandir}/man1/cpupower-info.1
        - rm -f $(DESTDIR)${mandir}/man1/cpupower-monitor.1
@@ -75,10 +75,10 @@
        - for HLANG in $(LANGUAGES); do \
                rm -f $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupower.mo; \
          done;
-Index: cpupower-4.15/lib/powercap.c
+Index: cpupower-5.1/lib/powercap.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ cpupower-4.15/lib/powercap.c       2018-01-11 16:49:11.950785082 +0100
++++ cpupower-5.1/lib/powercap.c        2019-04-08 16:04:14.350451358 +0200
 @@ -0,0 +1,290 @@
 +/*
 + *  (C) 2016       Thomas Renninger <tr...@suse.com>
@@ -370,10 +370,10 @@
 +      }
 +      return 0;
 +}
-Index: cpupower-4.15/lib/powercap.h
+Index: cpupower-5.1/lib/powercap.h
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ cpupower-4.15/lib/powercap.h       2018-01-11 16:49:11.950785082 +0100
++++ cpupower-5.1/lib/powercap.h        2019-04-08 16:04:14.350451358 +0200
 @@ -0,0 +1,54 @@
 +/*
 + *  (C) 2016       Thomas Renninger <tr...@suse.com>
@@ -429,10 +429,10 @@
 +
 +
 +#endif /* __CPUPOWER_RAPL_H__ */
-Index: cpupower-4.15/utils/builtin.h
+Index: cpupower-5.1/utils/builtin.h
 ===================================================================
---- cpupower-4.15.orig/utils/builtin.h 2018-01-10 20:18:31.000000000 +0100
-+++ cpupower-4.15/utils/builtin.h      2018-01-11 16:49:11.950785082 +0100
+--- cpupower-5.1.orig/utils/builtin.h  2019-04-08 07:51:09.000000000 +0200
++++ cpupower-5.1/utils/builtin.h       2019-04-08 16:04:14.350451358 +0200
 @@ -8,6 +8,8 @@ extern int cmd_freq_set(int argc, const
  extern int cmd_freq_info(int argc, const char **argv);
  extern int cmd_idle_set(int argc, const char **argv);
@@ -442,10 +442,10 @@
  extern int cmd_monitor(int argc, const char **argv);
  
  #endif
-Index: cpupower-4.15/utils/cpupower.c
+Index: cpupower-5.1/utils/cpupower.c
 ===================================================================
---- cpupower-4.15.orig/utils/cpupower.c        2018-01-10 20:18:31.000000000 
+0100
-+++ cpupower-4.15/utils/cpupower.c     2018-01-11 16:49:11.954785323 +0100
+--- cpupower-5.1.orig/utils/cpupower.c 2019-04-08 07:51:09.000000000 +0200
++++ cpupower-5.1/utils/cpupower.c      2019-04-08 16:04:14.354451358 +0200
 @@ -53,6 +53,7 @@ static struct cmd_struct commands[] = {
        { "frequency-set",      cmd_freq_set,   1       },
        { "idle-info",          cmd_idle_info,  0       },
@@ -454,10 +454,10 @@
        { "set",                cmd_set,        1       },
        { "info",               cmd_info,       0       },
        { "monitor",            cmd_monitor,    0       },
-Index: cpupower-4.15/utils/powercap-info.c
+Index: cpupower-5.1/utils/powercap-info.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ cpupower-4.15/utils/powercap-info.c        2018-01-11 16:49:11.954785323 
+0100
++++ cpupower-5.1/utils/powercap-info.c 2019-04-08 16:04:14.354451358 +0200
 @@ -0,0 +1,113 @@
 +#include <unistd.h>
 +#include <stdio.h>
@@ -572,10 +572,10 @@
 +      powercap_show();
 +      return 0;
 +}
-Index: cpupower-4.15/utils/helpers/sysfs.c
+Index: cpupower-5.1/utils/helpers/sysfs.c
 ===================================================================
---- cpupower-4.15.orig/utils/helpers/sysfs.c   2018-01-10 20:18:31.000000000 
+0100
-+++ cpupower-4.15/utils/helpers/sysfs.c        2018-01-11 16:49:11.954785323 
+0100
+--- cpupower-5.1.orig/utils/helpers/sysfs.c    2019-04-08 07:51:09.000000000 
+0200
++++ cpupower-5.1/utils/helpers/sysfs.c 2019-04-08 16:04:14.354451358 +0200
 @@ -18,7 +18,7 @@
  
  unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen)
@@ -602,10 +602,10 @@
        buf[numread] = '\0';
        close(fd);
  
-Index: cpupower-4.15/man/cpupower-powercap-info.1
+Index: cpupower-5.1/man/cpupower-powercap-info.1
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ cpupower-4.15/man/cpupower-powercap-info.1 2018-01-11 16:49:11.958785565 
+0100
++++ cpupower-5.1/man/cpupower-powercap-info.1  2019-04-08 16:04:14.354451358 
+0200
 @@ -0,0 +1,25 @@
 +.TH CPUPOWER\-POWERCAP\-INFO "1" "05/08/2016" "" "cpupower Manual"
 +.SH NAME

++++++ rapl_monitor.patch ++++++
--- /var/tmp/diff_new_pack.e8sRKP/_old  2019-04-09 20:19:03.289872602 +0200
+++ /var/tmp/diff_new_pack.e8sRKP/_new  2019-04-09 20:19:03.289872602 +0200
@@ -3,11 +3,11 @@
 
 Signed-off-by: Thomas Renninger <tr...@suse.com>
 
-Index: cpupower-4.19/Makefile
+Index: cpupower-5.1/Makefile
 ===================================================================
---- cpupower-4.19.orig/Makefile        2018-10-16 14:27:01.046284334 +0200
-+++ cpupower-4.19/Makefile     2018-10-16 14:27:13.675001106 +0200
-@@ -139,6 +139,7 @@ UTIL_OBJS =  utils/helpers/amd.o utils/h
+--- cpupower-5.1.orig/Makefile 2019-04-08 16:06:58.426460199 +0200
++++ cpupower-5.1/Makefile      2019-04-08 16:06:59.902460279 +0200
+@@ -141,6 +141,7 @@ UTIL_OBJS =  utils/helpers/amd.o utils/h
        utils/idle_monitor/hsw_ext_idle.o \
        utils/idle_monitor/amd_fam14h_idle.o utils/idle_monitor/cpuidle_sysfs.o 
\
        utils/idle_monitor/mperf_monitor.o 
utils/idle_monitor/cpupower-monitor.o \
@@ -15,10 +15,10 @@
        utils/cpupower.o utils/cpufreq-info.o utils/cpufreq-set.o \
        utils/cpupower-set.o utils/cpupower-info.o utils/cpuidle-info.o \
        utils/cpuidle-set.o utils/powercap-info.o
-Index: cpupower-4.19/utils/idle_monitor/cpupower-monitor.c
+Index: cpupower-5.1/utils/idle_monitor/cpupower-monitor.c
 ===================================================================
---- cpupower-4.19.orig/utils/idle_monitor/cpupower-monitor.c   2018-09-30 
16:15:35.000000000 +0200
-+++ cpupower-4.19/utils/idle_monitor/cpupower-monitor.c        2018-10-16 
14:27:01.070285696 +0200
+--- cpupower-5.1.orig/utils/idle_monitor/cpupower-monitor.c    2019-04-08 
07:51:09.000000000 +0200
++++ cpupower-5.1/utils/idle_monitor/cpupower-monitor.c 2019-04-08 
16:06:59.906460279 +0200
 @@ -459,9 +459,10 @@ int cmd_monitor(int argc, char **argv)
                        print_results(1, cpu);
        }
@@ -33,10 +33,10 @@
        cpu_topology_release(cpu_top);
        return 0;
  }
-Index: cpupower-4.19/utils/idle_monitor/idle_monitors.def
+Index: cpupower-5.1/utils/idle_monitor/idle_monitors.def
 ===================================================================
---- cpupower-4.19.orig/utils/idle_monitor/idle_monitors.def    2018-09-30 
16:15:35.000000000 +0200
-+++ cpupower-4.19/utils/idle_monitor/idle_monitors.def 2018-10-16 
14:27:01.070285696 +0200
+--- cpupower-5.1.orig/utils/idle_monitor/idle_monitors.def     2019-04-08 
07:51:09.000000000 +0200
++++ cpupower-5.1/utils/idle_monitor/idle_monitors.def  2019-04-08 
16:06:59.906460279 +0200
 @@ -4,5 +4,6 @@ DEF(intel_nhm)
  DEF(intel_snb)
  DEF(intel_hsw_ext)
@@ -44,10 +44,10 @@
 +DEF(rapl)
  #endif
  DEF(cpuidle_sysfs)
-Index: cpupower-4.19/utils/idle_monitor/rapl_monitor.c
+Index: cpupower-5.1/utils/idle_monitor/rapl_monitor.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ cpupower-4.19/utils/idle_monitor/rapl_monitor.c    2018-10-16 
14:27:01.070285696 +0200
++++ cpupower-5.1/utils/idle_monitor/rapl_monitor.c     2019-04-08 
16:06:59.906460279 +0200
 @@ -0,0 +1,141 @@
 +/*
 + *  (C) 2016      Thomas Renninger <tr...@suse.com>

++++++ turbostat-18.07.27.tar.bz2 -> turbostat-19.03.20.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/turbostat-18.07.27/Makefile 
new/turbostat-19.03.20/Makefile
--- old/turbostat-18.07.27/Makefile     2018-09-30 16:15:35.000000000 +0200
+++ new/turbostat-19.03.20/Makefile     2019-04-08 07:51:09.000000000 +0200
@@ -9,13 +9,13 @@
 endif
 
 turbostat : turbostat.c
-CFLAGS +=      -Wall
-CFLAGS +=      -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"'
-CFLAGS +=      
-DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"'
+override CFLAGS +=     -Wall
+override CFLAGS +=     
-DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"'
+override CFLAGS +=     
-DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"'
 
 %: %.c
        @mkdir -p $(BUILD_OUTPUT)
-       $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@
+       $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ $(LDFLAGS)
 
 .PHONY : clean
 clean :
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/turbostat-18.07.27/intel-family.h 
new/turbostat-19.03.20/intel-family.h
--- old/turbostat-18.07.27/intel-family.h       2018-10-01 15:58:26.797707237 
+0200
+++ new/turbostat-19.03.20/intel-family.h       2019-04-08 15:09:38.398274841 
+0200
@@ -6,10 +6,7 @@
  * "Big Core" Processors (Branded as Core, Xeon, etc...)
  *
  * The "_X" parts are generally the EP and EX Xeons, or the
- * "Extreme" ones, like Broadwell-E.
- *
- * Things ending in "2" are usually because we have no better
- * name for them.  There's no processor called "SILVERMONT2".
+ * "Extreme" ones, like Broadwell-E, or Atom microserver.
  *
  * While adding a new CPUID for a new microarchitecture, add a new
  * group to keep logically sorted out in chronological order. Within
@@ -55,21 +52,28 @@
 
 #define INTEL_FAM6_CANNONLAKE_MOBILE   0x66
 
+#define INTEL_FAM6_ICELAKE_MOBILE      0x7E
+
 /* "Small Core" Processors (Atom) */
 
-#define INTEL_FAM6_ATOM_PINEVIEW       0x1C
-#define INTEL_FAM6_ATOM_LINCROFT       0x26
-#define INTEL_FAM6_ATOM_PENWELL                0x27
-#define INTEL_FAM6_ATOM_CLOVERVIEW     0x35
-#define INTEL_FAM6_ATOM_CEDARVIEW      0x36
-#define INTEL_FAM6_ATOM_SILVERMONT1    0x37 /* BayTrail/BYT / Valleyview */
-#define INTEL_FAM6_ATOM_SILVERMONT2    0x4D /* Avaton/Rangely */
-#define INTEL_FAM6_ATOM_AIRMONT                0x4C /* CherryTrail / Braswell 
*/
-#define INTEL_FAM6_ATOM_MERRIFIELD     0x4A /* Tangier */
-#define INTEL_FAM6_ATOM_MOOREFIELD     0x5A /* Anniedale */
-#define INTEL_FAM6_ATOM_GOLDMONT       0x5C
-#define INTEL_FAM6_ATOM_DENVERTON      0x5F /* Goldmont Microserver */
-#define INTEL_FAM6_ATOM_GEMINI_LAKE    0x7A
+#define INTEL_FAM6_ATOM_BONNELL                0x1C /* Diamondville, Pineview 
*/
+#define INTEL_FAM6_ATOM_BONNELL_MID    0x26 /* Silverthorne, Lincroft */
+
+#define INTEL_FAM6_ATOM_SALTWELL       0x36 /* Cedarview */
+#define INTEL_FAM6_ATOM_SALTWELL_MID   0x27 /* Penwell */
+#define INTEL_FAM6_ATOM_SALTWELL_TABLET        0x35 /* Cloverview */
+
+#define INTEL_FAM6_ATOM_SILVERMONT     0x37 /* Bay Trail, Valleyview */
+#define INTEL_FAM6_ATOM_SILVERMONT_X   0x4D /* Avaton, Rangely */
+#define INTEL_FAM6_ATOM_SILVERMONT_MID 0x4A /* Merriefield */
+
+#define INTEL_FAM6_ATOM_AIRMONT                0x4C /* Cherry Trail, Braswell 
*/
+#define INTEL_FAM6_ATOM_AIRMONT_MID    0x5A /* Moorefield */
+
+#define INTEL_FAM6_ATOM_GOLDMONT       0x5C /* Apollo Lake */
+#define INTEL_FAM6_ATOM_GOLDMONT_X     0x5F /* Denverton */
+#define INTEL_FAM6_ATOM_GOLDMONT_PLUS  0x7A /* Gemini Lake */
+#define INTEL_FAM6_ATOM_TREMONT_X      0x86 /* Jacobsville */
 
 /* Xeon Phi */
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/turbostat-18.07.27/msr-index.h 
new/turbostat-19.03.20/msr-index.h
--- old/turbostat-18.07.27/msr-index.h  2018-10-01 15:58:26.805707712 +0200
+++ new/turbostat-19.03.20/msr-index.h  2019-04-08 15:09:38.406274842 +0200
@@ -41,9 +41,10 @@
 
 #define MSR_IA32_SPEC_CTRL             0x00000048 /* Speculation Control */
 #define SPEC_CTRL_IBRS                 (1 << 0)   /* Indirect Branch 
Restricted Speculation */
-#define SPEC_CTRL_STIBP                        (1 << 1)   /* Single Thread 
Indirect Branch Predictors */
+#define SPEC_CTRL_STIBP_SHIFT          1          /* Single Thread Indirect 
Branch Predictor (STIBP) bit */
+#define SPEC_CTRL_STIBP                        (1 << SPEC_CTRL_STIBP_SHIFT)    
/* STIBP mask */
 #define SPEC_CTRL_SSBD_SHIFT           2          /* Speculative Store Bypass 
Disable bit */
-#define SPEC_CTRL_SSBD                 (1 << SPEC_CTRL_SSBD_SHIFT)   /* 
Speculative Store Bypass Disable */
+#define SPEC_CTRL_SSBD                 (1 << SPEC_CTRL_SSBD_SHIFT)     /* 
Speculative Store Bypass Disable */
 
 #define MSR_IA32_PRED_CMD              0x00000049 /* Prediction Command */
 #define PRED_CMD_IBPB                  (1 << 0)   /* Indirect Branch 
Prediction Barrier */
@@ -120,7 +121,43 @@
 #define MSR_PEBS_LD_LAT_THRESHOLD      0x000003f6
 
 #define MSR_IA32_RTIT_CTL              0x00000570
+#define RTIT_CTL_TRACEEN               BIT(0)
+#define RTIT_CTL_CYCLEACC              BIT(1)
+#define RTIT_CTL_OS                    BIT(2)
+#define RTIT_CTL_USR                   BIT(3)
+#define RTIT_CTL_PWR_EVT_EN            BIT(4)
+#define RTIT_CTL_FUP_ON_PTW            BIT(5)
+#define RTIT_CTL_FABRIC_EN             BIT(6)
+#define RTIT_CTL_CR3EN                 BIT(7)
+#define RTIT_CTL_TOPA                  BIT(8)
+#define RTIT_CTL_MTC_EN                        BIT(9)
+#define RTIT_CTL_TSC_EN                        BIT(10)
+#define RTIT_CTL_DISRETC               BIT(11)
+#define RTIT_CTL_PTW_EN                        BIT(12)
+#define RTIT_CTL_BRANCH_EN             BIT(13)
+#define RTIT_CTL_MTC_RANGE_OFFSET      14
+#define RTIT_CTL_MTC_RANGE             (0x0full << RTIT_CTL_MTC_RANGE_OFFSET)
+#define RTIT_CTL_CYC_THRESH_OFFSET     19
+#define RTIT_CTL_CYC_THRESH            (0x0full << RTIT_CTL_CYC_THRESH_OFFSET)
+#define RTIT_CTL_PSB_FREQ_OFFSET       24
+#define RTIT_CTL_PSB_FREQ              (0x0full << RTIT_CTL_PSB_FREQ_OFFSET)
+#define RTIT_CTL_ADDR0_OFFSET          32
+#define RTIT_CTL_ADDR0                 (0x0full << RTIT_CTL_ADDR0_OFFSET)
+#define RTIT_CTL_ADDR1_OFFSET          36
+#define RTIT_CTL_ADDR1                 (0x0full << RTIT_CTL_ADDR1_OFFSET)
+#define RTIT_CTL_ADDR2_OFFSET          40
+#define RTIT_CTL_ADDR2                 (0x0full << RTIT_CTL_ADDR2_OFFSET)
+#define RTIT_CTL_ADDR3_OFFSET          44
+#define RTIT_CTL_ADDR3                 (0x0full << RTIT_CTL_ADDR3_OFFSET)
 #define MSR_IA32_RTIT_STATUS           0x00000571
+#define RTIT_STATUS_FILTEREN           BIT(0)
+#define RTIT_STATUS_CONTEXTEN          BIT(1)
+#define RTIT_STATUS_TRIGGEREN          BIT(2)
+#define RTIT_STATUS_BUFFOVF            BIT(3)
+#define RTIT_STATUS_ERROR              BIT(4)
+#define RTIT_STATUS_STOPPED            BIT(5)
+#define RTIT_STATUS_BYTECNT_OFFSET     32
+#define RTIT_STATUS_BYTECNT            (0x1ffffull << 
RTIT_STATUS_BYTECNT_OFFSET)
 #define MSR_IA32_RTIT_ADDR0_A          0x00000580
 #define MSR_IA32_RTIT_ADDR0_B          0x00000581
 #define MSR_IA32_RTIT_ADDR1_A          0x00000582
@@ -164,6 +201,7 @@
 #define DEBUGCTLMSR_BTS_OFF_OS         (1UL <<  9)
 #define DEBUGCTLMSR_BTS_OFF_USR                (1UL << 10)
 #define DEBUGCTLMSR_FREEZE_LBRS_ON_PMI (1UL << 11)
+#define DEBUGCTLMSR_FREEZE_PERFMON_ON_PMI      (1UL << 12)
 #define DEBUGCTLMSR_FREEZE_IN_SMM_BIT  14
 #define DEBUGCTLMSR_FREEZE_IN_SMM      (1UL << DEBUGCTLMSR_FREEZE_IN_SMM_BIT)
 
@@ -388,6 +426,7 @@
 #define MSR_F15H_NB_PERF_CTR           0xc0010241
 #define MSR_F15H_PTSC                  0xc0010280
 #define MSR_F15H_IC_CFG                        0xc0011021
+#define MSR_F15H_EX_CFG                        0xc001102c
 
 /* Fam 10h MSRs */
 #define MSR_FAM10H_MMIO_CONF_BASE      0xc0010058
@@ -627,6 +666,12 @@
 
 #define MSR_IA32_TSC_DEADLINE          0x000006E0
 
+
+#define MSR_TSX_FORCE_ABORT            0x0000010F
+
+#define MSR_TFA_RTM_FORCE_ABORT_BIT    0
+#define MSR_TFA_RTM_FORCE_ABORT                
BIT_ULL(MSR_TFA_RTM_FORCE_ABORT_BIT)
+
 /* P4/Xeon+ specific */
 #define MSR_IA32_MCG_EAX               0x00000180
 #define MSR_IA32_MCG_EBX               0x00000181
@@ -769,6 +814,7 @@
 #define VMX_BASIC_INOUT                0x0040000000000000LLU
 
 /* MSR_IA32_VMX_MISC bits */
+#define MSR_IA32_VMX_MISC_INTEL_PT                 (1ULL << 14)
 #define MSR_IA32_VMX_MISC_VMWRITE_SHADOW_RO_FIELDS (1ULL << 29)
 #define MSR_IA32_VMX_MISC_PREEMPTION_TIMER_SCALE   0x1F
 /* AMD-V MSRs */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/turbostat-18.07.27/turbostat.c 
new/turbostat-19.03.20/turbostat.c
--- old/turbostat-18.07.27/turbostat.c  2018-09-30 16:15:35.000000000 +0200
+++ new/turbostat-19.03.20/turbostat.c  2019-04-08 07:51:09.000000000 +0200
@@ -1,6 +1,6 @@
 /*
  * turbostat -- show CPU frequency and C-state residency
- * on modern Intel turbo-capable processors.
+ * on modern Intel and AMD processors.
  *
  * Copyright (c) 2013 Intel Corporation.
  * Len Brown <len.br...@intel.com>
@@ -44,6 +44,7 @@
 #include <cpuid.h>
 #include <linux/capability.h>
 #include <errno.h>
+#include <math.h>
 
 char *proc_stat = "/proc/stat";
 FILE *outf;
@@ -63,7 +64,6 @@
 unsigned int do_snb_cstates;
 unsigned int do_knl_cstates;
 unsigned int do_slm_cstates;
-unsigned int do_cnl_cstates;
 unsigned int use_c1_residency_msr;
 unsigned int has_aperf;
 unsigned int has_epb;
@@ -71,6 +71,8 @@
 unsigned int do_irtl_hsw;
 unsigned int units = 1000000;  /* MHz etc */
 unsigned int genuine_intel;
+unsigned int authentic_amd;
+unsigned int max_level, max_extended_level;
 unsigned int has_invariant_tsc;
 unsigned int do_nhm_platform_info;
 unsigned int no_MSR_MISC_PWR_MGMT;
@@ -139,9 +141,21 @@
 
 #define RAPL_CORES_ENERGY_STATUS       (1 << 9)
                                        /* 0x639 MSR_PP0_ENERGY_STATUS */
+#define RAPL_PER_CORE_ENERGY   (1 << 10)
+                                       /* Indicates cores energy collection is 
per-core,
+                                        * not per-package. */
+#define RAPL_AMD_F17H          (1 << 11)
+                                       /* 0xc0010299 MSR_RAPL_PWR_UNIT */
+                                       /* 0xc001029a MSR_CORE_ENERGY_STAT */
+                                       /* 0xc001029b MSR_PKG_ENERGY_STAT */
 #define RAPL_CORES (RAPL_CORES_ENERGY_STATUS | RAPL_CORES_POWER_LIMIT)
 #define        TJMAX_DEFAULT   100
 
+/* MSRs that are not yet in the kernel-provided header. */
+#define MSR_RAPL_PWR_UNIT      0xc0010299
+#define MSR_CORE_ENERGY_STAT   0xc001029a
+#define MSR_PKG_ENERGY_STAT    0xc001029b
+
 #define MAX(a, b) ((a) > (b) ? (a) : (b))
 
 /*
@@ -185,6 +199,7 @@
        unsigned long long c7;
        unsigned long long mc6_us;      /* duplicate as per-core for now, even 
though per module */
        unsigned int core_temp_c;
+       unsigned int core_energy;       /* MSR_CORE_ENERGY_STAT */
        unsigned int core_id;
        unsigned long long counter[MAX_ADDED_COUNTERS];
 } *core_even, *core_odd;
@@ -271,6 +286,7 @@
 
 struct cpu_topology {
        int physical_package_id;
+       int die_id;
        int logical_cpu_id;
        int physical_node_id;
        int logical_node_id;    /* 0-based count within the package */
@@ -281,6 +297,7 @@
 
 struct topo_params {
        int num_packages;
+       int num_die;
        int num_cpus;
        int num_cores;
        int max_cpu_num;
@@ -312,9 +329,8 @@
        int retval, pkg_no, core_no, thread_no, node_no;
 
        for (pkg_no = 0; pkg_no < topo.num_packages; ++pkg_no) {
-               for (core_no = 0; core_no < topo.cores_per_node; ++core_no) {
-                       for (node_no = 0; node_no < topo.nodes_per_pkg;
-                            node_no++) {
+               for (node_no = 0; node_no < topo.nodes_per_pkg; node_no++) {
+                       for (core_no = 0; core_no < topo.cores_per_node; 
++core_no) {
                                for (thread_no = 0; thread_no <
                                        topo.threads_per_core; ++thread_no) {
                                        struct thread_data *t;
@@ -440,6 +456,7 @@
        { 0x0, "CPU" },
        { 0x0, "APIC" },
        { 0x0, "X2APIC" },
+       { 0x0, "Die" },
 };
 
 #define MAX_BIC (sizeof(bic) / sizeof(struct msr_counter))
@@ -493,6 +510,7 @@
 #define        BIC_CPU         (1ULL << 47)
 #define        BIC_APIC        (1ULL << 48)
 #define        BIC_X2APIC      (1ULL << 49)
+#define        BIC_Die         (1ULL << 50)
 
 #define BIC_DISABLED_BY_DEFAULT        (BIC_USEC | BIC_TOD | BIC_APIC | 
BIC_X2APIC)
 
@@ -619,6 +637,8 @@
                outp += sprintf(outp, "%sTime_Of_Day_Seconds", (printed++ ? 
delim : ""));
        if (DO_BIC(BIC_Package))
                outp += sprintf(outp, "%sPackage", (printed++ ? delim : ""));
+       if (DO_BIC(BIC_Die))
+               outp += sprintf(outp, "%sDie", (printed++ ? delim : ""));
        if (DO_BIC(BIC_Node))
                outp += sprintf(outp, "%sNode", (printed++ ? delim : ""));
        if (DO_BIC(BIC_Core))
@@ -665,7 +685,7 @@
 
        if (DO_BIC(BIC_CPU_c1))
                outp += sprintf(outp, "%sCPU%%c1", (printed++ ? delim : ""));
-       if (DO_BIC(BIC_CPU_c3) && !do_slm_cstates && !do_knl_cstates && 
!do_cnl_cstates)
+       if (DO_BIC(BIC_CPU_c3))
                outp += sprintf(outp, "%sCPU%%c3", (printed++ ? delim : ""));
        if (DO_BIC(BIC_CPU_c6))
                outp += sprintf(outp, "%sCPU%%c6", (printed++ ? delim : ""));
@@ -678,6 +698,14 @@
        if (DO_BIC(BIC_CoreTmp))
                outp += sprintf(outp, "%sCoreTmp", (printed++ ? delim : ""));
 
+       if (do_rapl && !rapl_joules) {
+               if (DO_BIC(BIC_CorWatt) && (do_rapl & RAPL_PER_CORE_ENERGY))
+                       outp += sprintf(outp, "%sCorWatt", (printed++ ? delim : 
""));
+       } else if (do_rapl && rapl_joules) {
+               if (DO_BIC(BIC_Cor_J) && (do_rapl & RAPL_PER_CORE_ENERGY))
+                       outp += sprintf(outp, "%sCor_J", (printed++ ? delim : 
""));
+       }
+
        for (mp = sys.cp; mp; mp = mp->next) {
                if (mp->format == FORMAT_RAW) {
                        if (mp->width == 64)
@@ -732,7 +760,7 @@
        if (do_rapl && !rapl_joules) {
                if (DO_BIC(BIC_PkgWatt))
                        outp += sprintf(outp, "%sPkgWatt", (printed++ ? delim : 
""));
-               if (DO_BIC(BIC_CorWatt))
+               if (DO_BIC(BIC_CorWatt) && !(do_rapl & RAPL_PER_CORE_ENERGY))
                        outp += sprintf(outp, "%sCorWatt", (printed++ ? delim : 
""));
                if (DO_BIC(BIC_GFXWatt))
                        outp += sprintf(outp, "%sGFXWatt", (printed++ ? delim : 
""));
@@ -745,7 +773,7 @@
        } else if (do_rapl && rapl_joules) {
                if (DO_BIC(BIC_Pkg_J))
                        outp += sprintf(outp, "%sPkg_J", (printed++ ? delim : 
""));
-               if (DO_BIC(BIC_Cor_J))
+               if (DO_BIC(BIC_Cor_J) && !(do_rapl & RAPL_PER_CORE_ENERGY))
                        outp += sprintf(outp, "%sCor_J", (printed++ ? delim : 
""));
                if (DO_BIC(BIC_GFX_J))
                        outp += sprintf(outp, "%sGFX_J", (printed++ ? delim : 
""));
@@ -806,6 +834,7 @@
                outp += sprintf(outp, "c6: %016llX\n", c->c6);
                outp += sprintf(outp, "c7: %016llX\n", c->c7);
                outp += sprintf(outp, "DTS: %dC\n", c->core_temp_c);
+               outp += sprintf(outp, "Joules: %0X\n", c->core_energy);
 
                for (i = 0, mp = sys.cp; mp; i++, mp = mp->next) {
                        outp += sprintf(outp, "cADDED [%d] msr0x%x: %08llX\n",
@@ -902,6 +931,8 @@
        if (t == &average.threads) {
                if (DO_BIC(BIC_Package))
                        outp += sprintf(outp, "%s-", (printed++ ? delim : ""));
+               if (DO_BIC(BIC_Die))
+                       outp += sprintf(outp, "%s-", (printed++ ? delim : ""));
                if (DO_BIC(BIC_Node))
                        outp += sprintf(outp, "%s-", (printed++ ? delim : ""));
                if (DO_BIC(BIC_Core))
@@ -919,6 +950,12 @@
                        else
                                outp += sprintf(outp, "%s-", (printed++ ? delim 
: ""));
                }
+               if (DO_BIC(BIC_Die)) {
+                       if (c)
+                               outp += sprintf(outp, "%s%d", (printed++ ? 
delim : ""), cpus[t->cpu_id].die_id);
+                       else
+                               outp += sprintf(outp, "%s-", (printed++ ? delim 
: ""));
+               }
                if (DO_BIC(BIC_Node)) {
                        if (t)
                                outp += sprintf(outp, "%s%d",
@@ -1001,7 +1038,7 @@
        if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE))
                goto done;
 
-       if (DO_BIC(BIC_CPU_c3) && !do_slm_cstates && !do_knl_cstates && 
!do_cnl_cstates)
+       if (DO_BIC(BIC_CPU_c3))
                outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 
* c->c3/tsc);
        if (DO_BIC(BIC_CPU_c6))
                outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 
* c->c6/tsc);
@@ -1031,6 +1068,20 @@
                }
        }
 
+       /*
+        * If measurement interval exceeds minimum RAPL Joule Counter range,
+        * indicate that results are suspect by printing "**" in fraction place.
+        */
+       if (interval_float < rapl_joule_counter_range)
+               fmt8 = "%s%.2f";
+       else
+               fmt8 = "%6.0f**";
+
+       if (DO_BIC(BIC_CorWatt) && (do_rapl & RAPL_PER_CORE_ENERGY))
+               outp += sprintf(outp, fmt8, (printed++ ? delim : ""), 
c->core_energy * rapl_energy_units / interval_float);
+       if (DO_BIC(BIC_Cor_J) && (do_rapl & RAPL_PER_CORE_ENERGY))
+               outp += sprintf(outp, fmt8, (printed++ ? delim : ""), 
c->core_energy * rapl_energy_units);
+
        /* print per-package data only for 1st core in package */
        if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
                goto done;
@@ -1083,18 +1134,9 @@
        if (DO_BIC(BIC_SYS_LPI))
                outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 
* p->sys_lpi / 1000000.0 / interval_float);
 
-       /*
-        * If measurement interval exceeds minimum RAPL Joule Counter range,
-        * indicate that results are suspect by printing "**" in fraction place.
-        */
-       if (interval_float < rapl_joule_counter_range)
-               fmt8 = "%s%.2f";
-       else
-               fmt8 = "%6.0f**";
-
        if (DO_BIC(BIC_PkgWatt))
                outp += sprintf(outp, fmt8, (printed++ ? delim : ""), 
p->energy_pkg * rapl_energy_units / interval_float);
-       if (DO_BIC(BIC_CorWatt))
+       if (DO_BIC(BIC_CorWatt) && !(do_rapl & RAPL_PER_CORE_ENERGY))
                outp += sprintf(outp, fmt8, (printed++ ? delim : ""), 
p->energy_cores * rapl_energy_units / interval_float);
        if (DO_BIC(BIC_GFXWatt))
                outp += sprintf(outp, fmt8, (printed++ ? delim : ""), 
p->energy_gfx * rapl_energy_units / interval_float);
@@ -1102,7 +1144,7 @@
                outp += sprintf(outp, fmt8, (printed++ ? delim : ""), 
p->energy_dram * rapl_dram_energy_units / interval_float);
        if (DO_BIC(BIC_Pkg_J))
                outp += sprintf(outp, fmt8, (printed++ ? delim : ""), 
p->energy_pkg * rapl_energy_units);
-       if (DO_BIC(BIC_Cor_J))
+       if (DO_BIC(BIC_Cor_J) && !(do_rapl & RAPL_PER_CORE_ENERGY))
                outp += sprintf(outp, fmt8, (printed++ ? delim : ""), 
p->energy_cores * rapl_energy_units);
        if (DO_BIC(BIC_GFX_J))
                outp += sprintf(outp, fmt8, (printed++ ? delim : ""), 
p->energy_gfx * rapl_energy_units);
@@ -1247,6 +1289,8 @@
        old->core_temp_c = new->core_temp_c;
        old->mc6_us = new->mc6_us - old->mc6_us;
 
+       DELTA_WRAP32(new->core_energy, old->core_energy);
+
        for (i = 0, mp = sys.cp; mp; i++, mp = mp->next) {
                if (mp->format == FORMAT_RAW)
                        old->counter[i] = new->counter[i];
@@ -1389,6 +1433,7 @@
        c->c7 = 0;
        c->mc6_us = 0;
        c->core_temp_c = 0;
+       c->core_energy = 0;
 
        p->pkg_wtd_core_c0 = 0;
        p->pkg_any_core_c0 = 0;
@@ -1471,6 +1516,8 @@
 
        average.cores.core_temp_c = MAX(average.cores.core_temp_c, 
c->core_temp_c);
 
+       average.cores.core_energy += c->core_energy;
+
        for (i = 0, mp = sys.cp; mp; i++, mp = mp->next) {
                if (mp->format == FORMAT_RAW)
                        continue;
@@ -1667,30 +1714,51 @@
 
 void get_apic_id(struct thread_data *t)
 {
-       unsigned int eax, ebx, ecx, edx, max_level;
+       unsigned int eax, ebx, ecx, edx;
 
-       eax = ebx = ecx = edx = 0;
+       if (DO_BIC(BIC_APIC)) {
+               eax = ebx = ecx = edx = 0;
+               __cpuid(1, eax, ebx, ecx, edx);
 
-       if (!genuine_intel)
+               t->apic_id = (ebx >> 24) & 0xff;
+       }
+
+       if (!DO_BIC(BIC_X2APIC))
                return;
 
-       __cpuid(0, max_level, ebx, ecx, edx);
+       if (authentic_amd) {
+               unsigned int topology_extensions;
 
-       __cpuid(1, eax, ebx, ecx, edx);
-       t->apic_id = (ebx >> 24) & 0xf;
+               if (max_extended_level < 0x8000001e)
+                       return;
 
-       if (max_level < 0xb)
+               eax = ebx = ecx = edx = 0;
+               __cpuid(0x80000001, eax, ebx, ecx, edx);
+                       topology_extensions = ecx & (1 << 22);
+
+               if (topology_extensions == 0)
+                       return;
+
+               eax = ebx = ecx = edx = 0;
+               __cpuid(0x8000001e, eax, ebx, ecx, edx);
+
+               t->x2apic_id = eax;
                return;
+       }
 
-       if (!DO_BIC(BIC_X2APIC))
+       if (!genuine_intel)
+               return;
+
+       if (max_level < 0xb)
                return;
 
        ecx = 0;
        __cpuid(0xb, eax, ebx, ecx, edx);
        t->x2apic_id = edx;
 
-       if (debug && (t->apic_id != t->x2apic_id))
-               fprintf(outf, "cpu%d: apic 0x%x x2apic 0x%x\n", t->cpu_id, 
t->apic_id, t->x2apic_id);
+       if (debug && (t->apic_id != (t->x2apic_id & 0xff)))
+               fprintf(outf, "cpu%d: BIOS BUG: apic 0x%x x2apic 0x%x\n",
+                               t->cpu_id, t->apic_id, t->x2apic_id);
 }
 
 /*
@@ -1795,7 +1863,7 @@
        if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE))
                goto done;
 
-       if (DO_BIC(BIC_CPU_c3) && !do_slm_cstates && !do_knl_cstates && 
!do_cnl_cstates) {
+       if (DO_BIC(BIC_CPU_c3)) {
                if (get_msr(cpu, MSR_CORE_C3_RESIDENCY, &c->c3))
                        return -6;
        }
@@ -1822,6 +1890,12 @@
                c->core_temp_c = tcc_activation_temp - ((msr >> 16) & 0x7F);
        }
 
+       if (do_rapl & RAPL_AMD_F17H) {
+               if (get_msr(cpu, MSR_CORE_ENERGY_STAT, &msr))
+                       return -14;
+               c->core_energy = msr & 0xFFFFFFFF;
+       }
+
        for (i = 0, mp = sys.cp; mp; i++, mp = mp->next) {
                if (get_mp(cpu, mp, &c->counter[i]))
                        return -10;
@@ -1911,6 +1985,11 @@
                        return -16;
                p->rapl_dram_perf_status = msr & 0xFFFFFFFF;
        }
+       if (do_rapl & RAPL_AMD_F17H) {
+               if (get_msr(cpu, MSR_PKG_ENERGY_STAT, &msr))
+                       return -13;
+               p->energy_pkg = msr & 0xFFFFFFFF;
+       }
        if (DO_BIC(BIC_PkgTmp)) {
                if (get_msr(cpu, MSR_IA32_PACKAGE_THERM_STATUS, &msr))
                        return -17;
@@ -1953,11 +2032,12 @@
 #define PCL_7S 11 /* PC7 Shrink */
 #define PCL__8 12 /* PC8 */
 #define PCL__9 13 /* PC9 */
-#define PCLUNL 14 /* Unlimited */
+#define PCL_10 14 /* PC10 */
+#define PCLUNL 15 /* Unlimited */
 
 int pkg_cstate_limit = PCLUKN;
 char *pkg_cstate_limit_strings[] = { "reserved", "unknown", "pc0", "pc1", 
"pc2",
-       "pc3", "pc4", "pc6", "pc6n", "pc6r", "pc7", "pc7s", "pc8", "pc9", 
"unlimited"};
+       "pc3", "pc4", "pc6", "pc6n", "pc6r", "pc7", "pc7s", "pc8", "pc9", 
"pc10", "unlimited"};
 
 int nhm_pkg_cstate_limits[16] = {PCL__0, PCL__1, PCL__3, PCL__6, PCL__7, 
PCLRSV, PCLRSV, PCLUNL, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, 
PCLRSV};
 int snb_pkg_cstate_limits[16] = {PCL__0, PCL__2, PCL_6N, PCL_6R, PCL__7, 
PCL_7S, PCLRSV, PCLUNL, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, 
PCLRSV};
@@ -1965,7 +2045,7 @@
 int slv_pkg_cstate_limits[16] = {PCL__0, PCL__1, PCLRSV, PCLRSV, PCL__4, 
PCLRSV, PCL__6, PCL__7, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCL__6, 
PCL__7};
 int amt_pkg_cstate_limits[16] = {PCLUNL, PCL__1, PCL__2, PCLRSV, PCLRSV, 
PCLRSV, PCL__6, PCL__7, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, 
PCLRSV};
 int phi_pkg_cstate_limits[16] = {PCL__0, PCL__2, PCL_6N, PCL_6R, PCLRSV, 
PCLRSV, PCLRSV, PCLUNL, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, 
PCLRSV};
-int bxt_pkg_cstate_limits[16] = {PCL__0, PCL__2, PCLUNL, PCLRSV, PCLRSV, 
PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, 
PCLRSV};
+int glm_pkg_cstate_limits[16] = {PCLUNL, PCL__1, PCL__3, PCL__6, PCL__7, 
PCL_7S, PCL__8, PCL__9, PCL_10, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, 
PCLRSV};
 int skx_pkg_cstate_limits[16] = {PCL__0, PCL__2, PCL_6N, PCL_6R, PCLRSV, 
PCLRSV, PCLRSV, PCLUNL, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, 
PCLRSV};
 
 
@@ -2082,7 +2162,7 @@
        switch (model) {
        case INTEL_FAM6_ATOM_GOLDMONT:
        case INTEL_FAM6_SKYLAKE_X:
-       case INTEL_FAM6_ATOM_DENVERTON:
+       case INTEL_FAM6_ATOM_GOLDMONT_X:
                return 1;
        }
        return 0;
@@ -2432,6 +2512,8 @@
 
 /*
  * Parse a file containing a single int.
+ * Return 0 if file can not be opened
+ * Exit if file can be opened, but can not be parsed
  */
 int parse_int_file(const char *fmt, ...)
 {
@@ -2443,7 +2525,9 @@
        va_start(args, fmt);
        vsnprintf(path, sizeof(path), fmt, args);
        va_end(args);
-       filep = fopen_or_die(path, "r");
+       filep = fopen(path, "r");
+       if (!filep)
+               return 0;
        if (fscanf(filep, "%d", &value) != 1)
                err(1, "%s: failed to parse number from file", path);
        fclose(filep);
@@ -2464,6 +2548,11 @@
        return 
parse_int_file("/sys/devices/system/cpu/cpu%d/topology/physical_package_id", 
cpu);
 }
 
+int get_die_id(int cpu)
+{
+       return parse_int_file("/sys/devices/system/cpu/cpu%d/topology/die_id", 
cpu);
+}
+
 int get_core_id(int cpu)
 {
        return parse_int_file("/sys/devices/system/cpu/cpu%d/topology/core_id", 
cpu);
@@ -2554,7 +2643,8 @@
        filep = fopen_or_die(path, "r");
        do {
                offset -= BITMASK_SIZE;
-               fscanf(filep, "%lx%c", &map, &character);
+               if (fscanf(filep, "%lx%c", &map, &character) != 2)
+                       err(1, "%s: failed to parse file", path);
                for (shift = 0; shift < BITMASK_SIZE; shift++) {
                        if ((map >> shift) & 0x1) {
                                so = shift + offset;
@@ -2831,8 +2921,11 @@
        fp = 
fopen_or_die("/sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us", 
"r");
 
        retval = fscanf(fp, "%lld", &cpuidle_cur_cpu_lpi_us);
-       if (retval != 1)
-               err(1, "CPU LPI");
+       if (retval != 1) {
+               fprintf(stderr, "Disabling Low Power Idle CPU output\n");
+               BIC_NOT_PRESENT(BIC_CPU_LPI);
+               return -1;
+       }
 
        fclose(fp);
 
@@ -2854,9 +2947,11 @@
        fp = 
fopen_or_die("/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us",
 "r");
 
        retval = fscanf(fp, "%lld", &cpuidle_cur_sys_lpi_us);
-       if (retval != 1)
-               err(1, "SYS LPI");
-
+       if (retval != 1) {
+               fprintf(stderr, "Disabling Low Power Idle System output\n");
+               BIC_NOT_PRESENT(BIC_SYS_LPI);
+               return -1;
+       }
        fclose(fp);
 
        return 0;
@@ -3113,13 +3208,8 @@
        bclk = discover_bclk(family, model);
 
        switch (model) {
-       case INTEL_FAM6_NEHALEM_EP:     /* Core i7, Xeon 5500 series - 
Bloomfield, Gainstown NHM-EP */
        case INTEL_FAM6_NEHALEM:        /* Core i7 and i5 Processor - 
Clarksfield, Lynnfield, Jasper Forest */
-       case 0x1F:      /* Core i7 and i5 Processor - Nehalem */
-       case INTEL_FAM6_WESTMERE:       /* Westmere Client - Clarkdale, 
Arrandale */
-       case INTEL_FAM6_WESTMERE_EP:    /* Westmere EP - Gulftown */
        case INTEL_FAM6_NEHALEM_EX:     /* Nehalem-EX Xeon - Beckton */
-       case INTEL_FAM6_WESTMERE_EX:    /* Westmere-EX Xeon - Eagleton */
                pkg_cstate_limits = nhm_pkg_cstate_limits;
                break;
        case INTEL_FAM6_SANDYBRIDGE:    /* SNB */
@@ -3131,16 +3221,11 @@
                break;
        case INTEL_FAM6_HASWELL_CORE:   /* HSW */
        case INTEL_FAM6_HASWELL_X:      /* HSX */
-       case INTEL_FAM6_HASWELL_ULT:    /* HSW */
        case INTEL_FAM6_HASWELL_GT3E:   /* HSW */
        case INTEL_FAM6_BROADWELL_CORE: /* BDW */
        case INTEL_FAM6_BROADWELL_GT3E: /* BDW */
        case INTEL_FAM6_BROADWELL_X:    /* BDX */
-       case INTEL_FAM6_BROADWELL_XEON_D:       /* BDX-DE */
        case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
-       case INTEL_FAM6_SKYLAKE_DESKTOP:        /* SKL */
-       case INTEL_FAM6_KABYLAKE_MOBILE:        /* KBL */
-       case INTEL_FAM6_KABYLAKE_DESKTOP:       /* KBL */
        case INTEL_FAM6_CANNONLAKE_MOBILE:      /* CNL */
                pkg_cstate_limits = hsw_pkg_cstate_limits;
                has_misc_feature_control = 1;
@@ -3149,9 +3234,9 @@
                pkg_cstate_limits = skx_pkg_cstate_limits;
                has_misc_feature_control = 1;
                break;
-       case INTEL_FAM6_ATOM_SILVERMONT1:       /* BYT */
+       case INTEL_FAM6_ATOM_SILVERMONT:        /* BYT */
                no_MSR_MISC_PWR_MGMT = 1;
-       case INTEL_FAM6_ATOM_SILVERMONT2:       /* AVN */
+       case INTEL_FAM6_ATOM_SILVERMONT_X:      /* AVN */
                pkg_cstate_limits = slv_pkg_cstate_limits;
                break;
        case INTEL_FAM6_ATOM_AIRMONT:   /* AMT */
@@ -3159,13 +3244,12 @@
                no_MSR_MISC_PWR_MGMT = 1;
                break;
        case INTEL_FAM6_XEON_PHI_KNL:   /* PHI */
-       case INTEL_FAM6_XEON_PHI_KNM:
                pkg_cstate_limits = phi_pkg_cstate_limits;
                break;
        case INTEL_FAM6_ATOM_GOLDMONT:  /* BXT */
-       case INTEL_FAM6_ATOM_GEMINI_LAKE:
-       case INTEL_FAM6_ATOM_DENVERTON: /* DNV */
-               pkg_cstate_limits = bxt_pkg_cstate_limits;
+       case INTEL_FAM6_ATOM_GOLDMONT_PLUS:
+       case INTEL_FAM6_ATOM_GOLDMONT_X:        /* DNV */
+               pkg_cstate_limits = glm_pkg_cstate_limits;
                break;
        default:
                return 0;
@@ -3193,9 +3277,9 @@
                return 0;
 
        switch (model) {
-       case INTEL_FAM6_ATOM_SILVERMONT1:
-       case INTEL_FAM6_ATOM_MERRIFIELD:
-       case INTEL_FAM6_ATOM_MOOREFIELD:
+       case INTEL_FAM6_ATOM_SILVERMONT:
+       case INTEL_FAM6_ATOM_SILVERMONT_MID:
+       case INTEL_FAM6_ATOM_AIRMONT_MID:
                return 1;
        }
        return 0;
@@ -3207,7 +3291,7 @@
                return 0;
 
        switch (model) {
-       case INTEL_FAM6_ATOM_DENVERTON:
+       case INTEL_FAM6_ATOM_GOLDMONT_X:
                return 1;
        }
        return 0;
@@ -3220,7 +3304,6 @@
 
        switch (model) {
        case INTEL_FAM6_BROADWELL_X:
-       case INTEL_FAM6_BROADWELL_XEON_D:
                return 1;
        }
        return 0;
@@ -3246,9 +3329,7 @@
        switch (model) {
        /* Nehalem compatible, but do not include turbo-ratio limit support */
        case INTEL_FAM6_NEHALEM_EX:     /* Nehalem-EX Xeon - Beckton */
-       case INTEL_FAM6_WESTMERE_EX:    /* Westmere-EX Xeon - Eagleton */
        case INTEL_FAM6_XEON_PHI_KNL:   /* PHI - Knights Landing (different MSR 
definition) */
-       case INTEL_FAM6_XEON_PHI_KNM:
                return 0;
        default:
                return 1;
@@ -3303,7 +3384,6 @@
 
        switch (model) {
        case INTEL_FAM6_XEON_PHI_KNL:   /* Knights Landing */
-       case INTEL_FAM6_XEON_PHI_KNM:
                return 1;
        default:
                return 0;
@@ -3337,21 +3417,15 @@
        case INTEL_FAM6_IVYBRIDGE:      /* IVB */
        case INTEL_FAM6_HASWELL_CORE:   /* HSW */
        case INTEL_FAM6_HASWELL_X:      /* HSX */
-       case INTEL_FAM6_HASWELL_ULT:    /* HSW */
        case INTEL_FAM6_HASWELL_GT3E:   /* HSW */
        case INTEL_FAM6_BROADWELL_CORE: /* BDW */
        case INTEL_FAM6_BROADWELL_GT3E: /* BDW */
        case INTEL_FAM6_BROADWELL_X:    /* BDX */
-       case INTEL_FAM6_BROADWELL_XEON_D:       /* BDX-DE */
        case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
-       case INTEL_FAM6_SKYLAKE_DESKTOP:        /* SKL */
-       case INTEL_FAM6_KABYLAKE_MOBILE:        /* KBL */
-       case INTEL_FAM6_KABYLAKE_DESKTOP:       /* KBL */
        case INTEL_FAM6_CANNONLAKE_MOBILE:      /* CNL */
        case INTEL_FAM6_SKYLAKE_X:      /* SKX */
 
        case INTEL_FAM6_XEON_PHI_KNL:   /* Knights Landing */
-       case INTEL_FAM6_XEON_PHI_KNM:
                return 1;
        default:
                return 0;
@@ -3407,14 +3481,14 @@
                input = fopen(path, "r");
                if (input == NULL)
                        continue;
-               fgets(name_buf, sizeof(name_buf), input);
+               if (!fgets(name_buf, sizeof(name_buf), input))
+                       err(1, "%s: failed to read file", path);
 
                 /* truncate "C1-HSW\n" to "C1", or truncate "C1\n" to "C1" */
                sp = strchr(name_buf, '-');
                if (!sp)
                        sp = strchrnul(name_buf, '\n');
                *sp = '\0';
-
                fclose(input);
 
                sprintf(path, 
"/sys/devices/system/cpu/cpu%d/cpuidle/state%d/desc",
@@ -3422,7 +3496,8 @@
                input = fopen(path, "r");
                if (input == NULL)
                        continue;
-               fgets(desc, sizeof(desc), input);
+               if (!fgets(desc, sizeof(desc), input))
+                       err(1, "%s: failed to read file", path);
 
                fprintf(outf, "cpu%d: %s: %s", base_cpu, name_buf, desc);
                fclose(input);
@@ -3441,20 +3516,22 @@
                        base_cpu);
        input = fopen(path, "r");
        if (input == NULL) {
-               fprintf(stderr, "NSFOD %s\n", path);
+               fprintf(outf, "NSFOD %s\n", path);
                return;
        }
-       fgets(driver_buf, sizeof(driver_buf), input);
+       if (!fgets(driver_buf, sizeof(driver_buf), input))
+               err(1, "%s: failed to read file", path);
        fclose(input);
 
        sprintf(path, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor",
                        base_cpu);
        input = fopen(path, "r");
        if (input == NULL) {
-               fprintf(stderr, "NSFOD %s\n", path);
+               fprintf(outf, "NSFOD %s\n", path);
                return;
        }
-       fgets(governor_buf, sizeof(governor_buf), input);
+       if (!fgets(governor_buf, sizeof(governor_buf), input))
+               err(1, "%s: failed to read file", path);
        fclose(input);
 
        fprintf(outf, "cpu%d: cpufreq driver: %s", base_cpu, driver_buf);
@@ -3463,7 +3540,8 @@
        sprintf(path, "/sys/devices/system/cpu/cpufreq/boost");
        input = fopen(path, "r");
        if (input != NULL) {
-               fscanf(input, "%d", &turbo);
+               if (fscanf(input, "%d", &turbo) != 1)
+                       err(1, "%s: failed to parse number from file", path);
                fprintf(outf, "cpufreq boost: %d\n", turbo);
                fclose(input);
        }
@@ -3471,7 +3549,8 @@
        sprintf(path, "/sys/devices/system/cpu/intel_pstate/no_turbo");
        input = fopen(path, "r");
        if (input != NULL) {
-               fscanf(input, "%d", &turbo);
+               if (fscanf(input, "%d", &turbo) != 1)
+                       err(1, "%s: failed to parse number from file", path);
                fprintf(outf, "cpufreq intel_pstate no_turbo: %d\n", turbo);
                fclose(input);
        }
@@ -3715,7 +3794,7 @@
 #define        RAPL_POWER_GRANULARITY  0x7FFF  /* 15 bit power granularity */
 #define        RAPL_TIME_GRANULARITY   0x3F /* 6 bit time granularity */
 
-double get_tdp(unsigned int model)
+double get_tdp_intel(unsigned int model)
 {
        unsigned long long msr;
 
@@ -3724,14 +3803,24 @@
                        return ((msr >> 0) & RAPL_POWER_GRANULARITY) * 
rapl_power_units;
 
        switch (model) {
-       case INTEL_FAM6_ATOM_SILVERMONT1:
-       case INTEL_FAM6_ATOM_SILVERMONT2:
+       case INTEL_FAM6_ATOM_SILVERMONT:
+       case INTEL_FAM6_ATOM_SILVERMONT_X:
                return 30.0;
        default:
                return 135.0;
        }
 }
 
+double get_tdp_amd(unsigned int family)
+{
+       switch (family) {
+       case 0x17:
+       default:
+               /* This is the max stock TDP of HEDT/Server Fam17h chips */
+               return 250.0;
+       }
+}
+
 /*
  * rapl_dram_energy_units_probe()
  * Energy units are either hard-coded, or come from RAPL Energy Unit MSR.
@@ -3744,30 +3833,19 @@
        switch (model) {
        case INTEL_FAM6_HASWELL_X:      /* HSX */
        case INTEL_FAM6_BROADWELL_X:    /* BDX */
-       case INTEL_FAM6_BROADWELL_XEON_D:       /* BDX-DE */
        case INTEL_FAM6_XEON_PHI_KNL:   /* KNL */
-       case INTEL_FAM6_XEON_PHI_KNM:
                return (rapl_dram_energy_units = 15.3 / 1000000);
        default:
                return (rapl_energy_units);
        }
 }
 
-
-/*
- * rapl_probe()
- *
- * sets do_rapl, rapl_power_units, rapl_energy_units, rapl_time_units
- */
-void rapl_probe(unsigned int family, unsigned int model)
+void rapl_probe_intel(unsigned int family, unsigned int model)
 {
        unsigned long long msr;
        unsigned int time_unit;
        double tdp;
 
-       if (!genuine_intel)
-               return;
-
        if (family != 6)
                return;
 
@@ -3775,7 +3853,6 @@
        case INTEL_FAM6_SANDYBRIDGE:
        case INTEL_FAM6_IVYBRIDGE:
        case INTEL_FAM6_HASWELL_CORE:   /* HSW */
-       case INTEL_FAM6_HASWELL_ULT:    /* HSW */
        case INTEL_FAM6_HASWELL_GT3E:   /* HSW */
        case INTEL_FAM6_BROADWELL_CORE: /* BDW */
        case INTEL_FAM6_BROADWELL_GT3E: /* BDW */
@@ -3791,7 +3868,7 @@
                }
                break;
        case INTEL_FAM6_ATOM_GOLDMONT:  /* BXT */
-       case INTEL_FAM6_ATOM_GEMINI_LAKE:
+       case INTEL_FAM6_ATOM_GOLDMONT_PLUS:
                do_rapl = RAPL_PKG | RAPL_PKG_POWER_INFO;
                if (rapl_joules)
                        BIC_PRESENT(BIC_Pkg_J);
@@ -3799,9 +3876,6 @@
                        BIC_PRESENT(BIC_PkgWatt);
                break;
        case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
-       case INTEL_FAM6_SKYLAKE_DESKTOP:        /* SKL */
-       case INTEL_FAM6_KABYLAKE_MOBILE:        /* KBL */
-       case INTEL_FAM6_KABYLAKE_DESKTOP:       /* KBL */
        case INTEL_FAM6_CANNONLAKE_MOBILE:      /* CNL */
                do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_DRAM 
| RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_GFX | RAPL_PKG_POWER_INFO;
                BIC_PRESENT(BIC_PKG__);
@@ -3820,10 +3894,8 @@
                break;
        case INTEL_FAM6_HASWELL_X:      /* HSX */
        case INTEL_FAM6_BROADWELL_X:    /* BDX */
-       case INTEL_FAM6_BROADWELL_XEON_D:       /* BDX-DE */
        case INTEL_FAM6_SKYLAKE_X:      /* SKX */
        case INTEL_FAM6_XEON_PHI_KNL:   /* KNL */
-       case INTEL_FAM6_XEON_PHI_KNM:
                do_rapl = RAPL_PKG | RAPL_DRAM | RAPL_DRAM_POWER_INFO | 
RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_PKG_POWER_INFO;
                BIC_PRESENT(BIC_PKG__);
                BIC_PRESENT(BIC_RAM__);
@@ -3850,8 +3922,8 @@
                        BIC_PRESENT(BIC_RAMWatt);
                }
                break;
-       case INTEL_FAM6_ATOM_SILVERMONT1:       /* BYT */
-       case INTEL_FAM6_ATOM_SILVERMONT2:       /* AVN */
+       case INTEL_FAM6_ATOM_SILVERMONT:        /* BYT */
+       case INTEL_FAM6_ATOM_SILVERMONT_X:      /* AVN */
                do_rapl = RAPL_PKG | RAPL_CORES;
                if (rapl_joules) {
                        BIC_PRESENT(BIC_Pkg_J);
@@ -3861,7 +3933,7 @@
                        BIC_PRESENT(BIC_CorWatt);
                }
                break;
-       case INTEL_FAM6_ATOM_DENVERTON: /* DNV */
+       case INTEL_FAM6_ATOM_GOLDMONT_X:        /* DNV */
                do_rapl = RAPL_PKG | RAPL_DRAM | RAPL_DRAM_POWER_INFO | 
RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_PKG_POWER_INFO | 
RAPL_CORES_ENERGY_STATUS;
                BIC_PRESENT(BIC_PKG__);
                BIC_PRESENT(BIC_RAM__);
@@ -3884,7 +3956,7 @@
                return;
 
        rapl_power_units = 1.0 / (1 << (msr & 0xF));
-       if (model == INTEL_FAM6_ATOM_SILVERMONT1)
+       if (model == INTEL_FAM6_ATOM_SILVERMONT)
                rapl_energy_units = 1.0 * (1 << (msr >> 8 & 0x1F)) / 1000000;
        else
                rapl_energy_units = 1.0 / (1 << (msr >> 8 & 0x1F));
@@ -3897,13 +3969,69 @@
 
        rapl_time_units = 1.0 / (1 << (time_unit));
 
-       tdp = get_tdp(model);
+       tdp = get_tdp_intel(model);
 
        rapl_joule_counter_range = 0xFFFFFFFF * rapl_energy_units / tdp;
        if (!quiet)
                fprintf(outf, "RAPL: %.0f sec. Joule Counter Range, at %.0f 
Watts\n", rapl_joule_counter_range, tdp);
+}
 
-       return;
+void rapl_probe_amd(unsigned int family, unsigned int model)
+{
+       unsigned long long msr;
+       unsigned int eax, ebx, ecx, edx;
+       unsigned int has_rapl = 0;
+       double tdp;
+
+       if (max_extended_level >= 0x80000007) {
+               __cpuid(0x80000007, eax, ebx, ecx, edx);
+               /* RAPL (Fam 17h) */
+               has_rapl = edx & (1 << 14);
+       }
+
+       if (!has_rapl)
+               return;
+
+       switch (family) {
+       case 0x17: /* Zen, Zen+ */
+               do_rapl = RAPL_AMD_F17H | RAPL_PER_CORE_ENERGY;
+               if (rapl_joules) {
+                       BIC_PRESENT(BIC_Pkg_J);
+                       BIC_PRESENT(BIC_Cor_J);
+               } else {
+                       BIC_PRESENT(BIC_PkgWatt);
+                       BIC_PRESENT(BIC_CorWatt);
+               }
+               break;
+       default:
+               return;
+       }
+
+       if (get_msr(base_cpu, MSR_RAPL_PWR_UNIT, &msr))
+               return;
+
+       rapl_time_units = ldexp(1.0, -(msr >> 16 & 0xf));
+       rapl_energy_units = ldexp(1.0, -(msr >> 8 & 0x1f));
+       rapl_power_units = ldexp(1.0, -(msr & 0xf));
+
+       tdp = get_tdp_amd(model);
+
+       rapl_joule_counter_range = 0xFFFFFFFF * rapl_energy_units / tdp;
+       if (!quiet)
+               fprintf(outf, "RAPL: %.0f sec. Joule Counter Range, at %.0f 
Watts\n", rapl_joule_counter_range, tdp);
+}
+
+/*
+ * rapl_probe()
+ *
+ * sets do_rapl, rapl_power_units, rapl_energy_units, rapl_time_units
+ */
+void rapl_probe(unsigned int family, unsigned int model)
+{
+       if (genuine_intel)
+               rapl_probe_intel(family, model);
+       if (authentic_amd)
+               rapl_probe_amd(family, model);
 }
 
 void perf_limit_reasons_probe(unsigned int family, unsigned int model)
@@ -3916,7 +4044,6 @@
 
        switch (model) {
        case INTEL_FAM6_HASWELL_CORE:   /* HSW */
-       case INTEL_FAM6_HASWELL_ULT:    /* HSW */
        case INTEL_FAM6_HASWELL_GT3E:   /* HSW */
                do_gfx_perf_limit_reasons = 1;
        case INTEL_FAM6_HASWELL_X:      /* HSX */
@@ -4009,6 +4136,7 @@
 int print_rapl(struct thread_data *t, struct core_data *c, struct pkg_data *p)
 {
        unsigned long long msr;
+       const char *msr_name;
        int cpu;
 
        if (!do_rapl)
@@ -4024,10 +4152,17 @@
                return -1;
        }
 
-       if (get_msr(cpu, MSR_RAPL_POWER_UNIT, &msr))
-               return -1;
+       if (do_rapl & RAPL_AMD_F17H) {
+               msr_name = "MSR_RAPL_PWR_UNIT";
+               if (get_msr(cpu, MSR_RAPL_PWR_UNIT, &msr))
+                       return -1;
+       } else {
+               msr_name = "MSR_RAPL_POWER_UNIT";
+               if (get_msr(cpu, MSR_RAPL_POWER_UNIT, &msr))
+                       return -1;
+       }
 
-       fprintf(outf, "cpu%d: MSR_RAPL_POWER_UNIT: 0x%08llx (%f Watts, %f 
Joules, %f sec.)\n", cpu, msr,
+       fprintf(outf, "cpu%d: %s: 0x%08llx (%f Watts, %f Joules, %f sec.)\n", 
cpu, msr_name, msr,
                rapl_power_units, rapl_energy_units, rapl_time_units);
 
        if (do_rapl & RAPL_PKG_POWER_INFO) {
@@ -4128,21 +4263,16 @@
        case INTEL_FAM6_IVYBRIDGE_X:    /* IVB Xeon */
        case INTEL_FAM6_HASWELL_CORE:   /* HSW */
        case INTEL_FAM6_HASWELL_X:      /* HSW */
-       case INTEL_FAM6_HASWELL_ULT:    /* HSW */
        case INTEL_FAM6_HASWELL_GT3E:   /* HSW */
        case INTEL_FAM6_BROADWELL_CORE: /* BDW */
        case INTEL_FAM6_BROADWELL_GT3E: /* BDW */
        case INTEL_FAM6_BROADWELL_X:    /* BDX */
-       case INTEL_FAM6_BROADWELL_XEON_D:       /* BDX-DE */
        case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
-       case INTEL_FAM6_SKYLAKE_DESKTOP:        /* SKL */
-       case INTEL_FAM6_KABYLAKE_MOBILE:        /* KBL */
-       case INTEL_FAM6_KABYLAKE_DESKTOP:       /* KBL */
        case INTEL_FAM6_CANNONLAKE_MOBILE:      /* CNL */
        case INTEL_FAM6_SKYLAKE_X:      /* SKX */
        case INTEL_FAM6_ATOM_GOLDMONT:  /* BXT */
-       case INTEL_FAM6_ATOM_GEMINI_LAKE:
-       case INTEL_FAM6_ATOM_DENVERTON: /* DNV */
+       case INTEL_FAM6_ATOM_GOLDMONT_PLUS:
+       case INTEL_FAM6_ATOM_GOLDMONT_X:        /* DNV */
                return 1;
        }
        return 0;
@@ -4166,15 +4296,12 @@
                return 0;
 
        switch (model) {
-       case INTEL_FAM6_HASWELL_ULT:    /* HSW */
+       case INTEL_FAM6_HASWELL_CORE:
        case INTEL_FAM6_BROADWELL_CORE: /* BDW */
        case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
-       case INTEL_FAM6_SKYLAKE_DESKTOP:        /* SKL */
-       case INTEL_FAM6_KABYLAKE_MOBILE:        /* KBL */
-       case INTEL_FAM6_KABYLAKE_DESKTOP:       /* KBL */
        case INTEL_FAM6_CANNONLAKE_MOBILE:      /* CNL */
        case INTEL_FAM6_ATOM_GOLDMONT:  /* BXT */
-       case INTEL_FAM6_ATOM_GEMINI_LAKE:
+       case INTEL_FAM6_ATOM_GOLDMONT_PLUS:
                return 1;
        }
        return 0;
@@ -4195,9 +4322,6 @@
 
        switch (model) {
        case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
-       case INTEL_FAM6_SKYLAKE_DESKTOP:        /* SKL */
-       case INTEL_FAM6_KABYLAKE_MOBILE:        /* KBL */
-       case INTEL_FAM6_KABYLAKE_DESKTOP:       /* KBL */
        case INTEL_FAM6_CANNONLAKE_MOBILE:      /* CNL */
                return 1;
        }
@@ -4209,8 +4333,8 @@
        if (!genuine_intel)
                return 0;
        switch (model) {
-       case INTEL_FAM6_ATOM_SILVERMONT1:       /* BYT */
-       case INTEL_FAM6_ATOM_SILVERMONT2:       /* AVN */
+       case INTEL_FAM6_ATOM_SILVERMONT:        /* BYT */
+       case INTEL_FAM6_ATOM_SILVERMONT_X:      /* AVN */
                return 1;
        }
        return 0;
@@ -4222,7 +4346,6 @@
                return 0;
        switch (model) {
        case INTEL_FAM6_XEON_PHI_KNL:   /* KNL */
-       case INTEL_FAM6_XEON_PHI_KNM:
                return 1;
        }
        return 0;
@@ -4436,18 +4559,59 @@
                        base_cpu, msr, msr & (1 << 0) ? "EN" : "DIS");
 }
 
+/*
+ * When models are the same, for the purpose of turbostat, reuse
+ */
+unsigned int intel_model_duplicates(unsigned int model)
+{
+
+       switch(model) {
+       case INTEL_FAM6_NEHALEM_EP:     /* Core i7, Xeon 5500 series - 
Bloomfield, Gainstown NHM-EP */
+       case INTEL_FAM6_NEHALEM:        /* Core i7 and i5 Processor - 
Clarksfield, Lynnfield, Jasper Forest */
+       case 0x1F:      /* Core i7 and i5 Processor - Nehalem */
+       case INTEL_FAM6_WESTMERE:       /* Westmere Client - Clarkdale, 
Arrandale */
+       case INTEL_FAM6_WESTMERE_EP:    /* Westmere EP - Gulftown */
+               return INTEL_FAM6_NEHALEM;
+
+       case INTEL_FAM6_NEHALEM_EX:     /* Nehalem-EX Xeon - Beckton */
+       case INTEL_FAM6_WESTMERE_EX:    /* Westmere-EX Xeon - Eagleton */
+               return INTEL_FAM6_NEHALEM_EX;
+
+       case INTEL_FAM6_XEON_PHI_KNM:
+               return INTEL_FAM6_XEON_PHI_KNL;
+
+       case INTEL_FAM6_HASWELL_ULT:
+               return INTEL_FAM6_HASWELL_CORE;
+
+       case INTEL_FAM6_BROADWELL_X:
+       case INTEL_FAM6_BROADWELL_XEON_D:       /* BDX-DE */
+               return INTEL_FAM6_BROADWELL_X;
+
+       case INTEL_FAM6_SKYLAKE_MOBILE:
+       case INTEL_FAM6_SKYLAKE_DESKTOP:
+       case INTEL_FAM6_KABYLAKE_MOBILE:
+       case INTEL_FAM6_KABYLAKE_DESKTOP:
+               return INTEL_FAM6_SKYLAKE_MOBILE;
+
+       case INTEL_FAM6_ICELAKE_MOBILE:
+               return INTEL_FAM6_CANNONLAKE_MOBILE;
+       }
+       return model;
+}
 void process_cpuid()
 {
-       unsigned int eax, ebx, ecx, edx, max_level, max_extended_level;
-       unsigned int fms, family, model, stepping;
+       unsigned int eax, ebx, ecx, edx;
+       unsigned int fms, family, model, stepping, ecx_flags, edx_flags;
        unsigned int has_turbo;
 
        eax = ebx = ecx = edx = 0;
 
        __cpuid(0, max_level, ebx, ecx, edx);
 
-       if (ebx == 0x756e6547 && edx == 0x49656e69 && ecx == 0x6c65746e)
+       if (ebx == 0x756e6547 && ecx == 0x6c65746e && edx == 0x49656e69)
                genuine_intel = 1;
+       else if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65)
+               authentic_amd = 1;
 
        if (!quiet)
                fprintf(outf, "CPUID(0): %.4s%.4s%.4s ",
@@ -4461,25 +4625,8 @@
                family += (fms >> 20) & 0xff;
        if (family >= 6)
                model += ((fms >> 16) & 0xf) << 4;
-
-       if (!quiet) {
-               fprintf(outf, "%d CPUID levels; family:model:stepping 
0x%x:%x:%x (%d:%d:%d)\n",
-                       max_level, family, model, stepping, family, model, 
stepping);
-               fprintf(outf, "CPUID(1): %s %s %s %s %s %s %s %s %s %s\n",
-                       ecx & (1 << 0) ? "SSE3" : "-",
-                       ecx & (1 << 3) ? "MONITOR" : "-",
-                       ecx & (1 << 6) ? "SMX" : "-",
-                       ecx & (1 << 7) ? "EIST" : "-",
-                       ecx & (1 << 8) ? "TM2" : "-",
-                       edx & (1 << 4) ? "TSC" : "-",
-                       edx & (1 << 5) ? "MSR" : "-",
-                       edx & (1 << 22) ? "ACPI-TM" : "-",
-                       edx & (1 << 28) ? "HT" : "-",
-                       edx & (1 << 29) ? "TM" : "-");
-       }
-
-       if (!(edx & (1 << 5)))
-               errx(1, "CPUID: no MSR");
+       ecx_flags = ecx;
+       edx_flags = edx;
 
        /*
         * check max extended function levels of CPUID.
@@ -4489,6 +4636,27 @@
        ebx = ecx = edx = 0;
        __cpuid(0x80000000, max_extended_level, ebx, ecx, edx);
 
+       if (!quiet) {
+               fprintf(outf, "0x%x CPUID levels; 0x%x xlevels; 
family:model:stepping 0x%x:%x:%x (%d:%d:%d)\n",
+                       max_level, max_extended_level, family, model, stepping, 
family, model, stepping);
+               fprintf(outf, "CPUID(1): %s %s %s %s %s %s %s %s %s %s\n",
+                       ecx_flags & (1 << 0) ? "SSE3" : "-",
+                       ecx_flags & (1 << 3) ? "MONITOR" : "-",
+                       ecx_flags & (1 << 6) ? "SMX" : "-",
+                       ecx_flags & (1 << 7) ? "EIST" : "-",
+                       ecx_flags & (1 << 8) ? "TM2" : "-",
+                       edx_flags & (1 << 4) ? "TSC" : "-",
+                       edx_flags & (1 << 5) ? "MSR" : "-",
+                       edx_flags & (1 << 22) ? "ACPI-TM" : "-",
+                       edx_flags & (1 << 28) ? "HT" : "-",
+                       edx_flags & (1 << 29) ? "TM" : "-");
+       }
+       if (genuine_intel)
+               model = intel_model_duplicates(model);
+
+       if (!(edx_flags & (1 << 5)))
+               errx(1, "CPUID: no MSR");
+
        if (max_extended_level >= 0x80000007) {
 
                /*
@@ -4576,16 +4744,13 @@
                        if (crystal_hz == 0)
                                switch(model) {
                                case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
-                               case INTEL_FAM6_SKYLAKE_DESKTOP:        /* SKL 
*/
-                               case INTEL_FAM6_KABYLAKE_MOBILE:        /* KBL 
*/
-                               case INTEL_FAM6_KABYLAKE_DESKTOP:       /* KBL 
*/
                                        crystal_hz = 24000000;  /* 24.0 MHz */
                                        break;
-                               case INTEL_FAM6_ATOM_DENVERTON: /* DNV */
+                               case INTEL_FAM6_ATOM_GOLDMONT_X:        /* DNV 
*/
                                        crystal_hz = 25000000;  /* 25.0 MHz */
                                        break;
                                case INTEL_FAM6_ATOM_GOLDMONT:  /* BXT */
-                               case INTEL_FAM6_ATOM_GEMINI_LAKE:
+                               case INTEL_FAM6_ATOM_GOLDMONT_PLUS:
                                        crystal_hz = 19200000;  /* 19.2 MHz */
                                        break;
                                default:
@@ -4681,7 +4846,9 @@
        }
        do_slm_cstates = is_slm(family, model);
        do_knl_cstates  = is_knl(family, model);
-       do_cnl_cstates = is_cnl(family, model);
+
+       if (do_slm_cstates || do_knl_cstates || is_cnl(family, model))
+               BIC_NOT_PRESENT(BIC_CPU_c3);
 
        if (!quiet)
                decode_misc_pwr_mgmt_msr();
@@ -4748,6 +4915,7 @@
        int i;
        int max_core_id = 0;
        int max_package_id = 0;
+       int max_die_id = 0;
        int max_siblings = 0;
 
        /* Initialize num_cpus, max_cpu_num */
@@ -4814,6 +4982,11 @@
                if (cpus[i].physical_package_id > max_package_id)
                        max_package_id = cpus[i].physical_package_id;
 
+               /* get die information */
+               cpus[i].die_id = get_die_id(i);
+               if (cpus[i].die_id > max_die_id)
+                       max_die_id = cpus[i].die_id;
+
                /* get numa node information */
                cpus[i].physical_node_id = get_physical_node_id(&cpus[i]);
                if (cpus[i].physical_node_id > topo.max_node_num)
@@ -4839,6 +5012,13 @@
        if (!summary_only && topo.cores_per_node > 1)
                BIC_PRESENT(BIC_Core);
 
+       topo.num_die = max_die_id + 1;
+       if (debug > 1)
+               fprintf(outf, "max_die_id %d, sizing for %d die\n",
+                               max_die_id, topo.num_die);
+       if (!summary_only && topo.num_die > 1)
+               BIC_PRESENT(BIC_Die);
+
        topo.num_packages = max_package_id + 1;
        if (debug > 1)
                fprintf(outf, "max_package_id %d, sizing for %d packages\n",
@@ -4860,9 +5040,11 @@
                return;
 
        for (i = 0; i <= topo.max_cpu_num; ++i) {
+               if (cpu_is_not_present(i))
+                       continue;
                fprintf(outf,
-                       "cpu %d pkg %d node %d lnode %d core %d thread %d\n",
-                       i, cpus[i].physical_package_id,
+                       "cpu %d pkg %d die %d node %d lnode %d core %d thread 
%d\n",
+                       i, cpus[i].physical_package_id, cpus[i].die_id,
                        cpus[i].physical_node_id,
                        cpus[i].logical_node_id,
                        cpus[i].physical_core_id,
@@ -5054,6 +5236,9 @@
                signal(SIGQUIT, SIG_IGN);
                if (waitpid(child_pid, &status, 0) == -1)
                        err(status, "waitpid");
+
+               if (WIFEXITED(status))
+                       status = WEXITSTATUS(status);
        }
        /*
         * n.b. fork_it() does not check for errors from for_all_cpus()
@@ -5096,7 +5281,7 @@
 }
 
 void print_version() {
-       fprintf(outf, "turbostat version 18.07.27"
+       fprintf(outf, "turbostat version 19.03.20"
                " - Len Brown <l...@kernel.org>\n");
 }
 
@@ -5293,7 +5478,8 @@
                input = fopen(path, "r");
                if (input == NULL)
                        continue;
-               fgets(name_buf, sizeof(name_buf), input);
+               if (!fgets(name_buf, sizeof(name_buf), input))
+                       err(1, "%s: failed to read file", path);
 
                 /* truncate "C1-HSW\n" to "C1", or truncate "C1\n" to "C1" */
                sp = strchr(name_buf, '-');
@@ -5320,7 +5506,8 @@
                input = fopen(path, "r");
                if (input == NULL)
                        continue;
-               fgets(name_buf, sizeof(name_buf), input);
+               if (!fgets(name_buf, sizeof(name_buf), input))
+                       err(1, "%s: failed to read file", path);
                 /* truncate "C1-HSW\n" to "C1", or truncate "C1\n" to "C1" */
                sp = strchr(name_buf, '-');
                if (!sp)

++++++ turbostat_makefile_fix_asm_header.patch ++++++
--- /var/tmp/diff_new_pack.e8sRKP/_old  2019-04-09 20:19:03.373872716 +0200
+++ /var/tmp/diff_new_pack.e8sRKP/_new  2019-04-09 20:19:03.373872716 +0200
@@ -1,15 +1,15 @@
-Index: turbostat-4.16/Makefile
+Index: turbostat-19.03.20/Makefile
 ===================================================================
---- turbostat-4.16.orig/Makefile       2017-03-22 19:36:31.329182164 +0100
-+++ turbostat-4.16/Makefile    2017-03-22 19:38:04.762500669 +0100
-@@ -9,8 +9,8 @@ endif
+--- turbostat-19.03.20.orig/Makefile   2019-04-08 16:09:47.094469287 +0200
++++ turbostat-19.03.20/Makefile        2019-04-08 16:10:18.490470979 +0200
+@@ -10,8 +10,8 @@ endif
  
  turbostat : turbostat.c
- CFLAGS +=     -Wall
--CFLAGS +=     -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"'
--CFLAGS +=     
-DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"'
-+CFLAGS +=     -DMSRHEADER='"msr-index.h"'
-+CFLAGS +=     -DINTEL_FAMILY_HEADER='"intel-family.h"'
+ override CFLAGS +=    -Wall
+-override CFLAGS +=    
-DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"'
+-override CFLAGS +=    
-DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"'
++override CFLAGS +=    -DMSRHEADER='"msr-index.h"'
++override CFLAGS +=    -DINTEL_FAMILY_HEADER='"intel-family.h"'
  
  %: %.c
        @mkdir -p $(BUILD_OUTPUT)

++++++ x86_energy_perf_policy-17.05.11.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/x86_energy_perf_policy-17.05.11/Makefile 
new/x86_energy_perf_policy-17.05.11/Makefile
--- old/x86_energy_perf_policy-17.05.11/Makefile        2018-09-30 
16:15:35.000000000 +0200
+++ new/x86_energy_perf_policy-17.05.11/Makefile        2019-04-08 
07:51:09.000000000 +0200
@@ -9,12 +9,12 @@
 endif
 
 x86_energy_perf_policy : x86_energy_perf_policy.c
-CFLAGS +=      -Wall
-CFLAGS +=      -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"'
+override CFLAGS +=     -Wall
+override CFLAGS +=     
-DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"'
 
 %: %.c
        @mkdir -p $(BUILD_OUTPUT)
-       $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@
+       $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ $(LDFLAGS)
 
 .PHONY : clean
 clean :
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/x86_energy_perf_policy-17.05.11/msr-index.h 
new/x86_energy_perf_policy-17.05.11/msr-index.h
--- old/x86_energy_perf_policy-17.05.11/msr-index.h     2018-10-01 
15:59:05.900023072 +0200
+++ new/x86_energy_perf_policy-17.05.11/msr-index.h     2019-04-08 
15:09:28.306274298 +0200
@@ -41,9 +41,10 @@
 
 #define MSR_IA32_SPEC_CTRL             0x00000048 /* Speculation Control */
 #define SPEC_CTRL_IBRS                 (1 << 0)   /* Indirect Branch 
Restricted Speculation */
-#define SPEC_CTRL_STIBP                        (1 << 1)   /* Single Thread 
Indirect Branch Predictors */
+#define SPEC_CTRL_STIBP_SHIFT          1          /* Single Thread Indirect 
Branch Predictor (STIBP) bit */
+#define SPEC_CTRL_STIBP                        (1 << SPEC_CTRL_STIBP_SHIFT)    
/* STIBP mask */
 #define SPEC_CTRL_SSBD_SHIFT           2          /* Speculative Store Bypass 
Disable bit */
-#define SPEC_CTRL_SSBD                 (1 << SPEC_CTRL_SSBD_SHIFT)   /* 
Speculative Store Bypass Disable */
+#define SPEC_CTRL_SSBD                 (1 << SPEC_CTRL_SSBD_SHIFT)     /* 
Speculative Store Bypass Disable */
 
 #define MSR_IA32_PRED_CMD              0x00000049 /* Prediction Command */
 #define PRED_CMD_IBPB                  (1 << 0)   /* Indirect Branch 
Prediction Barrier */
@@ -120,7 +121,43 @@
 #define MSR_PEBS_LD_LAT_THRESHOLD      0x000003f6
 
 #define MSR_IA32_RTIT_CTL              0x00000570
+#define RTIT_CTL_TRACEEN               BIT(0)
+#define RTIT_CTL_CYCLEACC              BIT(1)
+#define RTIT_CTL_OS                    BIT(2)
+#define RTIT_CTL_USR                   BIT(3)
+#define RTIT_CTL_PWR_EVT_EN            BIT(4)
+#define RTIT_CTL_FUP_ON_PTW            BIT(5)
+#define RTIT_CTL_FABRIC_EN             BIT(6)
+#define RTIT_CTL_CR3EN                 BIT(7)
+#define RTIT_CTL_TOPA                  BIT(8)
+#define RTIT_CTL_MTC_EN                        BIT(9)
+#define RTIT_CTL_TSC_EN                        BIT(10)
+#define RTIT_CTL_DISRETC               BIT(11)
+#define RTIT_CTL_PTW_EN                        BIT(12)
+#define RTIT_CTL_BRANCH_EN             BIT(13)
+#define RTIT_CTL_MTC_RANGE_OFFSET      14
+#define RTIT_CTL_MTC_RANGE             (0x0full << RTIT_CTL_MTC_RANGE_OFFSET)
+#define RTIT_CTL_CYC_THRESH_OFFSET     19
+#define RTIT_CTL_CYC_THRESH            (0x0full << RTIT_CTL_CYC_THRESH_OFFSET)
+#define RTIT_CTL_PSB_FREQ_OFFSET       24
+#define RTIT_CTL_PSB_FREQ              (0x0full << RTIT_CTL_PSB_FREQ_OFFSET)
+#define RTIT_CTL_ADDR0_OFFSET          32
+#define RTIT_CTL_ADDR0                 (0x0full << RTIT_CTL_ADDR0_OFFSET)
+#define RTIT_CTL_ADDR1_OFFSET          36
+#define RTIT_CTL_ADDR1                 (0x0full << RTIT_CTL_ADDR1_OFFSET)
+#define RTIT_CTL_ADDR2_OFFSET          40
+#define RTIT_CTL_ADDR2                 (0x0full << RTIT_CTL_ADDR2_OFFSET)
+#define RTIT_CTL_ADDR3_OFFSET          44
+#define RTIT_CTL_ADDR3                 (0x0full << RTIT_CTL_ADDR3_OFFSET)
 #define MSR_IA32_RTIT_STATUS           0x00000571
+#define RTIT_STATUS_FILTEREN           BIT(0)
+#define RTIT_STATUS_CONTEXTEN          BIT(1)
+#define RTIT_STATUS_TRIGGEREN          BIT(2)
+#define RTIT_STATUS_BUFFOVF            BIT(3)
+#define RTIT_STATUS_ERROR              BIT(4)
+#define RTIT_STATUS_STOPPED            BIT(5)
+#define RTIT_STATUS_BYTECNT_OFFSET     32
+#define RTIT_STATUS_BYTECNT            (0x1ffffull << 
RTIT_STATUS_BYTECNT_OFFSET)
 #define MSR_IA32_RTIT_ADDR0_A          0x00000580
 #define MSR_IA32_RTIT_ADDR0_B          0x00000581
 #define MSR_IA32_RTIT_ADDR1_A          0x00000582
@@ -164,6 +201,7 @@
 #define DEBUGCTLMSR_BTS_OFF_OS         (1UL <<  9)
 #define DEBUGCTLMSR_BTS_OFF_USR                (1UL << 10)
 #define DEBUGCTLMSR_FREEZE_LBRS_ON_PMI (1UL << 11)
+#define DEBUGCTLMSR_FREEZE_PERFMON_ON_PMI      (1UL << 12)
 #define DEBUGCTLMSR_FREEZE_IN_SMM_BIT  14
 #define DEBUGCTLMSR_FREEZE_IN_SMM      (1UL << DEBUGCTLMSR_FREEZE_IN_SMM_BIT)
 
@@ -388,6 +426,7 @@
 #define MSR_F15H_NB_PERF_CTR           0xc0010241
 #define MSR_F15H_PTSC                  0xc0010280
 #define MSR_F15H_IC_CFG                        0xc0011021
+#define MSR_F15H_EX_CFG                        0xc001102c
 
 /* Fam 10h MSRs */
 #define MSR_FAM10H_MMIO_CONF_BASE      0xc0010058
@@ -627,6 +666,12 @@
 
 #define MSR_IA32_TSC_DEADLINE          0x000006E0
 
+
+#define MSR_TSX_FORCE_ABORT            0x0000010F
+
+#define MSR_TFA_RTM_FORCE_ABORT_BIT    0
+#define MSR_TFA_RTM_FORCE_ABORT                
BIT_ULL(MSR_TFA_RTM_FORCE_ABORT_BIT)
+
 /* P4/Xeon+ specific */
 #define MSR_IA32_MCG_EAX               0x00000180
 #define MSR_IA32_MCG_EBX               0x00000181
@@ -769,6 +814,7 @@
 #define VMX_BASIC_INOUT                0x0040000000000000LLU
 
 /* MSR_IA32_VMX_MISC bits */
+#define MSR_IA32_VMX_MISC_INTEL_PT                 (1ULL << 14)
 #define MSR_IA32_VMX_MISC_VMWRITE_SHADOW_RO_FIELDS (1ULL << 29)
 #define MSR_IA32_VMX_MISC_PREEMPTION_TIMER_SCALE   0x1F
 /* AMD-V MSRs */

++++++ x86_perf_makefile_fix_asm_header.patch ++++++
--- /var/tmp/diff_new_pack.e8sRKP/_old  2019-04-09 20:19:03.425872787 +0200
+++ /var/tmp/diff_new_pack.e8sRKP/_new  2019-04-09 20:19:03.425872787 +0200
@@ -1,13 +1,13 @@
 Index: x86_energy_perf_policy-17.05.11/Makefile
 ===================================================================
---- x86_energy_perf_policy-17.05.11.orig/Makefile      2017-12-21 
01:52:01.000000000 +0100
-+++ x86_energy_perf_policy-17.05.11/Makefile   2018-01-09 16:17:56.058472491 
+0100
+--- x86_energy_perf_policy-17.05.11.orig/Makefile      2019-04-08 
16:05:22.534455032 +0200
++++ x86_energy_perf_policy-17.05.11/Makefile   2019-04-08 16:05:52.306456636 
+0200
 @@ -10,7 +10,7 @@ endif
  
  x86_energy_perf_policy : x86_energy_perf_policy.c
- CFLAGS +=     -Wall
--CFLAGS +=     -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"'
-+CFLAGS +=     -DMSRHEADER='"msr-index.h"'
+ override CFLAGS +=    -Wall
+-override CFLAGS +=    
-DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"'
++override CFLAGS +=    -DMSRHEADER='"msr-index.h"'
  
  %: %.c
        @mkdir -p $(BUILD_OUTPUT)


Reply via email to