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 X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B52BC433EF for ; Mon, 13 Sep 2021 13:21:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F87861155 for ; Mon, 13 Sep 2021 13:21:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240667AbhIMNXG (ORCPT ); Mon, 13 Sep 2021 09:23:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:35020 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239450AbhIMNUy (ORCPT ); Mon, 13 Sep 2021 09:20:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3A07461242; Mon, 13 Sep 2021 13:19:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631539142; bh=X8xv6IhDmCpAV7VXVZkOxAjGP99z74IVeoo0V7Z/c4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kyDiVMfplM+huBEwD5Gz+t7NEZTlXDQixdBZ8jShbeWuMTTV1zRPp5btB9EBQ2QwM j7JiHamYQw+BuYlYhiBGXzf0va+twpvEOrvBwIWPAQYMsru1qw5y4k7dxdU8KQ73Yq ySuWf/vWT5VpKrhR/DXw5aXWDIpXdKcAzeddH93Mh2LG1fdaDanYs6GASB9F/M4ToL 0W+HNlUpi2V7OwNrsk+U1Fsd0uTVxT2rzkfalylSR43DI9866ZKuXl1HtyO5ieYz0l dnaPHhh5BquFQVlWO3XkSdMS8PxZ/oUv2FD0vjBKiP8+EjPuxzeGb94XSoSLA/a3ST w4h6/7FVTYBSQ== From: Mark Brown To: Catalin Marinas , Will Deacon , Shuah Khan , Shuah Khan Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown Subject: [PATCH v1 6/8] selftests: arm64: Verify interoperation of SVE and FPSIMD register sets Date: Mon, 13 Sep 2021 13:55:03 +0100 Message-Id: <20210913125505.52619-7-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210913125505.52619-1-broonie@kernel.org> References: <20210913125505.52619-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2060; h=from:subject; bh=X8xv6IhDmCpAV7VXVZkOxAjGP99z74IVeoo0V7Z/c4g=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBhP0on4TOj9LdR5rFhDpLxeddoMFb9MuRaFRBSTZIZ Ck4OLe2JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYT9KJwAKCRAk1otyXVSH0NEOB/ 9+M2GNcWCemczC/iZISUMtVAYSzRtNnOoqzXXznP1P2vTa2ZiXQDfPJQWAKVlnicYwSHuIpwQPv7Te 1pe+K15xcfaMXehSoJ0ri9SppRS/w7tIqLMI5qObFsccXDtJHEHnwg5x7DStbclIDBLVsveSHFn+EV UU2CovngjVOxtU5jNBVc/3uazsoJSV0OZvWPKuHVH6T2VgFgB+EYU1/ha0aUEfUKtAoZk+N7SN7M3A 5qMtJI07OrVkIYheNPR3miA5GVUhFES31TNuc6gNvgfChJc8JititdjpaLUOxKnM8xu4GznjwwC2HE VYo4rHsfITeNwdEmG91fQOmjbUv0UO X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org After setting the FPSIMD registers via the SVE register set read them back via the FPSIMD register set, validating that the two register sets are interoperating and that the values we thought we set made it into the child process. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/fp/sve-ptrace.c | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/arm64/fp/sve-ptrace.c b/tools/testing/selftests/arm64/fp/sve-ptrace.c index 2d130fedc019..31a2c2fc529d 100644 --- a/tools/testing/selftests/arm64/fp/sve-ptrace.c +++ b/tools/testing/selftests/arm64/fp/sve-ptrace.c @@ -46,6 +46,15 @@ static int do_child(void) return EXIT_SUCCESS; } +static int get_fpsimd(pid_t pid, struct user_fpsimd_state *fpsimd) +{ + struct iovec iov; + + iov.iov_base = fpsimd; + iov.iov_len = sizeof(*fpsimd); + return ptrace(PTRACE_GETREGSET, pid, NT_PRFPREG, &iov); +} + static struct user_sve_header *get_sve(pid_t pid, void **buf, size_t *size) { struct user_sve_header *sve; @@ -122,7 +131,7 @@ static int do_parent(pid_t child) void *svebuf = NULL, *newsvebuf; size_t svebufsz = 0, newsvebufsz; struct user_sve_header *sve, *new_sve; - struct user_fpsimd_state *fpsimd; + struct user_fpsimd_state *fpsimd, new_fpsimd; unsigned int i, j; unsigned char *p; unsigned int vq; @@ -221,7 +230,22 @@ static int do_parent(pid_t child) goto error; } - /* Zero the first SVE Z register */ + /* Verify via the FPSIMD regset */ + if (get_fpsimd(pid, &new_fpsimd)) { + int e = errno; + + ksft_test_result_fail("get_fpsimd(): %s\n", + strerror(errno)); + if (e == ESRCH) + goto disappeared; + + goto error; + } + if (memcmp(fpsimd, &new_fpsimd, sizeof(*fpsimd)) == 0) + ksft_test_result_pass("get_fpsimd() gave same state\n"); + else + ksft_test_result_fail("get_fpsimd() gave different state\n"); + vq = sve_vq_from_vl(sve->vl); newsvebufsz = SVE_PT_SVE_ZREG_OFFSET(vq, 1); -- 2.20.1 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 X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F3F3C433F5 for ; Mon, 13 Sep 2021 13:24:20 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 665756135D for ; Mon, 13 Sep 2021 13:24:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 665756135D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=M1wOdLk+AQyVO/zvLQZOBa11shWDIB1TkFbxUFYW/FU=; b=sdKPcZwayxjTjh N4FgA+8OU8EobXEAssLgUmfNu/1qxMYipklPehjul4IIVxK5MLvYsUQrW62O1lYMAUoHKlnV9/67J Lhb5Wu8JrTWL0LdCol0bEYxr37mjnp6uEEkY+mZ6hYuLAi1Vse5HCjQpH0ge3JuXiBcvi0MEFHK9C pJCGJ1Lyhbar0P4+V1Yx0nlbo3gyqyxCgRbo5dE4PN0yUwQ9swe9SwHIvYL22h/Tp/XidMhCb6Mjc olnRQt5yEND2JI+8lnt6uTKSPM6dIiHSIiB7F6UfKvrGFlJHfa+ELTB6nx2wGKY2q5okrdLJR4/Mh 1EkNlc8KE6lkDUkdEKTA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mPlul-001mZf-IX; Mon, 13 Sep 2021 13:22:28 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mPlrT-001kzR-59 for linux-arm-kernel@lists.infradead.org; Mon, 13 Sep 2021 13:19:05 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3A07461242; Mon, 13 Sep 2021 13:19:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631539142; bh=X8xv6IhDmCpAV7VXVZkOxAjGP99z74IVeoo0V7Z/c4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kyDiVMfplM+huBEwD5Gz+t7NEZTlXDQixdBZ8jShbeWuMTTV1zRPp5btB9EBQ2QwM j7JiHamYQw+BuYlYhiBGXzf0va+twpvEOrvBwIWPAQYMsru1qw5y4k7dxdU8KQ73Yq ySuWf/vWT5VpKrhR/DXw5aXWDIpXdKcAzeddH93Mh2LG1fdaDanYs6GASB9F/M4ToL 0W+HNlUpi2V7OwNrsk+U1Fsd0uTVxT2rzkfalylSR43DI9866ZKuXl1HtyO5ieYz0l dnaPHhh5BquFQVlWO3XkSdMS8PxZ/oUv2FD0vjBKiP8+EjPuxzeGb94XSoSLA/a3ST w4h6/7FVTYBSQ== From: Mark Brown To: Catalin Marinas , Will Deacon , Shuah Khan , Shuah Khan Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown Subject: [PATCH v1 6/8] selftests: arm64: Verify interoperation of SVE and FPSIMD register sets Date: Mon, 13 Sep 2021 13:55:03 +0100 Message-Id: <20210913125505.52619-7-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210913125505.52619-1-broonie@kernel.org> References: <20210913125505.52619-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2060; h=from:subject; bh=X8xv6IhDmCpAV7VXVZkOxAjGP99z74IVeoo0V7Z/c4g=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBhP0on4TOj9LdR5rFhDpLxeddoMFb9MuRaFRBSTZIZ Ck4OLe2JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYT9KJwAKCRAk1otyXVSH0NEOB/ 9+M2GNcWCemczC/iZISUMtVAYSzRtNnOoqzXXznP1P2vTa2ZiXQDfPJQWAKVlnicYwSHuIpwQPv7Te 1pe+K15xcfaMXehSoJ0ri9SppRS/w7tIqLMI5qObFsccXDtJHEHnwg5x7DStbclIDBLVsveSHFn+EV UU2CovngjVOxtU5jNBVc/3uazsoJSV0OZvWPKuHVH6T2VgFgB+EYU1/ha0aUEfUKtAoZk+N7SN7M3A 5qMtJI07OrVkIYheNPR3miA5GVUhFES31TNuc6gNvgfChJc8JititdjpaLUOxKnM8xu4GznjwwC2HE VYo4rHsfITeNwdEmG91fQOmjbUv0UO X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210913_061903_344155_E853D1B5 X-CRM114-Status: GOOD ( 14.28 ) 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 After setting the FPSIMD registers via the SVE register set read them back via the FPSIMD register set, validating that the two register sets are interoperating and that the values we thought we set made it into the child process. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/fp/sve-ptrace.c | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/arm64/fp/sve-ptrace.c b/tools/testing/selftests/arm64/fp/sve-ptrace.c index 2d130fedc019..31a2c2fc529d 100644 --- a/tools/testing/selftests/arm64/fp/sve-ptrace.c +++ b/tools/testing/selftests/arm64/fp/sve-ptrace.c @@ -46,6 +46,15 @@ static int do_child(void) return EXIT_SUCCESS; } +static int get_fpsimd(pid_t pid, struct user_fpsimd_state *fpsimd) +{ + struct iovec iov; + + iov.iov_base = fpsimd; + iov.iov_len = sizeof(*fpsimd); + return ptrace(PTRACE_GETREGSET, pid, NT_PRFPREG, &iov); +} + static struct user_sve_header *get_sve(pid_t pid, void **buf, size_t *size) { struct user_sve_header *sve; @@ -122,7 +131,7 @@ static int do_parent(pid_t child) void *svebuf = NULL, *newsvebuf; size_t svebufsz = 0, newsvebufsz; struct user_sve_header *sve, *new_sve; - struct user_fpsimd_state *fpsimd; + struct user_fpsimd_state *fpsimd, new_fpsimd; unsigned int i, j; unsigned char *p; unsigned int vq; @@ -221,7 +230,22 @@ static int do_parent(pid_t child) goto error; } - /* Zero the first SVE Z register */ + /* Verify via the FPSIMD regset */ + if (get_fpsimd(pid, &new_fpsimd)) { + int e = errno; + + ksft_test_result_fail("get_fpsimd(): %s\n", + strerror(errno)); + if (e == ESRCH) + goto disappeared; + + goto error; + } + if (memcmp(fpsimd, &new_fpsimd, sizeof(*fpsimd)) == 0) + ksft_test_result_pass("get_fpsimd() gave same state\n"); + else + ksft_test_result_fail("get_fpsimd() gave different state\n"); + vq = sve_vq_from_vl(sve->vl); newsvebufsz = SVE_PT_SVE_ZREG_OFFSET(vq, 1); -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel