Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3875828pxb; Mon, 8 Feb 2021 02:18:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJwvAQrvDLttXWVM2sWA56poIm+4wt2WoevryT4K/YdVyGH2IqYkdzeAUyRzsqMTPptQk0aj X-Received: by 2002:a17:906:447:: with SMTP id e7mr16147469eja.172.1612779492908; Mon, 08 Feb 2021 02:18:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612779492; cv=none; d=google.com; s=arc-20160816; b=CZSJUm7xyBfZd1POU8uyFySIRo80bGtOqr5nd0zyTMwCSsQGN2WncnYh7u85CElSGI QktDqv7GsesrlFaL+wTOduIEnTuY7pQ5rVVtqfTGB33ENwbjsKJRluLGDlAw87wI7fVY wkX0+rZnnYKKZOvGQt/Ip+urLqwTWKlGJFtxHytJolFuXtdYpxdbbI2u1xvU3BxkvvFo Ag9PRjjKSCLUR9EhoXpinVjsRv1hAkzav1uO9r6EzSw2IvwuvbT8TZuefyWUN3wvkuHq oZK7FU/IhMpsyMciMkEgPOLmbEd+ji38UejzzkRGcSdW6MM4IPk0lk4fNhO5zqETW4Kz guhQ== 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=liUfkE7bP/u2ZwqpAJ7EG8ZYc9tNiPXMxqMe5U0bGdI=; b=HQ/boAddFHSOMg7y0d7jqF21M7yf5OpmU2vxQUwgLcczDda85holwuZoAetglL/C0Y APnImPKp6MXQH1puwly8zBSot+7koo95P8WkEjdDCGqBVwlMtgHSNY6Br02UgI+atYq+ 10KJ1m4G96oVsXM/XywlgoMuGumt+bGqJOOILSVxrk+fktCHkn8LH2E+9Y1re1r40GdJ Ap0LCu8hvb5fYLQukdMcUCqbdKLrmMTSeM0Es6aIoWrc++jf0VDZragW1YMONSooDNMe BNaWOoEXzaJUGvS9Gaj123ZNCvye4/e3sZNMbNMj3iLC8iYP0C5A967MSvuKAkogDDcT KQIQ== 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 l3si12176239ejd.83.2021.02.08.02.17.48; Mon, 08 Feb 2021 02:18:12 -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 S231842AbhBHKQL (ORCPT + 99 others); Mon, 8 Feb 2021 05:16:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:59658 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231398AbhBHKFB (ORCPT ); Mon, 8 Feb 2021 05:05:01 -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 A34C864E8C; Mon, 8 Feb 2021 10:04:20 +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 1l93Iz-00Ck14-1b; Mon, 08 Feb 2021 09:58:05 +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 16/23] arm64: Add an aliasing facility for the idreg override Date: Mon, 8 Feb 2021 09:57:25 +0000 Message-Id: <20210208095732.3267263-17-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 In order to map the override of idregs to options that a user can easily understand, let's introduce yet another option array, which maps an option to the corresponding idreg options. Signed-off-by: Marc Zyngier Reviewed-by: Catalin Marinas Acked-by: David Brazdil --- arch/arm64/kernel/idreg-override.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/idreg-override.c b/arch/arm64/kernel/idreg-override.c index 2da11bf60195..226bac544e20 100644 --- a/arch/arm64/kernel/idreg-override.c +++ b/arch/arm64/kernel/idreg-override.c @@ -16,6 +16,8 @@ #define FTR_DESC_NAME_LEN 20 #define FTR_DESC_FIELD_LEN 10 +#define FTR_ALIAS_NAME_LEN 30 +#define FTR_ALIAS_OPTION_LEN 80 struct ftr_set_desc { char name[FTR_DESC_NAME_LEN]; @@ -39,6 +41,12 @@ static const struct ftr_set_desc * const regs[] __initconst = { &mmfr1, }; +static const struct { + char alias[FTR_ALIAS_NAME_LEN]; + char feature[FTR_ALIAS_OPTION_LEN]; +} aliases[] __initconst = { +}; + static int __init find_field(const char *cmdline, const struct ftr_set_desc *reg, int f, u64 *v) { @@ -81,7 +89,7 @@ static void __init match_options(const char *cmdline) } } -static __init void __parse_cmdline(const char *cmdline) +static __init void __parse_cmdline(const char *cmdline, bool parse_aliases) { do { char buf[256]; @@ -105,6 +113,9 @@ static __init void __parse_cmdline(const char *cmdline) match_options(buf); + for (i = 0; parse_aliases && i < ARRAY_SIZE(aliases); i++) + if (parameq(buf, aliases[i].alias)) + __parse_cmdline(aliases[i].feature, false); } while (1); } @@ -127,14 +138,14 @@ static __init void parse_cmdline(void) if (!prop) goto out; - __parse_cmdline(prop); + __parse_cmdline(prop, true); if (!IS_ENABLED(CONFIG_CMDLINE_EXTEND)) return; } out: - __parse_cmdline(CONFIG_CMDLINE); + __parse_cmdline(CONFIG_CMDLINE, true); } /* Keep checkers quiet */ -- 2.29.2