Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2290689pxb; Mon, 18 Jan 2021 13:39:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJyhwd7Pep/yVPw9GHg6ruxsoPsmhA9aN4AuPBAv4amg98Kg6/HhPocAZSkW65yHz20+8tT9 X-Received: by 2002:a05:6402:4252:: with SMTP id g18mr1066747edb.231.1611005973596; Mon, 18 Jan 2021 13:39:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611005973; cv=none; d=google.com; s=arc-20160816; b=OVLFx2ez9bQrGLcjINCt2+Z4T0YZxJZYw6+zV6wsc1VQf+7ZXQ+SnO3sacQ+MlRYMp 9jTBDUTDJ/ZxPlqO7JN0BC6G9kOaUoCOQX+MsdX2anYoocbicS7Qh2PvRBdReJfMqMKg dcu+wsgn7tLW4LtMkfyEjYa/MZ4Tu+/gfWHoSMW/hzLJ8PEOYcm4zCULJ4P+LnaYobQR feS7LPfpYYMIZVUkGvGrCjWf2JcuNfEoAfAKQW0TNiOtHJcWlHEGbTN5PeXwe2GQtkfB ca6blDzeLiMqptE/tHkJbGiv/WCb2JKE3NEpqt04ujrwHudphjF6iJGQRLoHyC1S8uxH rqvw== 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=iTsk+ReTlSSFmbNW14SYvVl2VyFyXXB2hjWwJjl4MWk=; b=gyoxjt9jBHyr0nNyWoyaQyZinyvv4xrLP9xDT91LJkmquK7/8qUsjCet9ljeIG33q2 fN4HMrQ/wZsAmqM4lD9v+hq6ztNE0ovPbt0xRUdg+TEaFbSuc4McGJJox0ZeF05+w+Cv Xr1TSGerhAt0dET7cYJKjbeKpgEkFii+dnbOGM7Td/UP3+PY2K7AZ7euCK7U0A6gq3FT sbXefG5H02gdy3D2zQvNip/kWZEqkraunyab0T74KB9qo5A0JoM9VlYwfYwQDZwMbzkE AjtFn3DltebaUe/zw6Z76LpcF6TcSkffRc0OHhjUkr9GPb8pNRdtVf9RESFNKuyW5wP4 TtZg== 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 d27si2215991ejt.58.2021.01.18.13.39.02; Mon, 18 Jan 2021 13:39:33 -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 S2389528AbhARVgi (ORCPT + 99 others); Mon, 18 Jan 2021 16:36:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:39342 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389451AbhARKDY (ORCPT ); Mon, 18 Jan 2021 05:03:24 -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 382EF22B40; Mon, 18 Jan 2021 10:00:33 +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 1l1R6w-008RhD-F5; Mon, 18 Jan 2021 09:46:11 +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 15/21] arm64: Add an aliasing facility for the idreg override Date: Mon, 18 Jan 2021 09:45:27 +0000 Message-Id: <20210118094533.2874082-16-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 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 --- arch/arm64/kernel/idreg-override.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm64/kernel/idreg-override.c b/arch/arm64/kernel/idreg-override.c index 75d9845f489b..16bc8b3b93ae 100644 --- a/arch/arm64/kernel/idreg-override.c +++ b/arch/arm64/kernel/idreg-override.c @@ -37,6 +37,12 @@ static const struct reg_desc * const regs[] __initdata = { &mmfr1, }; +static const struct { + const char * const alias; + const char * const feature; +} aliases[] __initdata = { +}; + static int __init find_field(const char *cmdline, const struct reg_desc *reg, int f, u64 *v) { @@ -80,6 +86,18 @@ static void __init match_options(const char *cmdline) } } +static __init void match_aliases(const char *cmdline) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(aliases); i++) { + char *str = strstr(cmdline, aliases[i].alias); + + if ((str == cmdline || (str > cmdline && *(str - 1) == ' '))) + match_options(aliases[i].feature); + } +} + static __init void parse_cmdline(void) { if (!IS_ENABLED(CONFIG_CMDLINE_FORCE)) { @@ -100,6 +118,7 @@ static __init void parse_cmdline(void) goto out; match_options(prop); + match_aliases(prop); if (!IS_ENABLED(CONFIG_CMDLINE_EXTEND)) return; @@ -107,6 +126,7 @@ static __init void parse_cmdline(void) out: match_options(CONFIG_CMDLINE); + match_aliases(CONFIG_CMDLINE); } void __init init_shadow_regs(void) -- 2.29.2