Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6248129imu; Mon, 21 Jan 2019 05:48:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN5lsifp+nfPKY5OQZu4WxACIp5yb5xH4UkkaekUC9jVNCBkKa70YT+Id1Du7wRJk2BNPtlb X-Received: by 2002:a63:504d:: with SMTP id q13mr28572526pgl.319.1548078531857; Mon, 21 Jan 2019 05:48:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548078531; cv=none; d=google.com; s=arc-20160816; b=PnvtW4OAbPmvoD8qMDohmTFVucf3x0BaN3raYU8lCCHPIVmQKr5fx6wF0apyY6pS16 33kMC1b2NMdI+rVbLi9aHtK76c1OaE5j4Iq1P9Z9kmb0Fa55fbdfPwL4TOectIwdOgGx XlLxsZ7FiKqPNrk8WkXOdzqz/AkvpTSDaSvDpyiyE1vbAhFwWlwQyZrTt3bdtXc0hzmm UlcOzsrJnvu4cNEeBaRT74ZZm9c7EQmFnxJDxMx0yS+UP/ds/Hxp/Nbi8QJtD9+SnVNq OuyvHL1St5p+XClCT0KUgOD3y6t55Ed8PLdXagZfCMHNwsaLoHTi8eTbUVtUMArimrG7 wc+w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KvNLdjudwa4H9bRB03LOrIYaKebGiymUwuF1win3MOo=; b=K8bNmBpKYxny4wGxbs3ikCXzPPXeH9EAnZ7D0sbp1wuWtZlzrF4FCckwyNzln+BNNI GLAXYhmN/jHj2mi44hg3WUNFQzEhl3ht88BbTOap08SCxG1TcyZw+4rBz1GTIuk2U7aQ U1T6dMCTy2xofjHDDQ0J2wGscRxs38eSvYahfjKvxhWCfldXPlYPwGpwOBkOBVCLbW0U tgkyBwZVGfPCRUGfK+JH4C4WQAeods6U7M0JxBdiWis1Deh0bQ2VpG6brXcjiEYqIJ9Y yqoRji2scwDyI8z2cKW/U+03KuAaukTlN7q7O8qqNlw/4WmBY4YSEQL06CoPBuvWL2bh KuWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CslCBgCO; 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 y7si6441006pgq.545.2019.01.21.05.48.36; Mon, 21 Jan 2019 05:48:51 -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; dkim=pass header.i=@kernel.org header.s=default header.b=CslCBgCO; 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 S1729251AbfAUNqf (ORCPT + 99 others); Mon, 21 Jan 2019 08:46:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:55358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729131AbfAUNqb (ORCPT ); Mon, 21 Jan 2019 08:46:31 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DE43D20989; Mon, 21 Jan 2019 13:46:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548078390; bh=jWIga8RehmT25iOSFC/qB/l4FU0UN2+WuRUVYwtB6eI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CslCBgCOI/bUsMk3/SsrACMCvci9O0F98AEt1lYKUIOm2beSp8yyeGLaUvSW1JXkT UBaOBbcTZkdYrRlci4X3Sc72jFx6p3hrX6pcVyl1dj5uFCmEawj7yi2OPoii5HUQpJ 3Hxa5zhuxoX0A2v3dGNVf3hqRxB36J4BeXjJzZ5U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Richard Henderson , Mark Rutland , Kristina Martsenko , Christoffer Dall , Catalin Marinas , Will Deacon , kvmarm@lists.cs.columbia.edu, Sasha Levin Subject: [PATCH 4.20 015/111] arm64/kvm: consistently handle host HCR_EL2 flags Date: Mon, 21 Jan 2019 14:42:09 +0100 Message-Id: <20190121122457.382354635@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121122455.819406896@linuxfoundation.org> References: <20190121122455.819406896@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 4eaed6aa2c628101246bcabc91b203bfac1193f8 ] In KVM we define the configuration of HCR_EL2 for a VHE HOST in HCR_HOST_VHE_FLAGS, but we don't have a similar definition for the non-VHE host flags, and open-code HCR_RW. Further, in head.S we open-code the flags for VHE and non-VHE configurations. In future, we're going to want to configure more flags for the host, so lets add a HCR_HOST_NVHE_FLAGS defintion, and consistently use both HCR_HOST_VHE_FLAGS and HCR_HOST_NVHE_FLAGS in the kvm code and head.S. We now use mov_q to generate the HCR_EL2 value, as we use when configuring other registers in head.S. Reviewed-by: Marc Zyngier Reviewed-by: Richard Henderson Signed-off-by: Mark Rutland Signed-off-by: Kristina Martsenko Reviewed-by: Christoffer Dall Cc: Catalin Marinas Cc: Marc Zyngier Cc: Will Deacon Cc: kvmarm@lists.cs.columbia.edu Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- arch/arm64/include/asm/kvm_arm.h | 1 + arch/arm64/kernel/head.S | 5 ++--- arch/arm64/kvm/hyp/switch.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h index 2dafd936d84d..7b914c6fb855 100644 --- a/arch/arm64/include/asm/kvm_arm.h +++ b/arch/arm64/include/asm/kvm_arm.h @@ -87,6 +87,7 @@ HCR_AMO | HCR_SWIO | HCR_TIDCP | HCR_RW | HCR_TLOR | \ HCR_FMO | HCR_IMO) #define HCR_VIRT_EXCP_MASK (HCR_VSE | HCR_VI | HCR_VF) +#define HCR_HOST_NVHE_FLAGS (HCR_RW) #define HCR_HOST_VHE_FLAGS (HCR_RW | HCR_TGE | HCR_E2H) /* TCR_EL2 Registers bits */ diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 4471f570a295..b207a2ce4bc6 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -496,10 +496,9 @@ ENTRY(el2_setup) #endif /* Hyp configuration. */ - mov x0, #HCR_RW // 64-bit EL1 + mov_q x0, HCR_HOST_NVHE_FLAGS cbz x2, set_hcr - orr x0, x0, #HCR_TGE // Enable Host Extensions - orr x0, x0, #HCR_E2H + mov_q x0, HCR_HOST_VHE_FLAGS set_hcr: msr hcr_el2, x0 isb diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c index 7cc175c88a37..f6e02cc4d856 100644 --- a/arch/arm64/kvm/hyp/switch.c +++ b/arch/arm64/kvm/hyp/switch.c @@ -157,7 +157,7 @@ static void __hyp_text __deactivate_traps_nvhe(void) mdcr_el2 |= MDCR_EL2_E2PB_MASK << MDCR_EL2_E2PB_SHIFT; write_sysreg(mdcr_el2, mdcr_el2); - write_sysreg(HCR_RW, hcr_el2); + write_sysreg(HCR_HOST_NVHE_FLAGS, hcr_el2); write_sysreg(CPTR_EL2_DEFAULT, cptr_el2); } -- 2.19.1