Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5935348rwr; Tue, 9 May 2023 08:08:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6YFz7MFmWtrt0lh4qSCdaqnKKH1rzmHVM3aBDlXYgJqmYBZPhRj3lDmjcvTyjeNHGp22K9 X-Received: by 2002:a05:6a20:1615:b0:101:537e:c0ad with SMTP id l21-20020a056a20161500b00101537ec0admr2906501pzj.24.1683644896500; Tue, 09 May 2023 08:08:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683644896; cv=none; d=google.com; s=arc-20160816; b=y3h8mbez9h4FYE/h/KDxyUR4YpJnsKOw+RC/bKZkki1HMqVyoDrcMMI3E0PxHQ53Vt LbsjVzmzyAKqrNngIguf53u55DLMXGL/Mzfy1YAsuVAXDG3w2FfZudF4mIg7SEMj5NA2 LkQc/Vb8POPp8k8yqcm0X1LLKOVQylb1g71a75MZgmm68/lmpZ+wMYxlQHprD2KGkBFf 4QhQo5KXb7I51ambBCl7u1Kt8tcUGr79RqSmnBPsaSPhpoeF0XS9iK909Ob7tneMUdw9 tgNBMQjezHqojCBYGpDn+uVCAku7b1iuJVEZI8XTvf7VoZcyeFgeRHnI9DeMPVGpsCtd gCXQ== 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; bh=Agpmob5Y7e8ZYv6rQ/XJFKPxHYItv5mgYbl7q6BWQYY=; b=xD6iaQjzl2GRtCTMeNhwfPeNm2GSxirEdsIJjV4J+YsvgloefuzDGUtqTKAqeY83zt GumO4hsTOJaSA/Vuf+U0ALdlCgRkwowzE8KmZvxdqB3domlXuHF8Y6NutEdMHHl8AJHe ZW2PecfCDRdy8Hk+LnfqMunn4pD085lsZ3O0eBxNo5DdOSfDdAIIe82lxt1mU9+P8Lqk 50NvP9wxWiuzHdyFiasdx93v6+NSvIIjBRwK6R6Hop7Afv9qiVVbueKzZd0oSugLDxcU Y2tzCFCLspQJy+9T8ITI91j4SUAR+Yltn2wd4mBAX2oqpiT3afJf5o2JLDISXo19DdLE pdnA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e20-20020a633714000000b0050f818e900dsi1630158pga.761.2023.05.09.08.07.59; Tue, 09 May 2023 08:08:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235915AbjEIOYg (ORCPT + 99 others); Tue, 9 May 2023 10:24:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235922AbjEIOYb (ORCPT ); Tue, 9 May 2023 10:24:31 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B4F77559B for ; Tue, 9 May 2023 07:24:03 -0700 (PDT) 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 ADD6E1596; Tue, 9 May 2023 07:24:33 -0700 (PDT) Received: from e126864.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2A1123F663; Tue, 9 May 2023 07:23:46 -0700 (PDT) From: Kristina Martsenko To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev Cc: Catalin Marinas , Will Deacon , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Mark Rutland , Mark Brown , Luis Machado , Vladimir Murzin , linux-kernel@vger.kernel.org Subject: [PATCH v2 11/11] kselftest/arm64: add MOPS to hwcap test Date: Tue, 9 May 2023 15:22:35 +0100 Message-Id: <20230509142235.3284028-12-kristina.martsenko@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230509142235.3284028-1-kristina.martsenko@arm.com> References: <20230509142235.3284028-1-kristina.martsenko@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the MOPS hwcap to the hwcap kselftest and check that a SIGILL is not generated when the feature is detected. A SIGILL is reliable when the feature is not detected as SCTLR_EL1.MSCEn won't have been set. Signed-off-by: Kristina Martsenko --- tools/testing/selftests/arm64/abi/hwcap.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tools/testing/selftests/arm64/abi/hwcap.c b/tools/testing/selftests/arm64/abi/hwcap.c index 93333a90bf3a..d4ad813fed10 100644 --- a/tools/testing/selftests/arm64/abi/hwcap.c +++ b/tools/testing/selftests/arm64/abi/hwcap.c @@ -39,6 +39,20 @@ static void cssc_sigill(void) asm volatile(".inst 0xdac01c00" : : : "x0"); } +static void mops_sigill(void) +{ + char dst[1], src[1]; + register char *dstp asm ("x0") = dst; + register char *srcp asm ("x1") = src; + register long size asm ("x2") = 1; + + /* CPYP [x0]!, [x1]!, x2! */ + asm volatile(".inst 0x1d010440" + : "+r" (dstp), "+r" (srcp), "+r" (size) + : + : "cc", "memory"); +} + static void rng_sigill(void) { asm volatile("mrs x0, S3_3_C2_C4_0" : : : "x0"); @@ -209,6 +223,14 @@ static const struct hwcap_data { .cpuinfo = "cssc", .sigill_fn = cssc_sigill, }, + { + .name = "MOPS", + .at_hwcap = AT_HWCAP2, + .hwcap_bit = HWCAP2_MOPS, + .cpuinfo = "mops", + .sigill_fn = mops_sigill, + .sigill_reliable = true, + }, { .name = "RNG", .at_hwcap = AT_HWCAP2, -- 2.25.1