From patchwork Mon Jul 6 02:17:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 50689 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 77BF1229E5 for ; Mon, 6 Jul 2015 02:22:19 +0000 (UTC) Received: by laar3 with SMTP id r3sf42578722laa.1 for ; Sun, 05 Jul 2015 19:22:18 -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:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:cc:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=qWPh+trXgB2O3o+tTuoAq73UJkwMFphwxs48+e/aI2M=; b=ku74IaB4Mrxm8/qBK5s194CyyOU1U0UHTa0KTRXEmwnhJ2sFB1xZ5bWjFQE+9jdigd UitxCj3+qHqqWTE8qzLmoNHY1Vof5FolaWRRzubvqsmBzXqBe6wbmqlU1LQ1rV4SbUMQ /vfAnhUk2bdk4DIbdc3T13YfvPDk4dVQzE/AdT6bDpn5DN4dS8spHHWkL6eBb4ktV0XJ AZn92/SJL70eD5zHaeptwqLojbUYJfjQvCrsQ7vUxsjtSOU7sJq2izvXnhlMU1pJORZh wn840vAohhJU6IBsHHylUCXe4+vOS6JpOuNGrV8xv4ouvz7NxAkvEIfM3meOE8Vn8v9T LvMQ== X-Gm-Message-State: ALoCoQnZOrQ8T+29ld8JYS7J7qJTP3FyGB1QAbu3WcX48U8EtaYOZmKkn26uMI+RVT1WYlD2wgka X-Received: by 10.112.55.104 with SMTP id r8mr29316647lbp.18.1436149338246; Sun, 05 Jul 2015 19:22:18 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.163.65 with SMTP id yg1ls584104lab.26.gmail; Sun, 05 Jul 2015 19:22:18 -0700 (PDT) X-Received: by 10.152.45.9 with SMTP id i9mr45822957lam.87.1436149337961; Sun, 05 Jul 2015 19:22:17 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id w5si13958383laa.59.2015.07.05.19.22.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Jul 2015 19:22:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by laar3 with SMTP id r3so137724502laa.0 for ; Sun, 05 Jul 2015 19:22:17 -0700 (PDT) X-Received: by 10.112.222.133 with SMTP id qm5mr46693800lbc.86.1436149337832; Sun, 05 Jul 2015 19:22:17 -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 hn6csp1426700lbb; Sun, 5 Jul 2015 19:22:16 -0700 (PDT) X-Received: by 10.68.217.2 with SMTP id ou2mr2839181pbc.71.1436149336113; Sun, 05 Jul 2015 19:22:16 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id o1si26459712pdh.16.2015.07.05.19.22.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Jul 2015 19:22:16 -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 1ZBw11-0000OO-90; Mon, 06 Jul 2015 02:20:15 +0000 Received: from mail-pa0-f43.google.com ([209.85.220.43]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZBw06-0006Aq-Uo for linux-arm-kernel@lists.infradead.org; Mon, 06 Jul 2015 02:19:19 +0000 Received: by pactm7 with SMTP id tm7so86959559pac.2 for ; Sun, 05 Jul 2015 19:18:58 -0700 (PDT) X-Received: by 10.68.229.40 with SMTP id sn8mr98898881pbc.59.1436149138012; Sun, 05 Jul 2015 19:18:58 -0700 (PDT) Received: from localhost ([120.136.34.248]) by mx.google.com with ESMTPSA id ml6sm16212407pdb.69.2015.07.05.19.18.55 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 05 Jul 2015 19:18:56 -0700 (PDT) From: shannon.zhao@linaro.org To: kvmarm@lists.cs.columbia.edu Subject: [PATCH 13/18] KVM: ARM64: Add reset and access handlers for PMOVSSET_EL0 and PMOVSCLR_EL0 register Date: Mon, 6 Jul 2015 10:17:43 +0800 Message-Id: <1436149068-3784-14-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1436149068-3784-1-git-send-email-shannon.zhao@linaro.org> References: <1436149068-3784-1-git-send-email-shannon.zhao@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150705_191919_030147_8F380598 X-CRM114-Status: GOOD ( 11.88 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.43 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.220.43 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Cc: kvm@vger.kernel.org, marc.zyngier@arm.com, will.deacon@arm.com, linux-arm-kernel@lists.infradead.org, zhaoshenglong@huawei.com, alex.bennee@linaro.org, christoffer.dall@linaro.org, shannon.zhao@linaro.org 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: shannon.zhao@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.46 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 From: Shannon Zhao Since the reset value of PMOVSSET_EL0 and PMOVSCLR_EL0 is UNKNOWN, use reset_unknown for its reset handler. Add access handler which emulates writing and reading PMOVSSET_EL0 or PMOVSCLR_EL0 register. Signed-off-by: Shannon Zhao --- arch/arm64/kvm/sys_regs.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index cbc07b8..ec80937 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -496,6 +496,32 @@ static bool access_pmintenclr(struct kvm_vcpu *vcpu, return true; } +/* PMOVSSET_EL0 accessor. */ +static bool access_pmovsset(struct kvm_vcpu *vcpu, + const struct sys_reg_params *p, + const struct sys_reg_desc *r) +{ + if (p->is_write) + vcpu->arch.pmu.overflow_status |= *vcpu_reg(vcpu, p->Rt); + else + *vcpu_reg(vcpu, p->Rt) = vcpu->arch.pmu.overflow_status; + + return true; +} + +/* PMOVSCLR_EL0 accessor. */ +static bool access_pmovsclr(struct kvm_vcpu *vcpu, + const struct sys_reg_params *p, + const struct sys_reg_desc *r) +{ + if (p->is_write) + vcpu->arch.pmu.overflow_status &= (~*vcpu_reg(vcpu, p->Rt)); + else + *vcpu_reg(vcpu, p->Rt) = vcpu->arch.pmu.overflow_status; + + return true; +} + /* Silly macro to expand the DBG{BCR,BVR,WVR,WCR}n_EL1 registers in one go */ #define DBG_BCR_BVR_WCR_WVR_EL1(n) \ /* DBGBVRn_EL1 */ \ @@ -696,7 +722,7 @@ static const struct sys_reg_desc sys_reg_descs[] = { access_pmcntenclr, reset_unknown, PMCNTENCLR_EL0 }, /* PMOVSCLR_EL0 */ { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b011), - trap_raz_wi }, + access_pmovsclr, reset_unknown, PMOVSCLR_EL0 }, /* PMSWINC_EL0 */ { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b100), trap_raz_wi }, @@ -723,7 +749,7 @@ static const struct sys_reg_desc sys_reg_descs[] = { trap_raz_wi }, /* PMOVSSET_EL0 */ { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1110), Op2(0b011), - trap_raz_wi }, + access_pmovsset, reset_unknown, PMOVSSET_EL0 }, /* TPIDR_EL0 */ { Op0(0b11), Op1(0b011), CRn(0b1101), CRm(0b0000), Op2(0b010),