From patchwork Tue Jun 17 07:54:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 360426 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B6EB3140085 for ; Tue, 17 Jun 2014 19:49:08 +1000 (EST) Received: from localhost ([::1]:48548 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wwq0o-0005CS-Q1 for incoming@patchwork.ozlabs.org; Tue, 17 Jun 2014 05:49:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwoER-0002M4-Qc for qemu-devel@nongnu.org; Tue, 17 Jun 2014 03:55:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwoEJ-0002Ay-20 for qemu-devel@nongnu.org; Tue, 17 Jun 2014 03:55:03 -0400 Received: from ozlabs.org ([103.22.144.67]:51650) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwoEI-0002Ao-Mb for qemu-devel@nongnu.org; Tue, 17 Jun 2014 03:54:54 -0400 Received: by ozlabs.org (Postfix, from userid 1034) id 61CA41400D5; Tue, 17 Jun 2014 17:54:50 +1000 (EST) From: Michael Ellerman To: qemu-devel@nongnu.org Date: Tue, 17 Jun 2014 17:54:35 +1000 Message-Id: <1402991675-24905-6-git-send-email-mpe@ellerman.id.au> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1402991675-24905-1-git-send-email-mpe@ellerman.id.au> References: <1402991675-24905-1-git-send-email-mpe@ellerman.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 103.22.144.67 X-Mailman-Approved-At: Tue, 17 Jun 2014 05:47:18 -0400 Cc: kvm@vger.kernel.org, aik@ozlabs.ru, jan.kiszka@siemens.com, agraf@suse.de, jfrei@linux.vnet.ibm.com, alfs@linux.vnet.ibm.com, pbonzini@redhat.com Subject: [Qemu-devel] [PATCH 6/6] kvm_stat: Add powerpc support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add support for powerpc platforms. We use uname -m, which allows us to detect ppc, ppc64 and ppc64le/el. Signed-off-by: Michael Ellerman --- 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 2e0f5ed..db867fe 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): @@ -199,7 +199,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(): @@ -220,7 +234,7 @@ def invert(d): for f in filters: filters[f] = (filters[f][0], invert(filters[f][1])) -import ctypes, struct, array +import struct, array libc = ctypes.CDLL('libc.so.6') syscall = libc.syscall