From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47623) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkFys-0006yB-Ip for qemu-devel@nongnu.org; Fri, 31 Oct 2014 13:27:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XkFyn-00081Q-9C for qemu-devel@nongnu.org; Fri, 31 Oct 2014 13:27:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53156) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkFyn-00081F-1t for qemu-devel@nongnu.org; Fri, 31 Oct 2014 13:27:17 -0400 From: Paolo Bonzini Date: Fri, 31 Oct 2014 18:26:06 +0100 Message-Id: <1414776373-9704-29-git-send-email-pbonzini@redhat.com> In-Reply-To: <1414776373-9704-1-git-send-email-pbonzini@redhat.com> References: <1414776373-9704-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 28/35] kvm_stat: Add powerpc support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Michael Ellerman From: Michael Ellerman Add support for powerpc platforms. We use uname -m, which allows us to detect ppc, ppc64 and ppc64le/el. Signed-off-by: Michael Ellerman Signed-off-by: Paolo Bonzini --- scripts/kvm/kvm_stat | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat index a65d0a3..7b1437c 100755 --- a/scripts/kvm/kvm_stat +++ b/scripts/kvm/kvm_stat @@ -12,7 +12,7 @@ # the COPYING file in the top-level directory. import curses -import sys, os, time, optparse +import sys, os, time, optparse, ctypes class DebugfsProvider(object): def __init__(self): @@ -194,7 +194,21 @@ def s390_init(): 'sc_perf_evt_open' : 331 }) +def ppc_init(): + globals().update({ + 'sc_perf_evt_open' : 319, + 'ioctl_numbers' : { + 'SET_FILTER' : 0x80002406 | (ctypes.sizeof(ctypes.c_char_p) << 16), + 'ENABLE' : 0x20002400, + 'DISABLE' : 0x20002401, + } + }) + def detect_platform(): + if os.uname()[4].startswith('ppc'): + ppc_init() + return + for line in file('/proc/cpuinfo').readlines(): if line.startswith('flags'): for flag in line.split(): @@ -217,7 +231,7 @@ filters['kvm_userspace_exit'] = ('reason', invert(userspace_exit_reasons)) if exit_reasons: filters['kvm_exit'] = ('exit_reason', invert(exit_reasons)) -import ctypes, struct, array +import struct, array libc = ctypes.CDLL('libc.so.6') syscall = libc.syscall -- 1.8.3.1