From patchwork Mon Jun 22 10:41:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhichao Huang X-Patchwork-Id: 50153 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3922821575 for ; Mon, 22 Jun 2015 10:47:23 +0000 (UTC) Received: by wguu7 with SMTP id u7sf28003676wgu.0 for ; Mon, 22 Jun 2015 03:47:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=NkO2K6GQL2aC1KMDwfnEzo2kycmohnf9h/k3kegi1r8=; b=eteB2lipx8SKuWbdFYiDrux3qQQG/v3lU0ZWdd36ia2fhFm37k34wuOW4dzXyQDD+U zDyEHjkiUN0v8hCYdV67uEQJk6WXqsucUOVTVykV2X74VFzSUKZZXZYqnJFIX4W1fESo SZocZeVg/wCDvWQBAW32QqUGBNGGcRLMyeMIFpj8tvCuMG9LFp6Oke2uYkobHTKmd/o/ ZSTunqnwz0YuYuXJJPDswP0/I2Jga3F4TJ7I+vCMhQTRX4VnLFPg7BKID8dhX1zom1Eb l+ATLsMJ/WhuCt7qbBYLlnqiJZwnegZfq8lekkSWuja1hoD9mHCAI3lPSB1WRuOUX/TV UeIg== X-Gm-Message-State: ALoCoQmJ5SskyLykbMMCYClUbnligKhuzQJhApOH+LIFSUIn1rVDRwcADRL79jR+jY5j4g9hVgMh X-Received: by 10.152.37.101 with SMTP id x5mr27495105laj.5.1434970042519; Mon, 22 Jun 2015 03:47:22 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.195 with SMTP id o3ls35985laf.1.gmail; Mon, 22 Jun 2015 03:47:22 -0700 (PDT) X-Received: by 10.152.3.33 with SMTP id 1mr29516392laz.109.1434970042371; Mon, 22 Jun 2015 03:47:22 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id lf11si16213932lac.125.2015.06.22.03.47.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jun 2015 03:47:22 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by lacny3 with SMTP id ny3so107042846lac.3 for ; Mon, 22 Jun 2015 03:47:22 -0700 (PDT) X-Received: by 10.112.93.37 with SMTP id cr5mr29850300lbb.106.1434970042267; Mon, 22 Jun 2015 03:47:22 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp2289923lbb; Mon, 22 Jun 2015 03:47:21 -0700 (PDT) X-Received: by 10.68.201.168 with SMTP id kb8mr57075260pbc.50.1434970040545; Mon, 22 Jun 2015 03:47:20 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id hg4si17355597pbc.9.2015.06.22.03.47.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jun 2015 03:47:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z6zEJ-0000oK-IF; Mon, 22 Jun 2015 10:45:31 +0000 Received: from mail-pd0-f169.google.com ([209.85.192.169]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z6zBl-0005y7-RA for linux-arm-kernel@lists.infradead.org; Mon, 22 Jun 2015 10:42:54 +0000 Received: by pdbki1 with SMTP id ki1so136443347pdb.1 for ; Mon, 22 Jun 2015 03:42:33 -0700 (PDT) X-Received: by 10.70.90.162 with SMTP id bx2mr33557262pdb.60.1434969753199; Mon, 22 Jun 2015 03:42:33 -0700 (PDT) Received: from localhost ([104.207.83.42]) by mx.google.com with ESMTPSA id f4sm19430396pdc.95.2015.06.22.03.42.31 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 22 Jun 2015 03:42:32 -0700 (PDT) From: Zhichao Huang To: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org, marc.zyngier@arm.com, alex.bennee@linaro.org, will.deacon@arm.com Subject: [PATCH v3 10/11] KVM: arm: add a trace event for cp14 traps Date: Mon, 22 Jun 2015 18:41:33 +0800 Message-Id: <1434969694-7432-11-git-send-email-zhichao.huang@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1434969694-7432-1-git-send-email-zhichao.huang@linaro.org> References: <1434969694-7432-1-git-send-email-zhichao.huang@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150622_034253_937160_FAC9F637 X-CRM114-Status: UNSURE ( 9.65 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.192.169 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.192.169 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record Cc: huangzhichao@huawei.com, Zhichao Huang X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: zhichao.huang@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 There are too many cp15 traps, so we don't reuse the cp15 trace event but add a new trace event to trace the access of debug registers. Signed-off-by: Zhichao Huang Acked-by: Christoffer Dall --- arch/arm/kvm/coproc.c | 14 ++++++++++++++ arch/arm/kvm/trace.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/arch/arm/kvm/coproc.c b/arch/arm/kvm/coproc.c index fc0c2ef..42b720a 100644 --- a/arch/arm/kvm/coproc.c +++ b/arch/arm/kvm/coproc.c @@ -678,6 +678,13 @@ int kvm_handle_cp_64(struct kvm_vcpu *vcpu, params.Rt2 = (kvm_vcpu_get_hsr(vcpu) >> 10) & 0xf; params.CRm = 0; + if (global == cp14_regs) + trace_kvm_emulate_cp14_imp(params.Op1, params.Rt1, params.CRn, + params.CRm, params.Op2, params.is_write); + else + trace_kvm_emulate_cp15_imp(params.Op1, params.Rt1, params.CRn, + params.CRm, params.Op2, params.is_write); + if (!emulate_cp(vcpu, ¶ms, target_specific, nr_specific)) return 1; if (!emulate_cp(vcpu, ¶ms, global, nr_global)) @@ -715,6 +722,13 @@ int kvm_handle_cp_32(struct kvm_vcpu *vcpu, params.Op2 = (kvm_vcpu_get_hsr(vcpu) >> 17) & 0x7; params.Rt2 = 0; + if (global == cp14_regs) + trace_kvm_emulate_cp14_imp(params.Op1, params.Rt1, params.CRn, + params.CRm, params.Op2, params.is_write); + else + trace_kvm_emulate_cp15_imp(params.Op1, params.Rt1, params.CRn, + params.CRm, params.Op2, params.is_write); + if (!emulate_cp(vcpu, ¶ms, target_specific, nr_specific)) return 1; if (!emulate_cp(vcpu, ¶ms, global, nr_global)) diff --git a/arch/arm/kvm/trace.h b/arch/arm/kvm/trace.h index 0ec3539..988da03 100644 --- a/arch/arm/kvm/trace.h +++ b/arch/arm/kvm/trace.h @@ -159,6 +159,36 @@ TRACE_EVENT(kvm_emulate_cp15_imp, __entry->CRm, __entry->Op2) ); +/* Architecturally implementation defined CP14 register access */ +TRACE_EVENT(kvm_emulate_cp14_imp, + TP_PROTO(unsigned long Op1, unsigned long Rt1, unsigned long CRn, + unsigned long CRm, unsigned long Op2, bool is_write), + TP_ARGS(Op1, Rt1, CRn, CRm, Op2, is_write), + + TP_STRUCT__entry( + __field( unsigned int, Op1 ) + __field( unsigned int, Rt1 ) + __field( unsigned int, CRn ) + __field( unsigned int, CRm ) + __field( unsigned int, Op2 ) + __field( bool, is_write ) + ), + + TP_fast_assign( + __entry->is_write = is_write; + __entry->Op1 = Op1; + __entry->Rt1 = Rt1; + __entry->CRn = CRn; + __entry->CRm = CRm; + __entry->Op2 = Op2; + ), + + TP_printk("Implementation defined CP14: %s\tp14, %u, r%u, c%u, c%u, %u", + (__entry->is_write) ? "mcr" : "mrc", + __entry->Op1, __entry->Rt1, __entry->CRn, + __entry->CRm, __entry->Op2) +); + TRACE_EVENT(kvm_wfx, TP_PROTO(unsigned long vcpu_pc, bool is_wfe), TP_ARGS(vcpu_pc, is_wfe),