From patchwork Mon Sep 13 12:55:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 509729 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp548050jao; Mon, 13 Sep 2021 06:19:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxh7mTkyEAT3g2zZl/Hs6UPk57b5UDcGfiShMJLw/cvD78xrHLc5eUYwdNQxMpmq9MqNMZ X-Received: by 2002:a05:6e02:106:: with SMTP id t6mr243369ilm.185.1631539197791; Mon, 13 Sep 2021 06:19:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631539197; cv=none; d=google.com; s=arc-20160816; b=YTXmb4oOtCvXGKteciFqRmMnIumxuVc3+UH7xWFH243DR0HVT84SJAEIPubh52/Old mI9CH4J+jm4dhOput4NdpwFaBjhK0+cyUgyyZtwp8gG+96G0Pms43hgHg9IS9bk0Odj7 GHpKz8DvAjMbYNhkeZlUOOKU2rZ2omOHWGtWJ7civXbmmYjdA3iuwwmrlAD0uOXQROdo ALeG6aCTyovP0CfAkgaj1Cwi7lgbT4B/xU87iPBMBum9+cYriJX6Jpny98e0pdspJq3E kv7/+iav+4kgiQBIdatJAMA8EjdGVL7dbhqWp9zNgboFBK5QeMSYNnaQKhCcjMT+MnWe A1xg== 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=ADkt3yLt/6W06Y+LLHWl6sNnDvDLve/cTNnGmyIaSFQ=; b=xyxRxWQngu4NxpGvr0OyQylHvGidVTBdYhV4Gs5d0U6nTZkEt9clbBK+F2Xlk99ETy ChE/cAM3+gBPMl0QGyqagjBIUyPOyobcET4oPyFZmbTIGVUR6Q8vYxTZ81HYx7gCs3+F LzNYeLUKdW04kGdL+beRXrn+IqR48OO++W/+/fyrhoM49dnTkQelIDw10AL9xunLAoFu Kqn6khlORVuHLzBOVUFoIQIamC/rPP+6SfSfk1ioctFlXovTonp3tS0C9m9F8bWTYRTj Ans4HVDhlXc8xM5pKVThNxEuxxWr7RHfZgT1lB5wbmSDgHMpxbORPRTyXAY2ayhyQOSi orZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IFbjj6TV; 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 t10si6489823jaa.114.2021.09.13.06.19.57; Mon, 13 Sep 2021 06:19:57 -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=IFbjj6TV; 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 S240233AbhIMNVL (ORCPT + 5 others); Mon, 13 Sep 2021 09:21:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:34854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240399AbhIMNUd (ORCPT ); Mon, 13 Sep 2021 09:20:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3673361216; Mon, 13 Sep 2021 13:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631539137; bh=3RGlMrOqTC9QZNG8f5YOa/s+hJ+c18k3VekrOVRUQEA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IFbjj6TVfED9S9hFdrABRBiPHgjsJy9Vn6kn4XrpXDQhQL/zOLEFomg3Vr+wNZrk5 4Y0rdZXrWWtYMGG2zhmyZoCF0Ulztir+NcpKpO7Bs40ht5pmFygtQfKVEvfQBnCjJZ NTYqZKDOxUhBaTF9zFXluRuD+uU3t9xMAY8vv383K1tw+q0AtZkN+0mEvxZLQw5WVN /zp8KezwAdNv8Jr1e49Vt09sBVtWK0aO6N9Iez0BnHx5QBfgQGU4Q9Bzbpe7hCwBfz v6RbGAWGrfbBoaXrMcQY89vDFaQP58r3VEXniFhGvXBk/WjB1Y/S96PDsrLXMpl0B+ D8osld9OQ9hmQ== 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 4/8] selftests: arm64: Document what the SVE ptrace test is doing Date: Mon, 13 Sep 2021 13:55:01 +0100 Message-Id: <20210913125505.52619-5-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=2330; h=from:subject; bh=3RGlMrOqTC9QZNG8f5YOa/s+hJ+c18k3VekrOVRUQEA=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBhP0ol6DkHVUICf8Th6pUk6tfsdEP8uH4OL+9Tu5lU 0FceRhqJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYT9KJQAKCRAk1otyXVSH0LgVB/ 9A/aC9RnVqvaN747YpyJsNIdYQ3o0Uhr6aQXDK3BRYACofl6l4MCga6Kc86rrtUPyHGBxQ29d7+jAj Rr2PYf4nYn3IZ6qPXZD9ZlXNuSOll4ilpEzlDpoxN6+nVTQUQovU9lBYuXULo6bQrLXT3FT2psB1Su mxR/vMqcUaEy6Kx+E7vaKigrZPnR1OpML7/OIpTzP6dAh9FDgqLDaqIdgbcArzNBaJHufAfG525N9i ls6l8tjS6WvKSXh+YrAEdy6BbCkoteGxDnFhag1mT9DRQGsXUfJUkxzNjUvSgp6J56iUgMYCl8v5iY fcfJDtASr41L/eJhnKIyGWQnIrlOFt X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Before we go modifying it further let's add some comments and output clarifications explaining what this test is actually doing. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/fp/sve-ptrace.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) -- 2.20.1 diff --git a/tools/testing/selftests/arm64/fp/sve-ptrace.c b/tools/testing/selftests/arm64/fp/sve-ptrace.c index d2ec48f649f9..fc4a672825eb 100644 --- a/tools/testing/selftests/arm64/fp/sve-ptrace.c +++ b/tools/testing/selftests/arm64/fp/sve-ptrace.c @@ -181,6 +181,7 @@ static int do_parent(pid_t child) } } + /* New process should start with FPSIMD registers only */ sve = get_sve(pid, &svebuf, &svebufsz); if (!sve) { int e = errno; @@ -191,14 +192,15 @@ static int do_parent(pid_t child) goto error; } else { - ksft_test_result_pass("get_sve\n"); + ksft_test_result_pass("get_sve(FPSIMD)\n"); } ksft_test_result((sve->flags & SVE_PT_REGS_MASK) == SVE_PT_REGS_FPSIMD, - "FPSIMD registers\n"); + "Set FPSIMD registers\n"); if ((sve->flags & SVE_PT_REGS_MASK) != SVE_PT_REGS_FPSIMD) goto error; + /* Try to set a known FPSIMD state via PT_REGS_SVE */ fpsimd = (struct user_fpsimd_state *)((char *)sve + SVE_PT_FPSIMD_OFFSET); for (i = 0; i < 32; ++i) { @@ -219,6 +221,7 @@ static int do_parent(pid_t child) goto error; } + /* Zero the first SVE Z register */ vq = sve_vq_from_vl(sve->vl); newsvebufsz = SVE_PT_SVE_ZREG_OFFSET(vq, 1); @@ -245,6 +248,7 @@ static int do_parent(pid_t child) goto error; } + /* Try to read back the value we just set */ new_sve = get_sve(pid, &newsvebuf, &newsvebufsz); if (!new_sve) { int e = errno; @@ -257,12 +261,13 @@ static int do_parent(pid_t child) } ksft_test_result((new_sve->flags & SVE_PT_REGS_MASK) == SVE_PT_REGS_SVE, - "SVE registers\n"); + "Get SVE registers\n"); if ((new_sve->flags & SVE_PT_REGS_MASK) != SVE_PT_REGS_SVE) goto error; dump_sve_regs(new_sve, 3, sizeof fpsimd->vregs[0]); + /* Verify that the register we set has the value we expected */ p = (unsigned char *)new_sve + SVE_PT_SVE_ZREG_OFFSET(vq, 1); for (i = 0; i < sizeof fpsimd->vregs[0]; ++i) { unsigned char expected = i;