From patchwork Wed Jul 28 16:33: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: 487915 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:1185:0:0:0:0 with SMTP id f5csp1366956jas; Wed, 28 Jul 2021 09:34:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqQsCAIAsBHOgkghaKWLQJhZIDM36EoywlDljEZslfiH1zjwOmgV23nO6EdAmYTHLlLKTB X-Received: by 2002:a02:9508:: with SMTP id y8mr659814jah.28.1627490056771; Wed, 28 Jul 2021 09:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627490056; cv=none; d=google.com; s=arc-20160816; b=L5m33SVxF6/skC9KG863oBrDA2D1fTwp349yOyNKfEUzplDy5kHvKVmrECcwq/NMh9 co89u2d5DBJ1qmVK5mbxnEMU448a+u4bKBbpUFDXwOQtiRIj72TIekwxRA/unk9ROL0h WHCI99eXGPrcTWCXFyLnay9t4xv3ZkucswbEo1epnoJ3NF5AsbDTZen+uMq+D/m9CDLh GeLBx09DHo3/vwgXY9+7kslQu5cg/hMlmxasfiyJHjPPEwFd7FjojYaoW+NpwmbB/fKC D0bSt9cRYIz00ro7Ct5h/aNcvIF+WnS+Drk5+V8aJ+5R8jnRK3PbkvkA7ddvKaDO9fuc yvdQ== 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=bE/4Blqm8vUCar1X8Dg5HwQzMMUpPzRPIANYpBkDIemWZwkWqcpXtdMVyK/CNeoJWE VT9E1QxAamhsKtk0PnS0Sk+2KrSyqwBucPh9KEG0PE7fR2gQRz7Mt7lzMnTy3BKpLVHP BI43jTtKBViqiA7z9YnOt0is94leEyOwK9OkxkzcDl5s/QQzjBKHDN3/cOgQVGeJxc3K AFZIXLAkafYvkKWylaZFtGs1UArQDPb5zLQHh48aafFzqB4G9+VyNjIJdVhX5xpupWr4 gWn9mpgoYr+UxE974W+3mwivVxroyC8qnPxcatTOCaKtlqjR6kU6EIvdvOiJ5oSFLehm ++3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AOQUiF1J; 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 x9si190041ill.152.2021.07.28.09.34.16; Wed, 28 Jul 2021 09:34:16 -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=AOQUiF1J; 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 S229716AbhG1QeM (ORCPT + 5 others); Wed, 28 Jul 2021 12:34:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:37570 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229591AbhG1QeL (ORCPT ); Wed, 28 Jul 2021 12:34:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1A58961019; Wed, 28 Jul 2021 16:34:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627490049; bh=RCUI82H/4W6FmihK1AkpRMF/AXitVCXzKcuEuGl6Cws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AOQUiF1JWUO7NK2AQzN8gpwtfYmLeeMCV6WdOhKq7W7UZaJi2REKrbA/Inwrqv6ut AV9bQQEGnQuLt8fTUkcLrJl0nyg2XzxsFb19b/oidNbmQLWnCT0d9H16DW97oDuJ09 rb3wbC00pK/XbpLx+crSh2e8TVmKqwLmRlApu6ZKMRlkjLugsmiJ5Oq5/sAjfcWUZJ QxSPU75Ki2Rgf5yiPevoNhA6HcCkCgdek62ElHTnPB8NJhKMF+V2pTa7JQsSrQ6HPq vr8zITlM8mp2UafT77IiPEaqko4LqtH3W2HibdoD0bnp38fP5hMEa7diHN71lisdRv /vH6Uzcb4z22g== 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 v2 1/4] kselftest/arm64: Provide a helper binary and "library" for SVE RDVL Date: Wed, 28 Jul 2021 17:33:15 +0100 Message-Id: <20210728163318.51492-2-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210728163318.51492-1-broonie@kernel.org> References: <20210728163318.51492-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/pANAwAKASTWi3JdVIfQAcsmYgBhAYbJMq3zDnqSnFUJ1lvpDawfFS3yduzdzxjq60HD 0JBiBAOJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYQGGyQAKCRAk1otyXVSH0GFMB/ 4kheASFmEw33ww3jo6pF7GQdVH6TLvOo+Ji9hhnfkHt0LS5GM6jXGTNtXj0jtbfqnGGCtU01omJnTo t0cGvNAL6lBAhgPv/iOUzW4w1EfmAsJHfnEHyjAfgxZhW2mKXHYlF1USx+Svo6of0OaM5nSAB2HhvG ruDd9jTaGkaNxSwyhKPRG/8q0w1D3npORzW0YWJMP2PDzMsPddF6yVN1xCs1Xnr78tSUhR8nlfQ4xm G9g8R+klEfivWN7aqZtgc5GhOh8P1fMla0ixppl0BDhqgeXNPwJTmJ3YS6daH3fcKFM2OXIAL6KgSd n/L9Hu8P1VExqkPJDJWyIPBlrQ09m+ 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 Reviewed-by: Dave Martin 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