From nobody Sat Oct 11 04:10:46 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9A7D12BD5A7; Wed, 11 Jun 2025 18:07:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749665277; cv=none; b=qQ9ieJ9no9pVLqKcNn1BsBnj0Gfj/uIeDNCkau/rP3BKYBHGWxeHaJfPkTRe3AsfpPfyOseH9hr1iGdwMbdd9EJF3jJ/2WKfWKCpOF7GZKT71DWeErfoBzmTe5Uo+u6q4E9r/Rf23MUyPxnEmGHH5ntVEqQuBr1GsslCKCQF4gU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749665277; c=relaxed/simple; bh=2dLXgiGlLIuWNytTHUgJmAIojt6o20xHkHiEsBOOFwo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CGpaJAeMnL/0+7UwYqp03fCzjsGQoUvI5rMPsxokt9SSspgJSEAcIkjHO8Vz8YkgZvdAcm/4FwWkUOv2v3DyjX5egOYpEGa3WFN/UQsqqn8nDkvGx8loPX4UkavXAVZkgdMvgxtZdxTkYctN3RX3VnrlCvhJ0+d7gHV0cibyyAQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 8F19E15A1; Wed, 11 Jun 2025 11:07:33 -0700 (PDT) Received: from e129823.cambridge.arm.com (e129823.arm.com [10.1.197.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 093643F673; Wed, 11 Jun 2025 11:07:50 -0700 (PDT) From: Yeoreum Yun To: catalin.marinas@arm.com, pcc@google.com, will@kernel.org, broonie@kernel.org, anshuman.khandual@arm.com, joey.gouly@arm.com, yury.khrustalev@arm.com, maz@kernel.org, oliver.upton@linux.dev, frederic@kernel.org, akpm@linux-foundation.org, surenb@google.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Yeoreum Yun Subject: [PATCH v8 5/9] kselftest/arm64/mte: check MTE_FAR feature is supported Date: Wed, 11 Jun 2025 19:07:30 +0100 Message-Id: <20250611180734.63657-6-yeoreum.yun@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250611180734.63657-1-yeoreum.yun@arm.com> References: <20250611180734.63657-1-yeoreum.yun@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" To run the MTE_FAR test when cpu supports MTE_FAR feature, check the MTE_FAR feature is supported in mte test. Signed-off-by: Yeoreum Yun Reviewed-by: Mark Brown --- tools/testing/selftests/arm64/mte/mte_common_util.c | 4 ++++ tools/testing/selftests/arm64/mte/mte_common_util.h | 1 + 2 files changed, 5 insertions(+) diff --git a/tools/testing/selftests/arm64/mte/mte_common_util.c b/tools/te= sting/selftests/arm64/mte/mte_common_util.c index 83240b980f9c..5c5680a87498 100644 --- a/tools/testing/selftests/arm64/mte/mte_common_util.c +++ b/tools/testing/selftests/arm64/mte/mte_common_util.c @@ -26,6 +26,7 @@ #define INIT_BUFFER_SIZE 256 =20 struct mte_fault_cxt cur_mte_cxt; +bool mtefar_support; static unsigned int mte_cur_mode; static unsigned int mte_cur_pstate_tco; =20 @@ -325,12 +326,15 @@ int mte_switch_mode(int mte_option, unsigned long inc= l_mask) int mte_default_setup(void) { unsigned long hwcaps2 =3D getauxval(AT_HWCAP2); + unsigned long hwcaps3 =3D getauxval(AT_HWCAP3); unsigned long en =3D 0; int ret; =20 if (!(hwcaps2 & HWCAP2_MTE)) ksft_exit_skip("MTE features unavailable\n"); =20 + mtefar_support =3D !!(hwcaps3 & HWCAP3_MTE_FAR); + /* Get current mte mode */ ret =3D prctl(PR_GET_TAGGED_ADDR_CTRL, en, 0, 0, 0); if (ret < 0) { diff --git a/tools/testing/selftests/arm64/mte/mte_common_util.h b/tools/te= sting/selftests/arm64/mte/mte_common_util.h index 6b109e84fa39..4e1dd959df9b 100644 --- a/tools/testing/selftests/arm64/mte/mte_common_util.h +++ b/tools/testing/selftests/arm64/mte/mte_common_util.h @@ -37,6 +37,7 @@ struct mte_fault_cxt { }; =20 extern struct mte_fault_cxt cur_mte_cxt; +extern bool mtefar_support; =20 /* MTE utility functions */ void mte_default_handler(int signum, siginfo_t *si, void *uc); --=20 LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}