Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3761732pxb; Mon, 1 Feb 2021 04:10:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJybbMzNg38x0vaacqFJLCXzWlVVH6WI8AmItegrX6TjNVAabLJVkHfn6mjUNmKk0g8hRuQE X-Received: by 2002:a05:6402:270e:: with SMTP id y14mr18083243edd.322.1612181405537; Mon, 01 Feb 2021 04:10:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612181405; cv=none; d=google.com; s=arc-20160816; b=ZxHtmIYsjOq2PvdrKnM+zbo30M+XFSJgCklGZUKIzW0bUYX5qNJJZlQ5XQoYxUDkVi ZChcXIQzjdMpPiI/VYfz9J/bzVUeDtLS+m5OYlMOPA/Ry04J4cuY0uyy48YUDSiqMco/ jXhtFyFbIU3YjtZlbfHz7xHbm95cpHkcQ2loW6lGYqpPG/LKdt0hY5glgxCPN9OIBQGX qOC4gGkJbSpqXIAZXLBBGh6numtBhZa7S/x64yI/juJtTKZA4phxLmgENATxM7Av/YUJ pHi9B49ktTh3u+tve3L17rH+IOBJVCW75rS8dWluLoecML9VxrPZR8JHZ4vHohPlSoI5 Bh5g== 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=eYQ0zsYGGBAHYBYw78YgJm4kD2usctzqDPCNQ2AFP+0=; b=bYZghZs8Bl4ztc8e3LdfcoCCoGdrjgxY9GFLhYoYjs0RQJT3fSG3/lZ5AMxII8kLXN GP809EwwT5KvQ4ID3LW07zOr2JJJa11tutqDnbcBX8xglO9PGPtFy4KBo+1jIFo6037m R0p7rPBpQWC648SGvZIOk97NpSBsrdLBxktDOqtn9cldnsrzSEMYt/ZmPpn+L9M2dDbV bJGPyT1UxkYx4L350OeaAgo/a/U5pOtWuhgIpgn5viVc72jflKQ2rvOdSWqNNCfTbRpC c99XoyaUGwxuWi4aRvvZs+wmDe1OvBF8H2jeNxySO6yqeIgeTG2nCBQFVUFi/HHUqtUg uMVA== 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 sb9si2938096ejb.162.2021.02.01.04.09.41; Mon, 01 Feb 2021 04:10:05 -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 S231336AbhBAMG6 (ORCPT + 99 others); Mon, 1 Feb 2021 07:06:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:56382 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231221AbhBAMFk (ORCPT ); Mon, 1 Feb 2021 07:05:40 -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 28E8B64EA1; Mon, 1 Feb 2021 12:04:34 +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 1l6XpA-00BG09-Gq; Mon, 01 Feb 2021 11:56:57 +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 v6 13/21] arm64: Allow ID_AA64MMFR1_EL1.VH to be overridden from the command line Date: Mon, 1 Feb 2021 11:56:29 +0000 Message-Id: <20210201115637.3123740-14-maz@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210201115637.3123740-1-maz@kernel.org> References: <20210201115637.3123740-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 As we want to be able to disable VHE at runtime, let's match "id_aa64mmfr1.vh=" from the command line as an override. This doesn't have much effect yet as our boot code doesn't look at the cpufeature, but only at the HW registers. Signed-off-by: Marc Zyngier Acked-by: David Brazdil Acked-by: Suzuki K Poulose Reviewed-by: Catalin Marinas --- arch/arm64/include/asm/cpufeature.h | 2 ++ arch/arm64/kernel/cpufeature.c | 5 ++++- arch/arm64/kernel/idreg-override.c | 11 +++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index b5bf7af68691..570f1b4ba3cc 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h @@ -818,6 +818,8 @@ static inline unsigned int get_vmid_bits(u64 mmfr1) return 8; } +extern struct arm64_ftr_override id_aa64mmfr1_override; + u32 get_kvm_ipa_limit(void); void dump_cpu_features(void); diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 97da9ed4b79d..faada5d8bea6 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -557,6 +557,8 @@ static const struct arm64_ftr_bits ftr_raz[] = { #define ARM64_FTR_REG(id, table) ARM64_FTR_REG_OVERRIDE(id, table, &no_override) +struct arm64_ftr_override __ro_after_init id_aa64mmfr1_override; + static const struct __ftr_reg_entry { u32 sys_id; struct arm64_ftr_reg *reg; @@ -604,7 +606,8 @@ static const struct __ftr_reg_entry { /* Op1 = 0, CRn = 0, CRm = 7 */ ARM64_FTR_REG(SYS_ID_AA64MMFR0_EL1, ftr_id_aa64mmfr0), - ARM64_FTR_REG(SYS_ID_AA64MMFR1_EL1, ftr_id_aa64mmfr1), + ARM64_FTR_REG_OVERRIDE(SYS_ID_AA64MMFR1_EL1, ftr_id_aa64mmfr1, + &id_aa64mmfr1_override), ARM64_FTR_REG(SYS_ID_AA64MMFR2_EL1, ftr_id_aa64mmfr2), /* Op1 = 0, CRn = 1, CRm = 2 */ diff --git a/arch/arm64/kernel/idreg-override.c b/arch/arm64/kernel/idreg-override.c index d8d0d3b25bc3..1e4671aa02c8 100644 --- a/arch/arm64/kernel/idreg-override.c +++ b/arch/arm64/kernel/idreg-override.c @@ -11,6 +11,7 @@ #include #include +#include #include #define FTR_DESC_NAME_LEN 20 @@ -25,7 +26,17 @@ struct ftr_set_desc { } fields[]; }; +static const struct ftr_set_desc mmfr1 __initconst = { + .name = "id_aa64mmfr1", + .override = &id_aa64mmfr1_override, + .fields = { + { "vh", ID_AA64MMFR1_VHE_SHIFT }, + {} + }, +}; + static const struct ftr_set_desc * const regs[] __initconst = { + &mmfr1, }; static char *cmdline_contains_option(const char *cmdline, const char *option) -- 2.29.2