From patchwork Thu Sep 24 22:31:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 54137 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 5AB9122B1E for ; Thu, 24 Sep 2015 22:34:17 +0000 (UTC) Received: by wicgb1 with SMTP id gb1sf1217112wic.3 for ; Thu, 24 Sep 2015 15:34:16 -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=9DHNsbYlmAEV235jmyvhfjwmqT+fMxs4VoPL7WDZNfY=; b=iGvo2GplcGEBLUVlqiHo4j0eggjmVphMOaRSfo4xISl/qIeu+OAAmKUAo9HxXW8GfM bD9mY+Rz7k+tCC1o+6H61fMSe1vZkX7e6tsN4eoUs9a/L0kH8kM0dwUrSxi7+yYxfXmX 65pUMBEh3KaHPswvmUhC6cG1dQoQwUAKiwJDETEBUQPdXKNlx9ynafbotU1h39/o/vOt 3JIcpXES8F9V5w4DcXJwrpjV1xpFaOpQS+VcGn8ilAgB1YqlPic9FJqcVpCsR2t4pXHw Ya98A2nsoxzlVwRnfPyKGMpCTZuIZgs2puM1SS1gBU0oQ34aRDVQZNGq5nDtZh8i4qhM j66A== X-Gm-Message-State: ALoCoQm6xHmWIJ+gSS+PzEPxFtfneG+tjSlq53PneCKD3WZLV0r2fDxagsvmiclm5gsmLHieZJvQ X-Received: by 10.180.9.104 with SMTP id y8mr1807670wia.7.1443134056667; Thu, 24 Sep 2015 15:34:16 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.45.73 with SMTP id k9ls127688lam.19.gmail; Thu, 24 Sep 2015 15:34:16 -0700 (PDT) X-Received: by 10.25.141.198 with SMTP id p189mr412538lfd.9.1443134056448; Thu, 24 Sep 2015 15:34:16 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id ms1si235302lbb.159.2015.09.24.15.34.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Sep 2015 15:34:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by lahh2 with SMTP id h2so78667353lah.0 for ; Thu, 24 Sep 2015 15:34:16 -0700 (PDT) X-Received: by 10.112.168.66 with SMTP id zu2mr611284lbb.29.1443134056249; Thu, 24 Sep 2015 15:34:16 -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.59.35 with SMTP id w3csp585693lbq; Thu, 24 Sep 2015 15:34:15 -0700 (PDT) X-Received: by 10.66.194.138 with SMTP id hw10mr2623554pac.71.1443134055266; Thu, 24 Sep 2015 15:34:15 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id r6si673603pap.181.2015.09.24.15.34.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Sep 2015 15:34:15 -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 1ZfF4k-0007pE-Mo; Thu, 24 Sep 2015 22:33:14 +0000 Received: from mail-pa0-f49.google.com ([209.85.220.49]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZfF44-0006yR-W9 for linux-arm-kernel@lists.infradead.org; Thu, 24 Sep 2015 22:32:34 +0000 Received: by padhy16 with SMTP id hy16so85162351pad.1 for ; Thu, 24 Sep 2015 15:32:12 -0700 (PDT) X-Received: by 10.68.89.100 with SMTP id bn4mr2609443pbb.93.1443133932287; Thu, 24 Sep 2015 15:32:12 -0700 (PDT) Received: from localhost.localdomain ([40.139.248.3]) by smtp.gmail.com with ESMTPSA id ll9sm325723pbc.42.2015.09.24.15.32.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 24 Sep 2015 15:32:10 -0700 (PDT) From: Shannon Zhao To: kvmarm@lists.cs.columbia.edu Subject: [PATCH v3 05/20] KVM: ARM64: Add reset and access handlers for PMSELR register Date: Thu, 24 Sep 2015 15:31:10 -0700 Message-Id: <1443133885-3366-6-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1443133885-3366-1-git-send-email-shannon.zhao@linaro.org> References: <1443133885-3366-1-git-send-email-shannon.zhao@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150924_153233_224690_2F6435C6 X-CRM114-Status: GOOD ( 13.48 ) 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.49 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.220.49 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] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 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: wei@redhat.com, kvm@vger.kernel.org, marc.zyngier@arm.com, will.deacon@arm.com, peter.huangpeng@huawei.com, linux-arm-kernel@lists.infradead.org, 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.48 as permitted sender) smtp.mailfrom=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 Since the reset value of PMSELR_EL0 is UNKNOWN, use reset_unknown for its reset handler. As it doesn't need to deal with the acsessing action specially, it uses default case to emulate writing and reading PMSELR register. Add a helper for CP15 registers reset to UNKNOWN. Signed-off-by: Shannon Zhao --- arch/arm64/kvm/sys_regs.c | 5 +++-- arch/arm64/kvm/sys_regs.h | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 60c0842..f73aea9 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -700,7 +700,7 @@ static const struct sys_reg_desc sys_reg_descs[] = { trap_raz_wi }, /* PMSELR_EL0 */ { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b101), - trap_raz_wi }, + access_pmu_regs, reset_unknown, PMSELR_EL0 }, /* PMCEID0_EL0 */ { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b110), trap_raz_wi }, @@ -980,7 +980,8 @@ static const struct sys_reg_desc cp15_regs[] = { { Op1( 0), CRn( 9), CRm(12), Op2( 1), trap_raz_wi }, { Op1( 0), CRn( 9), CRm(12), Op2( 2), trap_raz_wi }, { Op1( 0), CRn( 9), CRm(12), Op2( 3), trap_raz_wi }, - { Op1( 0), CRn( 9), CRm(12), Op2( 5), trap_raz_wi }, + { Op1( 0), CRn( 9), CRm(12), Op2( 5), access_pmu_cp15_regs, + reset_unknown_cp15, c9_PMSELR }, { Op1( 0), CRn( 9), CRm(12), Op2( 6), trap_raz_wi }, { Op1( 0), CRn( 9), CRm(12), Op2( 7), trap_raz_wi }, { Op1( 0), CRn( 9), CRm(13), Op2( 0), trap_raz_wi }, diff --git a/arch/arm64/kvm/sys_regs.h b/arch/arm64/kvm/sys_regs.h index eaa324e..8afeff7 100644 --- a/arch/arm64/kvm/sys_regs.h +++ b/arch/arm64/kvm/sys_regs.h @@ -110,6 +110,14 @@ static inline void reset_unknown(struct kvm_vcpu *vcpu, vcpu_sys_reg(vcpu, r->reg) = 0x1de7ec7edbadc0deULL; } +static inline void reset_unknown_cp15(struct kvm_vcpu *vcpu, + const struct sys_reg_desc *r) +{ + BUG_ON(!r->reg); + BUG_ON(r->reg >= NR_COPRO_REGS); + vcpu_cp15(vcpu, r->reg) = 0xdecafbad; +} + static inline void reset_val(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r) { BUG_ON(!r->reg);