Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3879880pxb; Mon, 8 Feb 2021 02:26:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJw/qHHwdePi8JKB74D2lVa8lZ2cPqb5lGJm4VrschOjLAuFS4mumLGJdtUxujQQBb09H3Mx X-Received: by 2002:a50:fd14:: with SMTP id i20mr16294636eds.26.1612779960025; Mon, 08 Feb 2021 02:26:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612779960; cv=none; d=google.com; s=arc-20160816; b=pUHV4qm/UbCKgVoPVPUjbqpXFOIaxu7WZrFGjPPosbtznu2FLRc4u1+bThQJs92An4 SsyxGdl7SzwOX/nlwY2Pa9Z3CB/xYFpVcgttBqkv9jdvqT/EoDOoM1yxtoDozKduCOOy z+8Sqf5H0yf0uMlTUo2saVAOlEUZ+aEqQxE+4l2MwWgdh0Prp73iglzUpNn4IS5wjsZW qnPtiqqFkzNuWDXBX6Nlh1T3ZAMUHoMk/zwO/+DLF6/9sOgB50lahKV85lVU1HKnI2QA YL4T2FNyCq5pXSODxAJG3k7aDZJgYetuU3HFA7DRClgTpMLRAw3QKZlxjI62neAxn0UU xwmw== 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=KOgzznKoVNdVUzThX8uZOzrFpJaSOxI/LqCJ9IV3I/o=; b=WlqfwrhqNasOpe3W7tig6PgljkCfLnAaZD/UgmOL8nsRlrv0nalF+ofBs5GOUsP9J/ 9p5Yb2F1wMdkmpyRbORPzgdc6MyG32i3CF9cl+7zL/syylWchMvJda5RMs0RX0YC35FA //lFcEYY3+OhpSny8uj7PyNG9oHOC+OhWeLoT8pSEAlQJxlA3WqiaD74jo+5lTnDB9hr 65SaX5fEQbitSvtaW2oCgWHfEm0jmOc9qLuaU3/iB5rgahgTtbj8LavBDmkxqUpriXzn E/Y17ujZWLYuDPZlhqCTqUrB/vQYX0CPGSPbz2+9vhpX06oNhzIAX6paIa/mZhQkLjKG 92nw== 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 g24si10623960edu.329.2021.02.08.02.25.36; Mon, 08 Feb 2021 02:26:00 -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 S232197AbhBHKWa (ORCPT + 99 others); Mon, 8 Feb 2021 05:22:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:33026 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232317AbhBHKHo (ORCPT ); Mon, 8 Feb 2021 05:07:44 -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 4D64A64EA1; Mon, 8 Feb 2021 10:04:38 +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 1l93Ix-00Ck14-9R; Mon, 08 Feb 2021 09:58:04 +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 , Hector Martin , James Morse , Julien Thierry , Suzuki K Poulose , kernel-team@android.com Subject: [PATCH v7 15/23] arm64: Honor VHE being disabled from the command-line Date: Mon, 8 Feb 2021 09:57:24 +0000 Message-Id: <20210208095732.3267263-16-maz@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210208095732.3267263-1-maz@kernel.org> References: <20210208095732.3267263-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, marcan@marcan.st, 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 Acked-by: David Brazdil Acked-by: Catalin Marinas --- arch/arm64/kernel/asm-offsets.c | 3 +++ arch/arm64/kernel/hyp-stub.S | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c index f42fd9e33981..1add0f21bffe 100644 --- a/arch/arm64/kernel/asm-offsets.c +++ b/arch/arm64/kernel/asm-offsets.c @@ -99,6 +99,9 @@ int main(void) DEFINE(CPU_BOOT_STACK, offsetof(struct secondary_data, stack)); DEFINE(CPU_BOOT_TASK, offsetof(struct secondary_data, task)); BLANK(); + DEFINE(FTR_OVR_VAL_OFFSET, offsetof(struct arm64_ftr_override, val)); + DEFINE(FTR_OVR_MASK_OFFSET, offsetof(struct arm64_ftr_override, mask)); + BLANK(); #ifdef CONFIG_KVM DEFINE(VCPU_CONTEXT, offsetof(struct kvm_vcpu, arch.ctxt)); DEFINE(VCPU_FAULT_DISR, offsetof(struct kvm_vcpu, arch.fault.disr_el1)); diff --git a/arch/arm64/kernel/hyp-stub.S b/arch/arm64/kernel/hyp-stub.S index 6229315d533d..3e08dcc924b5 100644 --- a/arch/arm64/kernel/hyp-stub.S +++ b/arch/arm64/kernel/hyp-stub.S @@ -87,6 +87,17 @@ SYM_CODE_START_LOCAL(mutate_to_vhe) ubfx x1, x1, #ID_AA64MMFR1_VHE_SHIFT, #4 cbz x1, 1f + // Check whether VHE is disabled from the command line + adr_l x1, id_aa64mmfr1_override + ldr x2, [x1, FTR_OVR_VAL_OFFSET] + ldr x1, [x1, FTR_OVR_MASK_OFFSET] + ubfx x2, x2, #ID_AA64MMFR1_VHE_SHIFT, #4 + ubfx x1, x1, #ID_AA64MMFR1_VHE_SHIFT, #4 + cmp x1, xzr + and x2, x2, x1 + csinv x2, x2, xzr, ne + cbz x2, 1f + // Engage the VHE magic! mov_q x0, HCR_HOST_VHE_FLAGS msr hcr_el2, x0 -- 2.29.2