From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CFAC5C4345F for ; Fri, 12 Apr 2024 10:36:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=eoph31SoD5KkMFFFTm5XabItx2O72kqveb0yZwD3/8Y=; b=edPxOuWGuuQRgE eAmIL7srU8I+NDuPTEnySogJYyDN5xPrpmhqDtw9eTHYtE5kKaozxKSKz6aVcAfDd7jguv/DjDTa1 lp6Kl2Up6/hggR1YgqKrJCJqpD9fGFFD1v8mC19oWqYL4mrnAAGPSO2EwrE18t1wYQfSIRXCtVeTs Hh7VDhkwtalToM2S4P27qXrW1dxxKIJsuUgy46rSJpexuWvmLemzpTvQmAqMXNRKwSjq9xuDORWbV ElaiP+N6I1ZzlQiqhHbiLTmPzPS898TZkGVrCAFaf0dcZrCAFPS0hvyoh0tr0uqgO6yswSvN8PZWF M238km44w0or8hRhlpfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvEGa-0000000Ghi8-1RoC; Fri, 12 Apr 2024 10:36:20 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvEFF-0000000GgUd-20XO for linux-arm-kernel@lists.infradead.org; Fri, 12 Apr 2024 10:34:59 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 857E71596; Fri, 12 Apr 2024 03:35:26 -0700 (PDT) Received: from ewhatever.cambridge.arm.com (ewhatever.cambridge.arm.com [10.1.197.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8F3033F64C; Fri, 12 Apr 2024 03:34:55 -0700 (PDT) From: Suzuki K Poulose To: kvmarm@lists.linux.dev Cc: kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-arm-kernel@lists.infradead.org, maz@kernel.org, alexandru.elisei@arm.com, joey.gouly@arm.com, steven.price@arm.com, james.morse@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, andrew.jones@linux.dev, eric.auger@redhat.com, Suzuki K Poulose Subject: [kvm-unit-tests PATCH 19/33] arm64: selftest: add realm SVE VL test Date: Fri, 12 Apr 2024 11:33:54 +0100 Message-Id: <20240412103408.2706058-20-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240412103408.2706058-1-suzuki.poulose@arm.com> References: <20240412103408.2706058-1-suzuki.poulose@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240412_033457_847984_6DADB1C9 X-CRM114-Status: GOOD ( 15.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Joey Gouly Check that the requested SVE vector length matches what the Realm was configured with. Signed-off-by: Joey Gouly [ Fix build failures on arm ] Signed-off-by: Suzuki K Poulose --- arm/selftest.c | 6 ++++++ arm/unittests.cfg | 2 +- lib/arm/asm/sve-vl-test.h | 9 +++++++++ lib/arm64/asm/sve-vl-test.h | 28 ++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 lib/arm/asm/sve-vl-test.h create mode 100644 lib/arm64/asm/sve-vl-test.h diff --git a/arm/selftest.c b/arm/selftest.c index 8caadad3..7bc5fb76 100644 --- a/arm/selftest.c +++ b/arm/selftest.c @@ -21,6 +21,8 @@ #include #include +#include + static cpumask_t ready, valid; static void __user_psci_system_off(void) @@ -60,6 +62,10 @@ static void check_setup(int argc, char **argv) "number of CPUs matches expectation"); report_info("found %d CPUs", nr_cpus); ++nr_tests; + + } else if (strcmp(argv[i], "sve-vl") == 0) { + if (check_arm_sve_vl(val)) + nr_tests++; } report_prefix_pop(); diff --git a/arm/unittests.cfg b/arm/unittests.cfg index e35e8506..3cf6b719 100644 --- a/arm/unittests.cfg +++ b/arm/unittests.cfg @@ -33,7 +33,7 @@ [selftest-setup] file = selftest.flat smp = 2 -extra_params = -m 256 -append 'setup smp=2 mem=256' +extra_params = -m 256 -append 'setup smp=2 mem=256 sve-vl' groups = selftest # Test vector setup and exception handling (kernel mode). diff --git a/lib/arm/asm/sve-vl-test.h b/lib/arm/asm/sve-vl-test.h new file mode 100644 index 00000000..19eaf669 --- /dev/null +++ b/lib/arm/asm/sve-vl-test.h @@ -0,0 +1,9 @@ +#ifndef __ARM_SVE_VL_TEST_H +#define __ARM_SVE_VL_TEST_H + +static bool check_arm_sve_vl(long val) +{ + return false; +} + +#endif diff --git a/lib/arm64/asm/sve-vl-test.h b/lib/arm64/asm/sve-vl-test.h new file mode 100644 index 00000000..c82ea154 --- /dev/null +++ b/lib/arm64/asm/sve-vl-test.h @@ -0,0 +1,28 @@ +#ifndef __ARM_SVE_VL_TEST_H_ +#define __ARM_SVE_VL_TEST_H_ + +#include +#include + +static bool check_arm_sve_vl(long val) +{ + unsigned long vl; + + if (!system_supports_sve()) { + report_skip("SVE is not supported\n"); + } else { + /* Enable the maxium SVE vector length */ + write_sysreg(ZCR_EL1_LEN, ZCR_EL1); + vl = sve_vl(); + /* Realms are configured with a SVE VL */ + if (is_realm()) { + report(vl == val, + "SVE VL expected (%ld), detected (%ld)", + val, vl); + } else { + report(true, "Detected SVE VL %ld\n", vl); + } + } + return true; +} +#endif -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel