From patchwork Tue Aug 3 14:04: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: 490959 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp683072jap; Tue, 3 Aug 2021 07:07:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHPfzs4rHKlw6y3rqkXMDJJ9rBs707c68DUPKxi/3O5MkthVSqteJf/thRCUCQmPoiFNWf X-Received: by 2002:aa7:c0d1:: with SMTP id j17mr25540735edp.217.1627999625256; Tue, 03 Aug 2021 07:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627999625; cv=none; d=google.com; s=arc-20160816; b=Lf15Y2SEqBzATGYKvzi2Dmy6HxSklt87mbajSiuNwMEiA9JEOXP/C89TI0Ix/dwA+s lYS0KjmICIgJP3ZSpIR2e43jcx0mejuEEgWvYqF8fEvO8LSU3nUa3J6BUngkaNy0+OzW QSER5Mkq3L6BgS4CYMet2sA3QfK9D0RbxUfa/wylFichLH09TXJfpniRdIgTwRhBIUw7 6LMmpB9R+4HM+TN/ITtiMIE+nF555cYKV4+LVnL69c4dCXCnTHeZUSO9dbd1Hb7Whnlj c439jeS1IRq/JL3Vhlq5D9aFjzBhAe/u9n79u0ObVOg+M1UTq9WJn1dEQLVk4N5QRw+1 ybqg== 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=aAwiAhnl5sNcP5r4yCWW7lNLnNpatRgnrVKwHiQSnZI=; b=f1cNhHOCVhjz7OseiuZO0IKB1EZTMW8q+bGQpsNM296z8U+Gr3zPIy649MHfax1pI5 YrSIo96u4QPd68sZL5hrk2GE6JnOGgMzcA3Uilu4XilrGvhiG0+yvjCqQeVDrtP2m1La ROyxFco2YHaZS3NQ4NZh5UCiMNtOhR2/EvU/fBpR4Lj5SIwNeO3BGp1MqN5a/IwnvuC8 x5rFevlp/olOdZVhwhyexpuq6PCnK5xE1LaKI6/MsljbTwE4lOuv1oo6Khj5ipXWR8j0 jCNn+d6BeL6PMunaTipyvgrFTgNBD72apt9eV64mY2Tv4cwfDhy/jyXkdODC7PetKBm5 zRzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DZAhL0lh; 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 e22si12603852ejt.607.2021.08.03.07.07.05; Tue, 03 Aug 2021 07:07:05 -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=DZAhL0lh; 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 S236412AbhHCOHP (ORCPT + 5 others); Tue, 3 Aug 2021 10:07:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:45934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236045AbhHCOHP (ORCPT ); Tue, 3 Aug 2021 10:07:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A033560F58; Tue, 3 Aug 2021 14:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627999624; bh=CdGB4OG/NflCYBfXLsaKyb4ZgSAIM7cHqA6soZ5TczM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DZAhL0lhMdOqPuhfqFJHm3YdHK4fZBPYMZkj4rmwIKJ+izfLJMzu3AqRLy18x/UEQ /HA0wO4QkSIfqpYpHEQ6fa1kzDKCg/1s094CpHBX09ahOZjKBPvKGsLdvnsdYXAuEO ckxv+AHzXUdTjYBz/AOpWirtfR7xdqaJ/DJn06oBHWWNfvcNaxajt4Sd55P6N1baAv r4PptcjzYGswwXnxX/GqB45Z5e0q8bCICw2C9TM8AUhrvR143agcGSdBbFUQxsUeqw qZUo9jTQ+YWuOPvvMMAvUFf9IjbkBLkQKY7VFJzUlsP+A4wJCIu0ph4MzVBC/rIpYb mzyPhQkilS0jg== 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 v5 1/4] kselftest/arm64: Provide a helper binary and "library" for SVE RDVL Date: Tue, 3 Aug 2021 15:04:47 +0100 Message-Id: <20210803140450.46624-2-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210803140450.46624-1-broonie@kernel.org> References: <20210803140450.46624-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3762; h=from:subject; bh=CdGB4OG/NflCYBfXLsaKyb4ZgSAIM7cHqA6soZ5TczM=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBhCUz+oc07YHrsOh1K2NDPohsDGoEt9Zt9fNhL16wI 3/ocqPOJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYQlM/gAKCRAk1otyXVSH0HsPB/ 9Rs0XhQPDNJzZfvm1QLSriYUIJODU/HJz4lREPzuB2LvrBJzf++WiUAzQA6BcKvdV7WZ1CygkCxLLD Gw+hejl1/TClEZQ7VOMg93o65dS1ftAJEwdUFvHBIC8ugMoYNGeF/dFFbDDP3Y2NzzVPWfy3WrgCN+ Ho9Y0RnjqvU8fnC6HpLL9spP3yvAHNCUghM+2kFWfaJy8u4bfGlVwq1BGF951HsCEiu8UOUbP85toV U5kD+0BcIE91nPAPt8KO524zn79bS0MO3K+NqKOweFnVv4yUuqJ2EnSXVo8sp2vfs1Ca+0uCpOIgan So5Xo3dmTIfVKZl2ccKvMv9UAmwHwm 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 Reviewed-by: Dave Martin --- 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 | 10 ++++++++++ tools/testing/selftests/arm64/fp/rdvl.h | 8 ++++++++ 5 files changed, 38 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..c916c1c9defd --- /dev/null +++ b/tools/testing/selftests/arm64/fp/rdvl.S @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Copyright (C) 2021 ARM Limited. + +.arch_extension sve + +.globl rdvl_sve +rdvl_sve: + hint 34 // BTI C + 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