From patchwork Tue Oct 3 12:45:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 13407615 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 9650BE75458 for ; Tue, 3 Oct 2023 12:46:22 +0000 (UTC) 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=SZwkyoQjI2XDaxRX6O2MK6pq3hFI0hcPczhf50FRBxE=; b=R0STmic42dm7FH pKHqFCvS2NxL4Ze3MpjNa++T2/n6y+oePaXgEW5y+EnLtJhnvY9S5D3fPCAG7+arf5ayK7CBw158W lLaMOFFjxw/qPzH3BMRkeJFGGgFX6Ai1UNSoeVy4i4K0plRL2faF5MzFyYbBdthT3LWxp6STQCdQe 7+neTPUpvLBMmNVWwzEdQlhTy5QLbRxjz9kGhnWJOes3Yf6+DKtL+AH+xEVs5d1V3Np8vGLbIGkvy sHmfU0XOQ1yiM/e7ibzCL3325WTvyUDwJ/7d+YQNpq2j+rre4FynODweTsDzc3Hp/UQqxrLnj56dS UFWO++qXytEDtmtnQSfg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qneml-00Edj9-1U; Tue, 03 Oct 2023 12:45:59 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qnemi-00Edhh-1y for linux-arm-kernel@lists.infradead.org; Tue, 03 Oct 2023 12:45:57 +0000 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 51B951042; Tue, 3 Oct 2023 05:46:31 -0700 (PDT) Received: from e124191.cambridge.arm.com (e124191.cambridge.arm.com [10.1.197.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2AB443F59C; Tue, 3 Oct 2023 05:45:52 -0700 (PDT) From: Joey Gouly To: linux-arm-kernel@lists.infradead.org Cc: catalin.marinas@arm.com, joey.gouly@arm.com, will@kernel.org Subject: [PATCH v1 2/2] kselftest/arm64: add FEAT_LSE128 to hwcap test Date: Tue, 3 Oct 2023 13:45:44 +0100 Message-Id: <20231003124544.858804-3-joey.gouly@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231003124544.858804-1-joey.gouly@arm.com> References: <20231003124544.858804-1-joey.gouly@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231003_054556_718366_AE708B4B X-CRM114-Status: GOOD ( 10.67 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add test of a 128-bit atomic instruction for FEAT_LSE128. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- tools/testing/selftests/arm64/abi/hwcap.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tools/testing/selftests/arm64/abi/hwcap.c b/tools/testing/selftests/arm64/abi/hwcap.c index e3d262831d91..dd9a1cdfd294 100644 --- a/tools/testing/selftests/arm64/abi/hwcap.c +++ b/tools/testing/selftests/arm64/abi/hwcap.c @@ -46,6 +46,20 @@ static void atomics_sigill(void) asm volatile(".inst 0xb82003ff" : : : ); } +static void lse128_sigill(void) +{ + u64 __attribute__ ((aligned (16))) mem[2] = { 10, 20 }; + register u64 *memp asm ("x0") = mem; + register u64 val0 asm ("x1") = 5; + register u64 val1 asm ("x2") = 4; + + /* SWPP X1, X2, [X0] */ + asm volatile(".inst 0x19228001" + : "+r" (memp), "+r" (val0), "+r" (val1) + : + : "cc", "memory"); +} + static void crc32_sigill(void) { /* CRC32W W0, W0, W1 */ @@ -364,6 +378,13 @@ static const struct hwcap_data { .sigbus_fn = uscat_sigbus, .sigbus_reliable = true, }, + { + .name = "LSE128", + .at_hwcap = AT_HWCAP2, + .hwcap_bit = HWCAP2_LSE128, + .cpuinfo = "lse128", + .sigill_fn = lse128_sigill, + }, { .name = "MOPS", .at_hwcap = AT_HWCAP2,