From patchwork Thu Sep 30 18:11:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 514935 Delivered-To: patch@linaro.org Received: by 2002:a02:606e:0:0:0:0:0 with SMTP id d46csp36386jaf; Thu, 30 Sep 2021 11:16:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJym4pk3hY+Gg0DuiymbhvvyZ8ZBxDeOTvCyAWmhWcPNVQYMZV08ud+cv/CgLhJI7IcYofuO X-Received: by 2002:a17:906:2295:: with SMTP id p21mr739636eja.421.1633025764297; Thu, 30 Sep 2021 11:16:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633025764; cv=none; d=google.com; s=arc-20160816; b=FfV+j/IY2dCLZG8lNeqmEdzgUphZSeYiB6XsxSkT+g6HkLC1cQx2AidhN+9B2rw0IP z2QtuKdKZUrRBkLifSPvpvylsTTmr81pxMgmsd/jVHA/pvwLDCgY9sc1ELqcDU7HYdo6 BTX9LzFiPq4zTC89Ful9o0kO7fU+8Q9XmIZ9Df/2/Z67EtSwNDCFEUwJaAEynsgyFOzU CpS9v/Y+fN41SpJiuwE72kk6o4rIRN6+GWkJzjoVpy0CwFfbLeyKx2795XnHRV3SRqtu Mqx95r92yUoLsfwZqIOUqIlWFN8z+ex1Ps/nfy42bX5ysEbrmQkTQPgKberwwEIOMFlo Vt6g== 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 :dkim-signature; bh=dizrqCP4DTvBuPYxcL9/oOY/Wv4e0V29qZQpZttjLvk=; b=h+POTN6QcmP3UoNjmKL2b05CxPj7t9EOnDFvYO/EG190o+dcHyPQ8NRlsOUCeH8ev+ Edo2IUFsY7LRxQwWRjmFwS4HuZY/gGchOQmBpVocgDgIzWj7BPGYi0drB/OUuqXJ42DV 2UCHlS72t/3MQtJf8qFc70gLQ9Nb0JRpGkthyZBOEgkGFJv021iQWeWV4bEMp5kNhshC VVP7CAxj+ZNmPgg/xdCELY1vuYFSg0QlprrrGeXC7sAgkTPzJonShwcnnH5d1rU0dvPo dna+DHndifz5E/ow0xeJ4jwb+Tw1bZ32v2cnbjx3mWybx/SizWvKQ6een9qrSNV3Il/x 2HJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OIPx8zP2; spf=pass (google.com: domain of linux-kselftest-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kselftest-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 ga1si4939846ejc.128.2021.09.30.11.16.04; Thu, 30 Sep 2021 11:16:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kselftest-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OIPx8zP2; spf=pass (google.com: domain of linux-kselftest-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kselftest-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 S1353328AbhI3SRq (ORCPT + 5 others); Thu, 30 Sep 2021 14:17:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:56574 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353324AbhI3SRp (ORCPT ); Thu, 30 Sep 2021 14:17:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CE1EA6140F; Thu, 30 Sep 2021 18:16:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633025762; bh=PithgJcXSxG4ICOLoFz2z8ExdG55sGjdC8wj4uAYqD0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OIPx8zP2djUH5cgcnKc/85RhKEy3C2Lh4aelRvOAqY6X/MbIE3CKv0wl0qZ1IAVgR oxRXc+kA9IgIa+A2rXtrL818Vzb24o20ppybUZAXUGdFTja8pHlA/rh9lNLcRb89RT 0ae6YKUdpxTLFok1sZb01e4UNFV+NR3lWPKcb3zzszZzAqd4ak6faf28oxm/fTuo6l i2jWlobZZoYD8myEVIZ8cjRACHXSvwWKkmLmovxtI2qkvkhBp7KMmzrtJ5SO2diAlY uz/LBAPoLPUWPPfwQ/8UFdwqBkJz6gYAM0iQkMBPehz/GnJ/lHHPmgWSaCdg3Q9+8/ 2tUvjZPmnREXg== From: Mark Brown To: Catalin Marinas , Will Deacon , Shuah Khan , Shuah Khan Cc: Alan Hayward , Luis Machado , Salil Akerkar , Basant Kumar Dwivedi , Szabolcs Nagy , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown Subject: [PATCH v1 09/38] arm64/sve: Make sysctl interface for SVE reusable by SME Date: Thu, 30 Sep 2021 19:11:15 +0100 Message-Id: <20210930181144.10029-10-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210930181144.10029-1-broonie@kernel.org> References: <20210930181144.10029-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2574; h=from:subject; bh=PithgJcXSxG4ICOLoFz2z8ExdG55sGjdC8wj4uAYqD0=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBhVf3Ijcro8yKSABfOPd8ovr5grJZRZRylnaDhhItm ZPCHZquJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYVX9yAAKCRAk1otyXVSH0LIqB/ wIMdj+WJeKCwOHoC0yWIBT4oOMwtIv05oKb5g9y+GdruHlfBALs4FgkMjivHWr3eXauTjOWnczJViI /xTs8t6BN6gWad9Q85at5Z/ii59F90QP16yOXW4q8GGQrL45XjhIGFTCT7xqRnQ1sv1yuUsMXaZXtb CcP84TmURI+GMAZggDdjbilohaiT1WxTgTeIeAZv8qQVNNgNn4DUCMaGPkXgCikIx9bicj8wL+C+2H CzJgavgAizASyEJh7ENtl56XOC5jksjF1ppZtqYdBKdDxEDqyVtX3UX0nw1K6q9hZLy9vn7pHDMzBV 9uJPSRROOLdJMVEMNn00WYu48RrI1J X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The vector length configuration for SME is very similar to that for SVE so in order to allow reuse refactor the SVE configuration so that it takes the vector type from the struct ctl_table. Since there's no dedicated space for this we repurpose the extra1 field to store the vector type, this is otherwise unused for integer sysctls. Signed-off-by: Mark Brown --- arch/arm64/kernel/fpsimd.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) -- 2.20.1 diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 814080209093..e3a88fba390d 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -406,17 +407,21 @@ static unsigned int find_supported_vector_length(enum vec_type type, #if defined(CONFIG_ARM64_SVE) && defined(CONFIG_SYSCTL) -static int sve_proc_do_default_vl(struct ctl_table *table, int write, +static int vec_proc_do_default_vl(struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { - struct vl_info *info = &vl_info[ARM64_VEC_SVE]; + struct vl_info *info = table->extra1; + enum vec_type type = info->type; int ret; - int vl = get_sve_default_vl(); + int vl = get_default_vl(type); struct ctl_table tmp_table = { .data = &vl, .maxlen = sizeof(vl), }; + if (!info) + return -EINVAL; + ret = proc_dointvec(&tmp_table, write, buffer, lenp, ppos); if (ret || !write) return ret; @@ -428,7 +433,7 @@ static int sve_proc_do_default_vl(struct ctl_table *table, int write, if (!sve_vl_valid(vl)) return -EINVAL; - set_sve_default_vl(find_supported_vector_length(ARM64_VEC_SVE, vl)); + set_default_vl(type, find_supported_vector_length(type, vl)); return 0; } @@ -436,7 +441,8 @@ static struct ctl_table sve_default_vl_table[] = { { .procname = "sve_default_vector_length", .mode = 0644, - .proc_handler = sve_proc_do_default_vl, + .proc_handler = vec_proc_do_default_vl, + .extra1 = &vl_info[ARM64_VEC_SVE], }, { } }; @@ -1107,7 +1113,7 @@ static void fpsimd_flush_thread_vl(enum vec_type type) vl = get_default_vl(type); if (WARN_ON(!sve_vl_valid(vl))) - vl = SVE_VL_MIN; + vl = vl_info[type].min_vl; supported_vl = find_supported_vector_length(type, vl); if (WARN_ON(supported_vl != vl))