From patchwork Fri Dec 20 14:30:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Murray X-Patchwork-Id: 182293 Delivered-To: patch@linaro.org Received: by 2002:a92:1f98:0:0:0:0:0 with SMTP id f24csp611427ilf; Fri, 20 Dec 2019 06:35:01 -0800 (PST) X-Google-Smtp-Source: APXvYqxYAo0/VFItcSmKUrM0K3xzOLQiBRqWgQCoO9f4ZtjXufMjNVAog1c1SkAOwan19kTJhPsg X-Received: by 2002:aca:4d0f:: with SMTP id a15mr4061836oib.21.1576852501570; Fri, 20 Dec 2019 06:35:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576852501; cv=none; d=google.com; s=arc-20160816; b=EJjO6bZ2DTSjHRO6SFCYfNkrDigBOSZ78oHd9TzcQW5K4M7+mcVr/DLOASMcJFYIJL pQYP76u9J/WT+TVyVsCx7dlUV2jAvR9fw9JqMkGQegc2Fwyr731UNvoZzei6gocWEqa7 8auSu0Nee4ESlCSeu6G6ZbzjKeIiPbxUMwbYgrFxl8sJ4PL9ESaYJONNrjFtsqqrOjCt fF78ZAGfB42APUIUusZ0dPkEKeWEPotYcf8IPID0Gt40WWhFI527SDvauK4N1HFg1SnR +c8QcrzkWROipC8SH1NnqC+/jd31Hy0+QRGTUICe4rA5uuhR14cmwmt1czuwv9DbGVxR YaTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=U5cfUB13gZ6ngZv8z37SBvkIfdLEmK98/ZTWG4essNo=; b=NcTTijS6EH5wK58QMpWJAgwNW2LSxd2rlguTuRQoObhvVPUW9tTqO89ctWK1NxDWHe oE1w2ve20c5lCfnDdQRRyklfX1yPj1CWNcAOsdtnKIFHlU5DLZOPlTtWnecppCQEbiTC eTxlTsnJLEj/Qo8AjmWeqv44OkEkttjqEOpvlKEOiP/SFAeLQRCA+ujlez8aNugDXFND 0STwowT0X6htTvqURFkKtMw4k9ARmMLOTIziVm2lVMAofcfS5OMNhJBMcZovZdNFTX+I 71WVVsyEM8SwAr/naM/xt/jZRixFApKXhZzG0RY6mSUUl/M+F9xRkYpJpOqYcIwWqmhB PQ5A== 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 w64si4972237oib.185.2019.12.20.06.35.01; Fri, 20 Dec 2019 06:35:01 -0800 (PST) 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 S1728026AbfLTOdo (ORCPT + 27 others); Fri, 20 Dec 2019 09:33:44 -0500 Received: from foss.arm.com ([217.140.110.172]:51188 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727783AbfLTOah (ORCPT ); Fri, 20 Dec 2019 09:30:37 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B569D106F; Fri, 20 Dec 2019 06:30:36 -0800 (PST) Received: from e119886-lin.cambridge.arm.com (unknown [10.37.6.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DC14E3F718; Fri, 20 Dec 2019 06:30:34 -0800 (PST) From: Andrew Murray To: Marc Zyngier , Catalin Marinas , Will Deacon Cc: Sudeep Holla , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Rutland Subject: [PATCH v2 02/18] arm64: KVM: reset E2PB correctly in MDCR_EL2 when exiting the guest(VHE) Date: Fri, 20 Dec 2019 14:30:09 +0000 Message-Id: <20191220143025.33853-3-andrew.murray@arm.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191220143025.33853-1-andrew.murray@arm.com> References: <20191220143025.33853-1-andrew.murray@arm.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sudeep Holla 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 Signed-off-by: Andrew Murray --- arch/arm64/kvm/hyp/switch.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.21.0 diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c index 72fbbd86eb5e..250f13910882 100644 --- a/arch/arm64/kvm/hyp/switch.c +++ b/arch/arm64/kvm/hyp/switch.c @@ -228,9 +228,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);