Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6272351imu; Mon, 21 Jan 2019 06:11:08 -0800 (PST) X-Google-Smtp-Source: ALg8bN60NmiEQQVSWUoZ79CQMriyRdNhcPgMUFXf9SkdWXiIjNryxwUvry/71ela+zavplkf7Pjw X-Received: by 2002:a62:11c7:: with SMTP id 68mr29695338pfr.21.1548079867996; Mon, 21 Jan 2019 06:11:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548079867; cv=none; d=google.com; s=arc-20160816; b=lnV29ZnxRrBdaCIraE4O5R8w2kYEZNwcoV7Z8uZkA8aiKCbE/qE65lEKM30SzpTyGA TjB4axYajafVERsf3qPgzm+Y78wNx0crjS2SU7Zj+/Z0+O1eK0kCPuFlmA/5sT70Nw4B eOZ6pgoU9QFcAQLphKJ15wPPxkRy1j7dFzHOwTby/cwFRZ846hTDGiaXzHi//P3p7fe3 8fh0iTP62yqbGEa9+1DwbUnnlnSOm31AldLX1Oi4wQNPMrT0bpRhi+PTAopCYlIb6orE 4gUSQ/99z2BUoBielfMfhVUFCZkqXZcmGOYPZ+X2GCmBRfF68yHJvnWeFMA7BS2RoWr+ bvLw== 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=ZaledMmqedNDMygacletPuGfF1LwfEtfVVRzIkljl6s=; b=G/C1074yXcF1C6VM7uqvVBVgJSqqGLQJf3OWjq/T2CXAkUR0Ox/tkFoeiFOH44eQTK Sp/ZIpONRiiyHZb+QrOKDPvxA4oQaIClWb9h5e7aAkUfMIOREfrgwJum7U93gDWptk2J JEJ+DSDyzcsMS9SaiaFv9YiNEiak3K2FNEyIUlMYTBJOhteFAVRxyDqIBhoHcd9g+CUh K07PvEsj7CdHFd6PXNYoLsuM3x4MHYq3G2TsRpWn7a3hYIWXtzUM4NEBC8prZFCY8G5E Fvq5lbxzpBuvimkpLOaRF651N61XEKPayumwY9oYvCAfPq48A2qi05fCWu8qW+c8J9Eg yUxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="M85BG/DA"; 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 92si13079366pli.220.2019.01.21.06.10.47; Mon, 21 Jan 2019 06:11:07 -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="M85BG/DA"; 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 S1731705AbfAUOIY (ORCPT + 99 others); Mon, 21 Jan 2019 09:08:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:44462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732014AbfAUN6r (ORCPT ); Mon, 21 Jan 2019 08:58:47 -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 B415D2084C; Mon, 21 Jan 2019 13:58:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548079126; bh=6/x5wFDZavZaq5ZQsh17g8qJp4UW82s1VcttdSl5dZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M85BG/DAqD/mrAbhzhU8WcTAFEVyy4qAT+b4LJrxgV4fSlYi1uqMBt3rJ5OPG3MSl +/5oSQ5ZpG3vc+OlP8nOgGt73iY/9TZ7vhSX+I+BZ1h8Qp13i1YTc7WeGpuTzEB2YQ M1BpEUhPCs2Q1ZteatLvmzLEgcpgWlBz5iSv7M9E= 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.19 18/99] arm64/kvm: consistently handle host HCR_EL2 flags Date: Mon, 21 Jan 2019 14:48:10 +0100 Message-Id: <20190121134914.607528642@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121134913.924726465@linuxfoundation.org> References: <20190121134913.924726465@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.19-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 95e3fa7ded8b..2297284e33f2 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 b0853069702f..651a06b1980f 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -494,10 +494,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 ca46153d7915..a1c32c1f2267 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