Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2502472pxb; Mon, 18 Jan 2021 21:23:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzXLKult1pl2PvQ67OvuaJ8GvA0f56ZP/NqQvhQVu0F3kEkmUo+uS+/PtKLajpo2wRHgbf+ X-Received: by 2002:a50:8b61:: with SMTP id l88mr2088856edl.250.1611033818267; Mon, 18 Jan 2021 21:23:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611033818; cv=none; d=google.com; s=arc-20160816; b=fVN8XtvpyToHh6fLN1jICFipuMrcyeNd8jlNs+7aVZ/SusH7bCul3ReG7qVcoRRmHf d0xQV2pCPru7yEAwE+Ne7u/timCky2O/vvud+KUI9gtResImWisQDCqUJm+I+QKY+1Ug Nbwt+XiBu1v2aiSOKBn5qz8/a2jnBmjeCef3KIIy5m15kSBuoF+yMr/i+q+9zOMJKouP AlbG3xDIFk1n9hzLYcvu3ooOEXNpk9utHnbV4xljlrMK7DQ1Xm2ve2hO46tVw1JtlxXI N9j3EyNSggsRrL8h/3v4sbsXRmSwLP8gKScxaBpZxywnKr6X7oVar5r1a8tKAtlxak05 QJaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=idu9+vYrto0Nw/iZEBGPDHhHpX5QWKfE1xEsMJ0W1po=; b=wdSsxW/KN+wDWhZ/5GinQuG7fSJFMYmYQ0t6TWX/LQf2dRJteE/t4yVFmWFU9CTug0 Fso/+2ZW5PUlhA2N3MgPycSgtqEJ9PElH/eaMfwIjipwaOwQETzjNt3DQbpr4V9K2ix9 yEa776oZbaLMMDGhwj6TMQtu/R42j8/tDw95GHPiUIfrvrFv/TGYtbo+qBop1rE4KrDg KtBe2DoVFIdnl6WO2/SBIsFUuqw7Fs6ryd5HU2jAP90nfivddxCaIZyygDUCSzaPOwmk nleiobhxaLye/RCg6JuzhLDqLHzYiwY/15esTTRwS5dAxkDRDWyZkmJ4Mqedm36/pv8L 2rNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d13si7447439ejz.583.2021.01.18.21.23.15; Mon, 18 Jan 2021 21:23:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394814AbhARVih (ORCPT + 99 others); Mon, 18 Jan 2021 16:38:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:39314 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389445AbhARKDT (ORCPT ); Mon, 18 Jan 2021 05:03:19 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (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 5551F229C7; Mon, 18 Jan 2021 10:00:24 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1l1R6v-008RhD-Q2; Mon, 18 Jan 2021 09:46:09 +0000 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Cc: Catalin Marinas , Will Deacon , Mark Rutland , David Brazdil , Alexandru Elisei , Ard Biesheuvel , Jing Zhang , Ajay Patil , Prasad Sodagudi , Srinivas Ramana , James Morse , Julien Thierry , Suzuki K Poulose , kernel-team@android.com Subject: [PATCH v4 14/21] arm64: Honor VHE being disabled from the command-line Date: Mon, 18 Jan 2021 09:45:26 +0000 Message-Id: <20210118094533.2874082-15-maz@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210118094533.2874082-1-maz@kernel.org> References: <20210118094533.2874082-1-maz@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, dbrazdil@google.com, alexandru.elisei@arm.com, ardb@kernel.org, jingzhangos@google.com, pajay@qti.qualcomm.com, psodagud@codeaurora.org, sramana@codeaurora.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Finally we can check whether VHE is disabled on the command line, and not enable it if that's the user's wish. Signed-off-by: Marc Zyngier --- arch/arm64/kernel/hyp-stub.S | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/hyp-stub.S b/arch/arm64/kernel/hyp-stub.S index 59820f9b8522..bbab2148a2a2 100644 --- a/arch/arm64/kernel/hyp-stub.S +++ b/arch/arm64/kernel/hyp-stub.S @@ -77,13 +77,24 @@ SYM_CODE_END(el1_sync) SYM_CODE_START_LOCAL(mutate_to_vhe) // Sanity check: MMU *must* be off mrs x0, sctlr_el2 - tbnz x0, #0, 1f + tbnz x0, #0, 2f // Needs to be VHE capable, obviously mrs x0, id_aa64mmfr1_el1 ubfx x0, x0, #ID_AA64MMFR1_VHE_SHIFT, #4 - cbz x0, 1f + cbz x0, 2f + // Check whether VHE is disabled from the command line + adr_l x1, id_aa64mmfr1_val + ldr x0, [x1] + adr_l x1, id_aa64mmfr1_mask + ldr x1, [x1] + ubfx x0, x0, #ID_AA64MMFR1_VHE_SHIFT, #4 + ubfx x1, x1, #ID_AA64MMFR1_VHE_SHIFT, #4 + cbz x1, 1f + and x0, x0, x1 + cbz x0, 2f +1: // Engage the VHE magic! mov_q x0, HCR_HOST_VHE_FLAGS msr hcr_el2, x0 @@ -152,7 +163,7 @@ skip_spe: orr x0, x0, x1 msr spsr_el1, x0 -1: eret +2: eret SYM_CODE_END(mutate_to_vhe) .macro invalid_vector label -- 2.29.2