From patchwork Thu May 23 10:34:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 164964 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1994016ili; Thu, 23 May 2019 03:35:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0E7PFKFIBFwtWEnRtDyfDtZvmPbFxkExXn+Tvpj5tYh/X/8l9tvnq6NeAF0IgtPqWIeaI X-Received: by 2002:a62:fc56:: with SMTP id e83mr51107143pfh.27.1558607731625; Thu, 23 May 2019 03:35:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558607731; cv=none; d=google.com; s=arc-20160816; b=b42Pn/MpHn9x+YNzcwIn0Bmw/4+q/e2rZ89pJ457iGYQJxWLqtCpJ5LYAAIbpTkVm+ z3JW5sflLj3n/thYnh7EPjdSnUmMA1I9PeDl0sSlh18isr/BISCI+3zi8HKzK6EX3MHT 9BNOtBE9F0l3MT1Hzsv1lLl4caM7BXOB64XJaZfBQhAMcdkpmLXxjbKbT5O+AERQqkOb EHIGmt09FE2GZaylUdH2ItpL1tYLqgxpMFe6DhmnPl2h5PUDNlsaGLe3nwu2TcqD3ae3 JjV59bx9zF532mnepn7QL8CGxbf4gLzNS6dYjYlbFhpMB0pFGn+IY0uHUu9qEDR8nGI1 H1dg== 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=JpqgU9ARunJc10ujhxIhfpSpEPs2zUiO8S6Vj0JRyQQ=; b=AxXe/App6yYhG/pwjd2r182vAkWK/Z5GMHzGZrkmJv3H1Hp5YjFngtpud0Ma/Rai+B mDMzmt24lBWhAlm8dwcFvl/jzP0yeBSU7tgaF2cuqLEsBwosqsUWgQievaQ3r5wgqhvO 9rqjy1mBWkL4vrM08ale7feyYSY8BZ7ubh2VvONbngb73qOMKzIwWpsDmD2o1YF4ctD+ ic4kcWegkRVDeNq373q48cZ6f7KIpycUWXW4fu2hemIeQocYNX1wcVyT6gh62qNaUp9e mB/piBYl3abNkp4WLX1x+6YwP3ZYcilBp9oXFUdPm080yRkjL8ayhueVGxurirwSPpeZ JVtw== 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 c19si18163188pfn.0.2019.05.23.03.35.31; Thu, 23 May 2019 03:35:31 -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 S1730501AbfEWKfa (ORCPT + 30 others); Thu, 23 May 2019 06:35:30 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:43032 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730381AbfEWKf2 (ORCPT ); Thu, 23 May 2019 06:35:28 -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 043F3A78; Thu, 23 May 2019 03:35:28 -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 DC2023F718; Thu, 23 May 2019 03:35:25 -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 03/15] arm64: KVM: reset E2PB correctly in MDCR_EL2 when exiting the guest(VHE) Date: Thu, 23 May 2019 11:34:50 +0100 Message-Id: <20190523103502.25925-4-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 On VHE systems, the reset value for MDCR_EL2.E2PB=b00 which defaults to profiling buffer using the EL2 stage 1 translations. However if the guest are allowed to use profiling buffers changing E2PB settings, we need to ensure we resume back MDCR_EL2.E2PB=b00. Currently we just do bitwise '&' with MDCR_EL2_E2PB_MASK which will retain the value. So fix it by clearing all the bits in E2PB. Signed-off-by: Sudeep Holla --- arch/arm64/kvm/hyp/switch.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.17.1 diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c index 22b4c335e0b2..9b2461138ddc 100644 --- a/arch/arm64/kvm/hyp/switch.c +++ b/arch/arm64/kvm/hyp/switch.c @@ -202,9 +202,7 @@ void deactivate_traps_vhe_put(void) { u64 mdcr_el2 = read_sysreg(mdcr_el2); - mdcr_el2 &= MDCR_EL2_HPMN_MASK | - MDCR_EL2_E2PB_MASK << MDCR_EL2_E2PB_SHIFT | - MDCR_EL2_TPMS; + mdcr_el2 &= MDCR_EL2_HPMN_MASK | MDCR_EL2_TPMS; write_sysreg(mdcr_el2, mdcr_el2);