From nobody Mon Jun 22 13:25:48 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E529C433FE for ; Wed, 23 Mar 2022 23:31:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345519AbiCWXdT (ORCPT ); Wed, 23 Mar 2022 19:33:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241475AbiCWXdQ (ORCPT ); Wed, 23 Mar 2022 19:33:16 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A82E90CCF; Wed, 23 Mar 2022 16:31:44 -0700 (PDT) Date: Wed, 23 Mar 2022 23:31:39 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1648078301; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mb8sRc00s7UweUwt1QoAi01Vq/4TD9UyM7gruvNKweM=; b=vJVxTFd/yzIq5owV6d84fhzjPurzls/0HhmMnQea4UKo0RGCd+eBMuH7rtiqlsSCLpD9yb wjn5G1PXtHbrAZwQX4u/kcCs8kMUOVR5fn1toPArSuiTAKnhc8fZeCusdGeG+Zwpm0KEBC JnkD33kadwecDmgDoha03Q5jIy8QGnF0MAleg6N38NEF/7lmlihpELjpGivCpso56hB8FL CjFSe0HAoPxGAt4P87FTEy1jatmuJF1QEeOaWD0BEIkr+8y6VQC2Gm+jfDm3pgYGmjO80j Z6frWd/mDnhycQF2o1XW0B7RCf/+ei6r4bGDOKoNktTOCK5vZIn+rYdmEqu3DQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1648078301; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mb8sRc00s7UweUwt1QoAi01Vq/4TD9UyM7gruvNKweM=; b=UPr8IfNb1iIeO07lu8i7bbz16cYABb/3nzRpIMdEgrAlhVhEnP+vwNBAzS1d1iDtYU0O1v CZB4WUhq4b5TCOAw== From: "tip-bot2 for Chang S. Bae" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] selftests/x86/amx: Update the ARCH_REQ_XCOMP_PERM test Cc: "Chang S. Bae" , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220129173647.27981-3-chang.seok.bae@intel.com> References: <20220129173647.27981-3-chang.seok.bae@intel.com> MIME-Version: 1.0 Message-ID: <164807829910.389.4784020527797489400.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 20df737561484cb2d42e537663c03a7311d2b3c1 Gitweb: https://git.kernel.org/tip/20df737561484cb2d42e537663c03a731= 1d2b3c1 Author: Chang S. Bae AuthorDate: Sat, 29 Jan 2022 09:36:47 -08:00 Committer: Thomas Gleixner CommitterDate: Wed, 23 Mar 2022 21:28:34 +01:00 selftests/x86/amx: Update the ARCH_REQ_XCOMP_PERM test Update the arch_prctl test to check the permission bitmap whether the requested feature is added as expected or not. Every non-dynamic feature that is enabled is permitted already for use. TILECFG is not dynamic feature. Ensure the bit is always on from ARCH_GET_XCOMP_PERM. Signed-off-by: Chang S. Bae Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20220129173647.27981-3-chang.seok.bae@intel= .com --- tools/testing/selftests/x86/amx.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/x86/amx.c b/tools/testing/selftests/x8= 6/amx.c index 3615ef4..2189f03 100644 --- a/tools/testing/selftests/x86/amx.c +++ b/tools/testing/selftests/x86/amx.c @@ -368,9 +368,16 @@ static void req_xtiledata_perm(void) =20 static void validate_req_xcomp_perm(enum expected_result exp) { - unsigned long bitmask; + unsigned long bitmask, expected_bitmask; long rc; =20 + rc =3D syscall(SYS_arch_prctl, ARCH_GET_XCOMP_PERM, &bitmask); + if (rc) { + fatal_error("prctl(ARCH_GET_XCOMP_PERM) error: %ld", rc); + } else if (!(bitmask & XFEATURE_MASK_XTILECFG)) { + fatal_error("ARCH_GET_XCOMP_PERM returns XFEATURE_XTILECFG off."); + } + rc =3D syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_PERM, XFEATURE_XTILEDATA); if (exp =3D=3D FAIL_EXPECTED) { if (rc) { @@ -383,10 +390,15 @@ static void validate_req_xcomp_perm(enum expected_res= ult exp) fatal_error("ARCH_REQ_XCOMP_PERM saw unexpected failure.\n"); } =20 + expected_bitmask =3D bitmask | XFEATURE_MASK_XTILEDATA; + rc =3D syscall(SYS_arch_prctl, ARCH_GET_XCOMP_PERM, &bitmask); if (rc) { fatal_error("prctl(ARCH_GET_XCOMP_PERM) error: %ld", rc); - } else if (bitmask & XFEATURE_MASK_XTILE) { + } else if (bitmask !=3D expected_bitmask) { + fatal_error("ARCH_REQ_XCOMP_PERM set a wrong bitmask: %lx, expected: %lx= .\n", + bitmask, expected_bitmask); + } else { printf("\tARCH_REQ_XCOMP_PERM is successful.\n"); } }