Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1585430ybm; Thu, 23 May 2019 03:38:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzg6cVaKiTFlSv+lr3ioi+k+9cQF6n7pAmFmKRsUSGnnkzPZHsLg/DN/4GMB8f8puOYXSG X-Received: by 2002:a17:902:704a:: with SMTP id h10mr7304981plt.294.1558607881169; Thu, 23 May 2019 03:38:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558607881; cv=none; d=google.com; s=arc-20160816; b=H62Woh5a0kJd7rN2mApxmg7QICEBm0F2H+nhcVUffHUC6Ol59CWaGeiF2KQTsowqhn smCIEy8AG3I0sAs/Pd6yKMLMAoxZaOq0CjwemgqgeJvbkGOWq+PbhLAmKeAJVGV2TABR jJNG+GroTXNfwgv286hYm0LyximvdEZgzs1VrRzsjZfPc0bRvj8Wp9Yw+FC9LX99x3Mq ABknFUDYsxsh+QqH2Z9ZcDF3x/rTaT4fwuW8j9IxgJ8s9zau/dXv4570T0vGK9khXix0 XMqV+/0ermCxNz2gAzfmD1BvXIPIduexYrxidP0aj+1A6w1u7QwHzwvT2Dz+qObo8uQd qq/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=UQ5FoJ5EZ+9/q4T155+wqMoW3U9+yqA0ixiWNPyeIcQ=; b=Izf2lnh/vwLP52X3oLCmBytRWL0fl+9ekG47iArgiN1J+tqrP5jF/ldfFxshvDCwfI XeCbAihuZR+IPXW/jhUYMnwgsWIa4vQWKy7Lgrm6ighLIIX07+WPcRLXXz2LVK39n2Qk eQWjNGQfXedcQwBa63bEms5AHFuoAaXi2uPPLPOOCvz5EZM/Mwi29P31u5vEuDltKSph EDJOF0ZFlGp6fM1gv7jsKBqc7ipQRTAjUyvcymOqCXQdbJo42jeu1RU8JbVWjTnsHuIw KL6st9OVz2fItB0n1nJddI1xCEAVMHYfcHKBXTScMZjb9zRUjiDu0BUl1aAAPeLpeOC2 MzGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o7si28518391plk.264.2019.05.23.03.37.45; Thu, 23 May 2019 03:38:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730789AbfEWKgN (ORCPT + 99 others); Thu, 23 May 2019 06:36:13 -0400 Received: from foss.arm.com ([217.140.101.70]:43142 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730658AbfEWKfr (ORCPT ); Thu, 23 May 2019 06:35:47 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BCCA415BF; Thu, 23 May 2019 03:35:46 -0700 (PDT) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A06F23F718; Thu, 23 May 2019 03:35:44 -0700 (PDT) From: Sudeep Holla To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Cc: Sudeep Holla , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Christoffer Dall , Marc Zyngier , James Morse , Suzuki K Pouloze , Catalin Marinas , Will Deacon , Julien Thierry Subject: [PATCH v2 11/15] arm64: KVM/debug: trap all accesses to SPE controls at EL1 Date: Thu, 23 May 2019 11:34:58 +0100 Message-Id: <20190523103502.25925-12-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190523103502.25925-1-sudeep.holla@arm.com> References: <20190523103502.25925-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that we have all the save/restore mechanism in place, lets enable trapping of accesses to SPE profiling buffer controls at EL1 to EL2. This will also change the translation regime used by buffer from EL2 stage 1 to EL1 stage 1 on VHE systems. Signed-off-by: Sudeep Holla --- arch/arm64/kvm/hyp/switch.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c index 844f0dd7a7f0..881901825a85 100644 --- a/arch/arm64/kvm/hyp/switch.c +++ b/arch/arm64/kvm/hyp/switch.c @@ -110,6 +110,7 @@ static void activate_traps_vhe(struct kvm_vcpu *vcpu) write_sysreg(val, cpacr_el1); + write_sysreg(vcpu->arch.mdcr_el2 | 2 << MDCR_EL2_E2PB_SHIFT, mdcr_el2); write_sysreg(kvm_get_hyp_vector(), vbar_el1); } NOKPROBE_SYMBOL(activate_traps_vhe); @@ -127,6 +128,7 @@ static void __hyp_text __activate_traps_nvhe(struct kvm_vcpu *vcpu) __activate_traps_fpsimd32(vcpu); } + write_sysreg(vcpu->arch.mdcr_el2 | 2 << MDCR_EL2_E2PB_SHIFT, mdcr_el2); write_sysreg(val, cptr_el2); } -- 2.17.1