From patchwork Tue Jul 27 18:06:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 486743 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:1185:0:0:0:0 with SMTP id f5csp458526jas; Tue, 27 Jul 2021 11:12:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlBrAW6i9/Mo9wYFhSsKOJctLt7VMtKOq7IGQAoT/igd689svAX454uhrY7Wovw6w7DF7B X-Received: by 2002:a5d:9c4a:: with SMTP id 10mr19918130iof.23.1627409547062; Tue, 27 Jul 2021 11:12:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627409547; cv=none; d=google.com; s=arc-20160816; b=FqfaKHvBzwgKdO+o64HCkltVH5C7w5nVkmpaZHqRHuDj2sfc70Eiyo4e1aOLLKQa/6 pbC54/zHCeNeT49oecgA+ZraLElBpeGa28PQDuMVLew0aQSHoSXGVtDDlkZqAPxUKM8J G9Cf9CYZJrRtzcnlAHQsdG0imBZif6USUvK8ej0JrqiS/pUKuNLtnL8ZaaLeKHmFW7Us rlRnp2J6yA928Aa0mknbLOAP3EV0TkaBS/CglK+Uh69Wa9jfhOyOS56aQj/CnLW7fGPZ UU30S8ozMNqL3qQUAiX6xiU6G2OVI9dNR3Qfo2uYnTWztIrafedXP6Rq/FFZ3z38XwPb m4bg== 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=q3zIj63zHcNF1ZXggxhoNqMziCqmY8El7Cy1T2GKjLU=; b=0Bmbi6vU5BQ8ti2uTcLdLXQCEyubmq1zDaV5MGw8yklB9bg1L9uHlQGjDYARjcnlAx R+4QY1Gsc5T9lpTTofTd2cKnqFic/U5zUmEx3OQgUcSSAyC/hqDk47NY9VMeWieIPeKw mJE4hz61d38YDKcwKbVioUiuC570Bio/tKm5uoT5mIWxf00O16EJH1Id0sik8LnOdvek WLRcsnba9ALEWEsTpjwtUAlRB6a81SEA0KRPOctH4Lp+hkww8gm26TaznBWp+rvfTnn2 cOrW6JN9qcU/JQ4x0AavAv6lDaFizsMb56QLMDhXrXD29TJyPw50zwBU57kvsCzMxyH5 bA/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qfYrpzOF; 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 n14si4577533ilk.78.2021.07.27.11.12.26; Tue, 27 Jul 2021 11:12: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=qfYrpzOF; 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 S229801AbhG0SM0 (ORCPT + 5 others); Tue, 27 Jul 2021 14:12:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:55096 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229716AbhG0SM0 (ORCPT ); Tue, 27 Jul 2021 14:12:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 716CE60F8F; Tue, 27 Jul 2021 18:12:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627409546; bh=RCUI82H/4W6FmihK1AkpRMF/AXitVCXzKcuEuGl6Cws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qfYrpzOFiclHXLc3NqAlAi8Tdy1qoaX7rF31MBTBvrdkj85EaPkrjgkECV8hYM6Xb fl2aN5G5U07MkK4XFeZbCK35uVcnacBpk7SYtCc4jL/0NNGZMPCNAh7VvUzRwsr96R En3cV0EkkGt+NFh4Ib4j+c9HO99q7kvWewwQaC8KCFf2y6AbB2/mva9Q05hdSy/xLY YW4C6jWKL0YXzw5H8mGBO/I1rttvqWQIie6s5EHYFumEjFLLWuxRha6vo4bpQZo4zg a1yD/kcWcW/D5UtMgUL3cTy+DQrwa6pVOILXYc95uM2R/lhwDMguWrFn/fEyuHfEWf UFxzb3u8rKAwg== From: Mark Brown To: Catalin Marinas , Will Deacon , Shuah Khan Cc: Dave Martin , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown Subject: [PATCH v1 1/3] kselftest/arm64: Provide a helper binary and "library" for SVE RDVL Date: Tue, 27 Jul 2021 19:06:47 +0100 Message-Id: <20210727180649.12943-2-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210727180649.12943-1-broonie@kernel.org> References: <20210727180649.12943-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3690; h=from:subject; bh=RCUI82H/4W6FmihK1AkpRMF/AXitVCXzKcuEuGl6Cws=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBhAEs2Mq3zDnqSnFUJ1lvpDawfFS3yduzdzxjq60HD 0JBiBAOJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYQBLNgAKCRAk1otyXVSH0AFrB/ 0QCP3wT2npf1UclpRSCIYsykb431h/S27r0l1MJksGNS2ZweG+jA3q84D0POpHmjvWGVeSErJ8GDEn DJdxiO6of7P+aRLxFKSGUA/ZatOi2vhRUkXjHpjJNsI6NIqpiMpa51zw5QkpkqDwZO+3i0zN2gRuDy Y5UG9kx9Fl42R9TJ4jpzblZLiSbAtLaAm9ERFsGLbNAfmzXn/T0SVdTFbFPs+tVa0ilxguNJdyf+Vu 6HC26YU6LSJAtP18Xf8afCQtWl5Sv1n+tX2cd9Eba5EqXjmaTvSHRua5n/V2imZIucNYb2w5ilnqtd 3k9kOpHC6cCrBBDjm+ovr4UYp2C8gS X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org SVE provides an instruction RDVL which reports the currently configured vector length. In order to validate that our vector length configuration interfaces are working correctly without having to build the C code for our test programs with SVE enabled provide a trivial assembly library with a C callable function that executes RDVL. Since these interfaces also control behaviour on exec*() provide a trivial wrapper program which reports the currently configured vector length on stdout, tests can use this to verify that behaviour on exec*() is as expected. In preparation for providing similar helper functionality for SME, the Scalable Matrix Extension, which allows separately configured vector lengths to be read back both the assembler function and wrapper binary have SVE included in their name. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/fp/.gitignore | 1 + tools/testing/selftests/arm64/fp/Makefile | 6 +++++- tools/testing/selftests/arm64/fp/rdvl-sve.c | 14 ++++++++++++++ tools/testing/selftests/arm64/fp/rdvl.S | 9 +++++++++ tools/testing/selftests/arm64/fp/rdvl.h | 8 ++++++++ 5 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/arm64/fp/rdvl-sve.c create mode 100644 tools/testing/selftests/arm64/fp/rdvl.S create mode 100644 tools/testing/selftests/arm64/fp/rdvl.h -- 2.20.1 diff --git a/tools/testing/selftests/arm64/fp/.gitignore b/tools/testing/selftests/arm64/fp/.gitignore index d66f76d2a650..6b53a7b60fee 100644 --- a/tools/testing/selftests/arm64/fp/.gitignore +++ b/tools/testing/selftests/arm64/fp/.gitignore @@ -1,4 +1,5 @@ fpsimd-test +rdvl-sve sve-probe-vls sve-ptrace sve-test diff --git a/tools/testing/selftests/arm64/fp/Makefile b/tools/testing/selftests/arm64/fp/Makefile index a57009d3a0dc..ed62e7003b96 100644 --- a/tools/testing/selftests/arm64/fp/Makefile +++ b/tools/testing/selftests/arm64/fp/Makefile @@ -2,12 +2,16 @@ CFLAGS += -I../../../../../usr/include/ TEST_GEN_PROGS := sve-ptrace sve-probe-vls -TEST_PROGS_EXTENDED := fpsimd-test fpsimd-stress sve-test sve-stress vlset +TEST_PROGS_EXTENDED := fpsimd-test fpsimd-stress \ + rdvl-sve \ + sve-test sve-stress \ + vlset all: $(TEST_GEN_PROGS) $(TEST_PROGS_EXTENDED) fpsimd-test: fpsimd-test.o $(CC) -nostdlib $^ -o $@ +rdvl-sve: rdvl-sve.o rdvl.o sve-ptrace: sve-ptrace.o sve-ptrace-asm.o sve-probe-vls: sve-probe-vls.o sve-test: sve-test.o diff --git a/tools/testing/selftests/arm64/fp/rdvl-sve.c b/tools/testing/selftests/arm64/fp/rdvl-sve.c new file mode 100644 index 000000000000..7f8a13a18f5d --- /dev/null +++ b/tools/testing/selftests/arm64/fp/rdvl-sve.c @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include + +#include "rdvl.h" + +int main(void) +{ + int vl = rdvl_sve(); + + printf("%d\n", vl); + + return 0; +} diff --git a/tools/testing/selftests/arm64/fp/rdvl.S b/tools/testing/selftests/arm64/fp/rdvl.S new file mode 100644 index 000000000000..6e76dd720b87 --- /dev/null +++ b/tools/testing/selftests/arm64/fp/rdvl.S @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Copyright (C) 2021 ARM Limited. + +.arch_extension sve + +.globl rdvl_sve +rdvl_sve: + rdvl x0, #1 + ret diff --git a/tools/testing/selftests/arm64/fp/rdvl.h b/tools/testing/selftests/arm64/fp/rdvl.h new file mode 100644 index 000000000000..7c9d953fc9e7 --- /dev/null +++ b/tools/testing/selftests/arm64/fp/rdvl.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef RDVL_H +#define RDVL_H + +int rdvl_sve(void); + +#endif