1#!/bin/ksh -p 2# SPDX-License-Identifier: CDDL-1.0 3# 4# CDDL HEADER START 5# 6# The contents of this file are subject to the terms of the 7# Common Development and Distribution License (the "License"). 8# You may not use this file except in compliance with the License. 9# 10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11# or https://opensource.org/licenses/CDDL-1.0. 12# See the License for the specific language governing permissions 13# and limitations under the License. 14# 15# When distributing Covered Code, include this CDDL HEADER in each 16# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17# If applicable, add the following below this CDDL HEADER, with the 18# fields enclosed by brackets "[]" replaced with your own identifying 19# information: Portions Copyright [yyyy] [name of copyright owner] 20# 21# CDDL HEADER END 22# 23 24# 25# Copyright (c) 2022 by Attila Fülöp <attila@fueloep.org> 26# 27 28. $STF_SUITE/include/libtest.shlib 29 30# 31# DESCRIPTION: 32# Make sure we have SIMD support, so it will not go away without notice 33# 34# STRATEGY: 35# 1. Test if we are running on a Linux x86 system with SSE support 36# 2. If so, check if the zfs_fletcher_4_impl module parameter contains 37# a sse implementation 38# 3. If not fail the test, otherwise pass it 39 40log_note "Testing if we support SIMD instructions (Linux x86 only)" 41 42if ! is_linux; then 43 log_unsupported "Not a Linux System" 44fi 45 46case "$(uname -m)" in 47i?86|x86_64) 48 typeset -R modparam="/sys/module/zfs/parameters/zfs_fletcher_4_impl" 49 if awk '/^flags/ {exit !/sse/}' /proc/cpuinfo; then 50 log_must grep -q sse "$modparam" 51 log_pass "SIMD instructions supported" 52 else 53 log_unsupported "No FPU present" 54 fi 55 ;; 56*) 57 log_unsupported "Not a x86 CPU" 58 ;; 59esac 60