Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2291984pxb; Mon, 18 Jan 2021 13:42:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJysWdcEXE7Dw3ceWnufQ8INZ+JLZxO641MgsRa6+Waod6s+Yc6a2olW3zDtSyjKwOZySpXV X-Received: by 2002:aa7:db85:: with SMTP id u5mr998623edt.107.1611006163358; Mon, 18 Jan 2021 13:42:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611006163; cv=none; d=google.com; s=arc-20160816; b=S6gr4l0FH77MvLjeBde1rE1KUwVegf2XsnDWCdu2ikYKLp++VP24gA2i3lVVdDtOQG 7CQthq1+cpJ14MamSDB3KA9AqKjJIeiMmvAEg1CKaWXHqlhyi/Hsaxv3GTQsyVLe74qz qDKQ9E/BuaAIgvd2QCMdze3TZBSDgOqt6wsLQF9VFgJ2ycGaqs5WUGYGWjdSfNBDPdAJ ErZ0tC092ac7KVFK8YSAiwXKAtIIKmG90xwzZ1jozjZLf8tOaN+74d/TNSKiAWPa8v1U vN/LrmhKZkq0+UZdPP3gMkXmrIcF89NmtNE8U93L8Klm+p+Ybi1N6QiZazXtXr7qjJDZ FFJw== 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=eGnQWMR9YPnBMly+Pu+kJoPkUL0nFEaW2jdtprOZiRA=; b=LWt6ee9oAXVGDsubVNyxkOetYbIz2hUKnU834H8/bo3Zr6daIilKYYlDgXS1BuTK5h DDL9aYTVa3EmP2o1yvNJgbF6932RoImArEsj7FHJS7HN0JoUC2lCUrcC4GEqkqbeNWQn 9aaGVHzG1gEjcI2D5BOAi/+VtJJ+OX7lHvdltdkexqNHqm2ws2rVHYFTp5NYtg3Vzlet 4rREoifUyzdUgvdPikcfaq2uXxf0RkjoLj8tAOyKXfBiFRi9Akn/b2ioDtoJCRM70aWX YejURDOFT0CSyEPwN0PbljJBGZatht92YrR7nRokA0QbK6YvzdJuGVTl3v4eyAWGxRk7 J3GQ== 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 p23si7468158ejy.319.2021.01.18.13.42.19; Mon, 18 Jan 2021 13:42:43 -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 S2394837AbhARVju (ORCPT + 99 others); Mon, 18 Jan 2021 16:39:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:38602 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389109AbhARKAy (ORCPT ); Mon, 18 Jan 2021 05:00:54 -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 B4AE62245C; Mon, 18 Jan 2021 10:00:13 +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-3D; 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 13/21] arm64: Allow ID_AA64MMFR1_EL1.VH to be overridden from the command line Date: Mon, 18 Jan 2021 09:45:25 +0000 Message-Id: <20210118094533.2874082-14-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 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 --- arch/arm64/include/asm/cpufeature.h | 3 +++ arch/arm64/kernel/cpufeature.c | 6 +++++- arch/arm64/kernel/idreg-override.c | 12 ++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index fe0130d6c0ff..80a5f423444e 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h @@ -814,6 +814,9 @@ static inline unsigned int get_vmid_bits(u64 mmfr1) return 8; } +extern u64 id_aa64mmfr1_val; +extern u64 id_aa64mmfr1_mask; + 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 48a011935d8c..5b9343d2e9f0 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -555,6 +555,9 @@ static const struct arm64_ftr_bits ftr_raz[] = { #define ARM64_FTR_REG(id, table) ARM64_FTR_REG_OVERRIDE(id, table, NULL, NULL) +u64 id_aa64mmfr1_val; +u64 id_aa64mmfr1_mask; + static const struct __ftr_reg_entry { u32 sys_id; struct arm64_ftr_reg *reg; @@ -602,7 +605,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_val, &id_aa64mmfr1_mask), 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 392f93b67103..75d9845f489b 100644 --- a/arch/arm64/kernel/idreg-override.c +++ b/arch/arm64/kernel/idreg-override.c @@ -10,6 +10,7 @@ #include #include +#include #include struct reg_desc { @@ -22,7 +23,18 @@ struct reg_desc { } fields[]; }; +static const struct reg_desc mmfr1 __initdata = { + .name = "id_aa64mmfr1", + .val = &id_aa64mmfr1_val, + .mask = &id_aa64mmfr1_mask, + .fields = { + { "vh", ID_AA64MMFR1_VHE_SHIFT }, + {} + }, +}; + static const struct reg_desc * const regs[] __initdata = { + &mmfr1, }; static int __init find_field(const char *cmdline, const struct reg_desc *reg, -- 2.29.2