Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp173600rdh; Mon, 18 Dec 2023 15:40:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IEf6SKe1mEltg0+aK5Cj1H5W0sZYbIR1/X5X2Qn1VDCtTE6B+GsUUAJ5kU1bYdgPDfIXwNS X-Received: by 2002:a17:90b:ed0:b0:28b:9fdd:905d with SMTP id gz16-20020a17090b0ed000b0028b9fdd905dmr244493pjb.25.1702942824068; Mon, 18 Dec 2023 15:40:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702942824; cv=none; d=google.com; s=arc-20160816; b=GNjvqQ1sot7zQfSCP8onoYacr/zNvLa0kg4Zn9tKHEG1+WOpdUflVsrteOMrLXkWSA h2IqZyeJuz7wL3UtlRbsUOi9jOjGAA0Gk4sja2vR+ySd/YQZkdb6FVvWSH2firZJxtvr 674IInfIkM8ebNLt/UehANMJyAmRdTQwfVqo6O7H2ZpkhUwjuhy+JfSob26456j7rCse LXhCRonMyjPuMMA444CoTu1pveE2q3HWjv47CcYsYnFaZUrpHPcVrM6SoFz93gPtf8Gt FfCfTe/g07sn/0VTWpVDSf+VXP035qMq5Ba1aKUi9uIMDrUn/e5OWrb9AWuW1QF7i76X v2zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:message-id:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:date :from:dkim-signature; bh=dmVIJRg1ssYy+nK09Kl67LvA6lnse7YJJ95kHQAu3zU=; fh=NV4WoD5lmKZeVMGiCvPuc5fRgKl9gJAeLk9L4BmvLGQ=; b=QTqUMlS0tQ0HaAyRGv4FSXVhPFJ35DCnhRDDgrD2XIml+XaKVzmTVZrqPpaLyQ3WET F9MZe65ZqY7ZqUuY2/jwxMbEc0AtrBMV8JPCTfKrihkYgh490Pw5ldEkNtS/3wfx6cD/ iljhcKuFZTuAwVucd/CY4t6mazzvl/YBLmL0q7IBuJlKEZere05I/dL4nEniiA+7LK5l g16nFq07FbpE3fz5SqlIV4nFY1gVRgd9Fbd7g/quUANSSVhIpKkwaGX2krKaIkXDx2fI Ib29XZJqURbWikUUevLP0wi3UpIlW7dYym7Wo5ffAXrTImAVaskzX0H1fFKA587/IPwN XYJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DwFSCxq+; spf=pass (google.com: domain of linux-kernel+bounces-4498-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4498-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id j7-20020a654287000000b005bdff953b76si18198457pgp.197.2023.12.18.15.40.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 15:40:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4498-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DwFSCxq+; spf=pass (google.com: domain of linux-kernel+bounces-4498-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4498-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 29BBEB22013 for ; Mon, 18 Dec 2023 23:39:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A6B7B760B2; Mon, 18 Dec 2023 23:39:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DwFSCxq+" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB1FB1D14D; Mon, 18 Dec 2023 23:39:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8325C433C7; Mon, 18 Dec 2023 23:39:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702942779; bh=OcRwwaGGPxRicGDvk46gVxGH6DVGcgRe9WWBzbdRGGM=; h=From:Date:Subject:To:Cc:From; b=DwFSCxq+IoCWYsleB/Bj3cyZYXmVUJ1ld5+sAbfQOmHgN+6bEtEUc0IOowBrzcpYQ lgQZWWjZPabP6jsPQKNHOCPdOpDVXjaC2Cpa4bhV+DBcvV/VdJ8QzEQproTRmdihVm Rx5NYYn9v+JprVYNzfdOMOKVAk6Tn2+NKJeFV6zp1/4jN7Ogk+yw5omG/dE5WJVAnc qIoxYEwqTY5q4XFBWeU0m+kUYtJ6aVUZZ+0mKxS5QLV2vIG3G4QktQDU8S3PA4wS99 6qNXijpCaEZ3AzkOtqo8LEI/viRbEgdXdYaEP5DnmdFDDhrG17TMeauqRaZOlZw/p4 H1naZ3K+7raLQ== From: Mark Brown Date: Mon, 18 Dec 2023 23:39:32 +0000 Subject: [PATCH] kselftest/arm64: Don't probe the current VL for unsupported vector types Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231218-kselftest-arm64-vec-syscfg-rdvl-v1-1-0ac22d47e81f@kernel.org> X-B4-Tracking: v=1; b=H4sIADPYgGUC/x3NQQ6CMBBG4auQWTuJrRWDVzEsmvIXJyKaGdJIC Hencflt3tvIoAKje7ORoojJZ65wp4bSM84jWIZq8md/cd5d+WWY8gJbOOq7DVyQ2FZLeWQdysS 3LgS4LqY2ZKqVryLL73949Pt+AGmRVcFxAAAA To: Catalin Marinas , Will Deacon , Shuah Khan Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.13-dev-5c066 X-Developer-Signature: v=1; a=openpgp-sha256; l=2217; i=broonie@kernel.org; h=from:subject:message-id; bh=OcRwwaGGPxRicGDvk46gVxGH6DVGcgRe9WWBzbdRGGM=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlgNg4KHZ2pT1ckQPky4CBUbPiGTOrGmXr2vzLyyfh S9O7o+KJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZYDYOAAKCRAk1otyXVSH0CWZB/ 4xFWcfFuKsRc3GM3Qca5XgAyj0mt0s2/BrDYnFcb6qZH74/ugBfR8JbCLlQgHwDWRYpEanyvckehrj VCuySg5d5xRuouwJQOeq2uvvFPruFGWSn3vluFrqtyX+gaAewnoWVyZGhrcZiFVbBVruAYrQUuJjB5 zbkJwMgbYD9E9O6nzsYXiHmxa3x22hWlzXzzvu7qRySXs3SMr8xZQJacWjcLMSGDsMx13laMv94yB3 h/34XnAMtOvmHkQbFV353HWh5nWmCMNtcyWd6T2/C8hZFSca2m8uUgrB1QeA+CfZtQxZ8vG4X/4Vm6 AB/1jC/675E60GZmemgC7CrthdsKC/ X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB The vec-syscfg selftest verifies that setting the VL of the currently tested vector type does not disrupt the VL of the other vector type. To do this it records the current vector length for each type but neglects to guard this with a check for that vector type actually being supported. Add one, using a helper function which we also update all the other instances of this pattern. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/fp/vec-syscfg.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/arm64/fp/vec-syscfg.c b/tools/testing/selftests/arm64/fp/vec-syscfg.c index 5f648b97a06f..ea9c7d47790f 100644 --- a/tools/testing/selftests/arm64/fp/vec-syscfg.c +++ b/tools/testing/selftests/arm64/fp/vec-syscfg.c @@ -66,6 +66,11 @@ static struct vec_data vec_data[] = { }, }; +static bool vec_type_supported(struct vec_data *data) +{ + return getauxval(data->hwcap_type) & data->hwcap; +} + static int stdio_read_integer(FILE *f, const char *what, int *val) { int n = 0; @@ -564,8 +569,11 @@ static void prctl_set_all_vqs(struct vec_data *data) return; } - for (i = 0; i < ARRAY_SIZE(vec_data); i++) + for (i = 0; i < ARRAY_SIZE(vec_data); i++) { + if (!vec_type_supported(&vec_data[i])) + continue; orig_vls[i] = vec_data[i].rdvl(); + } for (vq = SVE_VQ_MIN; vq <= SVE_VQ_MAX; vq++) { vl = sve_vl_from_vq(vq); @@ -594,7 +602,7 @@ static void prctl_set_all_vqs(struct vec_data *data) if (&vec_data[i] == data) continue; - if (!(getauxval(vec_data[i].hwcap_type) & vec_data[i].hwcap)) + if (!vec_type_supported(&vec_data[i])) continue; if (vec_data[i].rdvl() != orig_vls[i]) { @@ -765,7 +773,7 @@ int main(void) struct vec_data *data = &vec_data[i]; unsigned long supported; - supported = getauxval(data->hwcap_type) & data->hwcap; + supported = vec_type_supported(data); if (!supported) all_supported = false; --- base-commit: 2cc14f52aeb78ce3f29677c2de1f06c0e91471ab change-id: 20231215-kselftest-arm64-vec-syscfg-rdvl-7944e19ac64f Best regards, -- Mark Brown