Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2556386pxj; Mon, 10 May 2021 05:52:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7S/rtiBm/cVFZ53sZ9TQe6MZbnMJo7UugyZM2Fl+js9pkc9gb+Tlm9+kY+eutlYf9V/eG X-Received: by 2002:a17:907:6289:: with SMTP id nd9mr24862235ejc.384.1620651144333; Mon, 10 May 2021 05:52:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620651144; cv=none; d=google.com; s=arc-20160816; b=BhCFtrL33IQPwoENdAFexWJuHBCREnRlEoZ2cJZlXN6U27YZxrxuzaYRP8xuGn7A9d NWGOgkVbRHd8AxP1daPRgOko8z7YiXzrtbpcSt5PoI4hAnVbjZYleEsYDyWLxMz0mLDs mgUU+8dl+dBmDNsoZInx+K7gb0nTKwTSDcN2wu1aoz3FYzSspGTveaePB5rszrHGuQc7 9f1MZPYXrLFCeP9et5RPxpb9ldrpSFDHfULUvlkZfBmnIa7P9kOwmcuFFyxa5g5HHIht SIzJ9C0ziOCvNZPEK1I64qxpBG5+lqLkniynI92TJjGOSouIYxs7FJuFuUC6CbQhR6fX C2cw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lTdJLusb30HFOrf1SXivA2OuTlcdZmFip1+CGv7eVH8=; b=V3KuDyMn4VgdV3dqGKqsDr7l39515xXzK0I03Yz/k0efQNFNng6L9XlM6FtVX+mgAs rHtW++F/1u+mfr2e8D6+9ONraGkw+0zjYYnUVVbuVjnhsRJyStGuR3K6ob9l+isR6tMM STz2vYA2fWgsZz71bmcKfLr2nvliBZcVDvgSNbIvhmfZKy9ra66G9gx7zoWG8TzqGPIG 4ydusA8fm6iMgiThk4xnimguGKbwirQ7WS5TIJHCc27yuNXK+XiX4vVcslmuv4SStWEs eIr6p7QpbS5nDuYZhCLssBPUwSqXvarWHn3M9dQBx9UZa+5uwi2mletmX5wqIFyYRhbM 79ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rPlVhLvU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ml14si12548500ejb.661.2021.05.10.05.52.00; Mon, 10 May 2021 05:52:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=rPlVhLvU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349761AbhEJMuC (ORCPT + 99 others); Mon, 10 May 2021 08:50:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:44318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243618AbhEJL4m (ORCPT ); Mon, 10 May 2021 07:56:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 62A2B613C2; Mon, 10 May 2021 11:55:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620647737; bh=lvQXdb1uLea5kXdp+Ftv8+KRCK1dJmRCKA5861t8EtA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rPlVhLvUR3mglfL++OPH9ruZ09Oy6F8tPCtVs8M+zoLn0p4peaY79ft33JSOrp23l WIHAmJKOD7IkgAyd0I5ys9dg6dYHa83pdo/zhtrlQr343hiMA+KyP7W+sur/pYa4G/ DrJe8Y7a6haLYVPe7PS9ABDhLxwCJ6nZEC3tTuBI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andre Przywara , Mark Brown , Catalin Marinas , Sasha Levin Subject: [PATCH 5.10 070/299] kselftest/arm64: mte: Fix MTE feature detection Date: Mon, 10 May 2021 12:17:47 +0200 Message-Id: <20210510102007.224872728@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andre Przywara [ Upstream commit 592432862cc4019075a7196d9961562c49507d6f ] To check whether the CPU and kernel support the MTE features we want to test, we use an (emulated) CPU ID register read. However we only check against a very particular feature version (0b0010), even though the ARM ARM promises ID register features to be backwards compatible. While this could be fixed by using ">=" instead of "==", we should actually use the explicit HWCAP2_MTE hardware capability, exposed by the kernel via the ELF auxiliary vectors. That moves this responsibility to the kernel, and fixes running the tests on machines with FEAT_MTE3 capability. Signed-off-by: Andre Przywara Reviewed-by: Mark Brown Link: https://lore.kernel.org/r/20210319165334.29213-7-andre.przywara@arm.com Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin --- tools/testing/selftests/arm64/mte/mte_common_util.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/tools/testing/selftests/arm64/mte/mte_common_util.c b/tools/testing/selftests/arm64/mte/mte_common_util.c index 39f8908988ea..70665ba88cbb 100644 --- a/tools/testing/selftests/arm64/mte/mte_common_util.c +++ b/tools/testing/selftests/arm64/mte/mte_common_util.c @@ -278,22 +278,13 @@ int mte_switch_mode(int mte_option, unsigned long incl_mask) return 0; } -#define ID_AA64PFR1_MTE_SHIFT 8 -#define ID_AA64PFR1_MTE 2 - int mte_default_setup(void) { - unsigned long hwcaps = getauxval(AT_HWCAP); + unsigned long hwcaps2 = getauxval(AT_HWCAP2); unsigned long en = 0; int ret; - if (!(hwcaps & HWCAP_CPUID)) { - ksft_print_msg("FAIL: CPUID registers unavailable\n"); - return KSFT_FAIL; - } - /* Read ID_AA64PFR1_EL1 register */ - asm volatile("mrs %0, id_aa64pfr1_el1" : "=r"(hwcaps) : : "memory"); - if (((hwcaps >> ID_AA64PFR1_MTE_SHIFT) & MT_TAG_MASK) != ID_AA64PFR1_MTE) { + if (!(hwcaps2 & HWCAP2_MTE)) { ksft_print_msg("FAIL: MTE features unavailable\n"); return KSFT_SKIP; } -- 2.30.2