From patchwork Thu Sep 30 18:11:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 514944 Delivered-To: patch@linaro.org Received: by 2002:a02:606e:0:0:0:0:0 with SMTP id d46csp36718jaf; Thu, 30 Sep 2021 11:16:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsS9U07KOSbp3cvRdLDbGNs2yr22TBy72UaY0BZnERorCg3A59Q2Olf6N8Qx1pxZ1envpr X-Received: by 2002:a17:906:1299:: with SMTP id k25mr754174ejb.139.1633025787943; Thu, 30 Sep 2021 11:16:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633025787; cv=none; d=google.com; s=arc-20160816; b=DJ54jdMPNbykJjWlItd6743NITZtGmejK/Y/2HFEUnqaJMMf/7V+db9MYSy0a4kI7X IirGPE0EE55FuwIhbAvYqfiyFvri4g5GiWixeZ9oEFZ24LfKmTJ/h8s05AVnYMvyE1g3 7az9SaMMKwU+wMSvOLK7g5M06Jh12bLvMDckUjYIDmg84qa9+Fp6faDrMnyFAqTISJjz fdetZDiiRk1s0y6X0gGnhH/119UCgWLcb7PNM2wnYpgF06NRTBWcGYe2UaqpsY0y/p6b JPgXWbpOBGx7NiyUn2P+H6EVmCJPd8hJ0ppx3YEs509iHhn3A6qhpdbvJlLMmOG93fLV WI4Q== 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=8L5hwKYEhO2jC2d1arXh5xg1FyB1/gP3hPBHq9RXC90=; b=dTiZg1Up4ZQwAAH9jGxGk/Uuy/P9AHumu4GDeSVmhPSyAucxeoiSgfyiE61gbuWKfw wt9CtEC6GD+2HJSowBKB3k+SFO4Ey079BWy25WBVnd2WMwt6QxdcGTGZ3ilzykv16ffV 5aNVttzEmJrlLNd7H2T3j9HUQvrLrL/7X9vUW3F6jmjjAbj89JuPiE4ucM+6BMB9Vm1u CWlHsXQ/N1dSMO2ueMt4wkmlzFKoY3kbQ0Lu9klVPKFi692HZRDHchIQNM1xRDNqTXXM b+ztbGMihtASoBWsK4hnwqIBQbXmMCu8w/pgU2PSlRZbIJ5m+9yjhqAq9mCQGg281vCr yCSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZFDRDG3e; 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 t5si4335628edj.607.2021.09.30.11.16.27; Thu, 30 Sep 2021 11:16:27 -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=ZFDRDG3e; 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 S1353341AbhI3SSK (ORCPT + 5 others); Thu, 30 Sep 2021 14:18:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:56950 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353313AbhI3SSJ (ORCPT ); Thu, 30 Sep 2021 14:18:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4133761A03; Thu, 30 Sep 2021 18:16:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633025786; bh=ppNilmd41ktcloswCiFo5q0EqUcX7jUnqq9a+DvuZf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZFDRDG3eXhxramQSvgOrqSc32JEY3ti8KG1TQ310it8UBxxUdbH+20u9JzJ0BkNCE vBKhjqqbUD9h+ikPKk0DHdpud4+kxBywvx8OxehGwUKKuGIIE8nPOiXdbzFECG27/X jtfIT5zardNAbCMOYwJ7YTXNrh79VSxXxSZfOODQNBudTi0qQ1tfq6i7EnI16dMC9M PwYnHw5o0XEKIOxWB9ub87y+jin2NpCNqKqRldZMXUze8/5Iun7kQdGDWmQbdmF+ol OdcVkORinsTsV6BKpVtn4ahk07kxrdQfYtFTDiNKqTM4E5qh82r2RYVamA6v/krEkS L1MD53JYMd/hw== 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 18/38] arm64/sme: Implement sysctl to set the default vector length Date: Thu, 30 Sep 2021 19:11:24 +0100 Message-Id: <20210930181144.10029-19-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=1673; h=from:subject; bh=ppNilmd41ktcloswCiFo5q0EqUcX7jUnqq9a+DvuZf4=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBhVf3PlaTEipZFWpf2CpTPoMn0FTSlkC+9f7GmZ6X4 tlHqPA6JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYVX9zwAKCRAk1otyXVSH0LZuB/ oDSJh+sYo4gwbP84gJgxSDuonJlPFCgGIeL0a6rG/iF2IiPHP+PcXb1QS5ecl54AefScThQhnV/cw7 Ia4tUPqSSyHJEXHDHOBrx9UHO9MChMwG7IY4QhaX9/tfctZb06spbJt9k7gxzuzq8wBGNmT/sxnF1j FeoyYT+tIR+l/k1vNywJjoOXGyHhW9uKIGYZzXSUnPMRtc0Yc9LJJ7sopQwzhSQ9Yp1j3geLKMFNdj 6/lYizsLA+vyTvAbOCpeHThHyCiD/1cmoMes3Yn9QQETnOKVnpMrsroDMYRa1+/6F8okoGQfRJVZCp uaDytRT/XgLH4+4fJ8TKZPXVc43H0f X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org As for SVE provide a sysctl which allows the default SME vector length to be configured. Signed-off-by: Mark Brown --- arch/arm64/kernel/fpsimd.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 430c949a2438..13df5920fe1e 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -482,6 +482,30 @@ static int __init sve_sysctl_init(void) static int __init sve_sysctl_init(void) { return 0; } #endif /* ! (CONFIG_ARM64_SVE && CONFIG_SYSCTL) */ +#if defined(CONFIG_ARM64_SME) && defined(CONFIG_SYSCTL) +static struct ctl_table sme_default_vl_table[] = { + { + .procname = "sme_default_vector_length", + .mode = 0644, + .proc_handler = vec_proc_do_default_vl, + .extra1 = &vl_info[ARM64_VEC_SME], + }, + { } +}; + +static int __init sme_sysctl_init(void) +{ + if (system_supports_sme()) + if (!register_sysctl("abi", sme_default_vl_table)) + return -EINVAL; + + return 0; +} + +#else /* ! (CONFIG_ARM64_SME && CONFIG_SYSCTL) */ +static int __init sme_sysctl_init(void) { return 0; } +#endif /* ! (CONFIG_ARM64_SME && CONFIG_SYSCTL) */ + #define ZREG(sve_state, vq, n) ((char *)(sve_state) + \ (SVE_SIG_ZREG_OFFSET(vq, n) - SVE_SIG_REGS_OFFSET)) @@ -1676,6 +1700,9 @@ static int __init fpsimd_init(void) if (cpu_have_named_feature(SME) && !cpu_have_named_feature(SVE)) pr_notice("SME is implemented but not SVE\n"); - return sve_sysctl_init(); + sve_sysctl_init(); + sme_sysctl_init(); + + return 0; } core_initcall(fpsimd_init);