From patchwork Mon Apr 8 17:49:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786951 Delivered-To: patch@linaro.org Received: by 2002:adf:fb4d:0:b0:346:15ad:a2a with SMTP id c13csp2203wrs; Mon, 8 Apr 2024 10:56:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUxGpFfZ4SvvJGXz273/dx5QHkY/CQquUY6plc5WolfxStFtk7YWN/FFFVncFQfCpRX6uqQrdn6pPn/v9IIzXWd X-Google-Smtp-Source: AGHT+IE3Jrbqv5Q/ywf7YvS7g3SsarkoEvotq3ZyQ72SSSmQcLMIoaCWr+AkfLZXPwwUjNEL5iYj X-Received: by 2002:a05:6214:c63:b0:69b:1c78:1590 with SMTP id t3-20020a0562140c6300b0069b1c781590mr3513077qvj.43.1712599012648; Mon, 08 Apr 2024 10:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712599012; cv=none; d=google.com; s=arc-20160816; b=DL8NS8THVNaz+grUa98C9EWMuU52B9r3+cXeyxh26BZbjAAaG8RgSycNd1GH/zwWls LbacB0b+rOerx0e4ap0/co29Zfh570SzZMs1jS6eOmlKN9ZPkrT8+rnmzkDbzeGX4HPv TIe/n5lAwl86C51MHTdg2Cp4fcMPMpqS0Np39oKxwm4ir4B4dh/rqWAlVU7+cATBarOb Nlyfhe+fFToE0/48ZJSVrlJ2xdKYxsjKIqUnpvT4y+F8jy2b/KPtkG/VPu1ltHZvwgT9 UbFglL+PN7iuj0aBYuua/R5S8kmrNLnmhjTtRsTWwy2hIUrWgtJmYiLABEZ4YWpPsy0/ WNCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=bh4lWnPe+YOgpHGdevl5r/TyXWqM+m5cBerY0p6p+5U=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=n5ZMqiCYVyDdkfighjGc8JAKxsWbyI6sth4bBJD081TaUF/CctzlD1KXm3pJFRuPjN 4JBnwQTSzB1/bk3CcTysaGwwxMBtztSP7QYFZ7Ga+ngBOJkpSXMvY2d4sX4fZo7QiATj BUCQwt6GwO20iIvHcoIu11oKRvTJHJhaRTq66/N9FLFpNoGRarm/2fFmPfw6d9wvL00D 6CyodTZDmyi0r2MHSofMTlF01E3zRjCtbeDnN5RZr75VJErxJnDhqwUAl2N8vAjMvoZe aFkOBZ+ABQ1G7ZwejY82JjrpWYWJ24GYWnxac4qkQ7AagPIASLojYNKbKjFXWxbNOYjV 1Xlg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z840WH6h; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id dm7-20020ad44e27000000b0069b19c7ec13si2996531qvb.100.2024.04.08.10.56.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 08 Apr 2024 10:56:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z840WH6h; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtt8X-0002B8-AV; Mon, 08 Apr 2024 13:50:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rtt8T-0002AQ-5K for qemu-devel@nongnu.org; Mon, 08 Apr 2024 13:50:25 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rtt8R-0003ov-Is for qemu-devel@nongnu.org; Mon, 08 Apr 2024 13:50:24 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6ed3cafd766so874090b3a.0 for ; Mon, 08 Apr 2024 10:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712598622; x=1713203422; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=bh4lWnPe+YOgpHGdevl5r/TyXWqM+m5cBerY0p6p+5U=; b=Z840WH6h/v144lDoCxL9vxqP1V8DWb9SZlhSjPEoY7CzLXAKCVcL4Xch+kCsSjXHO3 jsQDNQ0QZnw2AEEiLVAYBliIBLW+bq3P40/E/XwOXXEjuobuwLi34NgjOAPLW+hVdNpn OPAndHgJfzgWDRO+PY97O6dACSmaTIJBTqS4cdZpJ8nFCmidmqvnXE6o6zUY892ce/bg Lusbk2kNfKG9FCgOA+hJ97HEflcL7s/DizJZqjpFXNfAVDvLfNGLG3PHdmZnN3muq4Ex vDodPXGMT9r4OD2l4iGMzk/ketqxUp+kaugvBhKa54SwzSnNrmUoeyJ/JpVWZ2ONv4uH OWLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712598622; x=1713203422; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bh4lWnPe+YOgpHGdevl5r/TyXWqM+m5cBerY0p6p+5U=; b=GiTqvTLehqLnYO/+co1OE3Ux5YeORfsTN1lLXUpULM9w2Y5Ay0z+jflXwwyYwPfCaX ANmPEcUXG+dg5LUnfTDQHlyTGSTGwPYEVyUO1M2ubA6hH8eQ0SQUTZatt4u3Up/B7rxw YoMWM3ObzylOTjmUgQmKdBKKAlXvnA9RknjPILS31nyFBGXjlozjwhr+o7h7ytwu2LI3 k2P6qVFjcaEJCn/jcQ/9EktouOkF9IfIcVNMx1mTQlG7MhlpDwOrwWP5cE41MnuZn6o9 qXRixfSaljeWOIN6dPkJ/096ekP8YjOsHZFifuK8i7oY5C+dyZmmrSmyXW0xj0gJOIMk mkyA== X-Gm-Message-State: AOJu0Yy1KQz7AC26kiFTqUw3KyK4EwFmNqFYNP/KVQd2ZftqnXiI9MfD FrmVtfbExnfAm0bBCQI6EDPfZ5dG62siOTpH4RKsDU8qtDDWYshCF3yuBz9TAZ4+wxpDtnOSWUP A X-Received: by 2002:a05:6a21:32a0:b0:1a5:6bfb:76de with SMTP id yt32-20020a056a2132a000b001a56bfb76demr9501508pzb.2.1712598622246; Mon, 08 Apr 2024 10:50:22 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id ga15-20020a17090b038f00b0029c3bac0aa8sm8658432pjb.4.2024.04.08.10.50.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 10:50:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 34/35] util/bufferiszero: Introduce biz_accel_fn typedef Date: Mon, 8 Apr 2024 07:49:28 -1000 Message-Id: <20240408174929.862917-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240408174929.862917-1-richard.henderson@linaro.org> References: <20240408174929.862917-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson --- util/bufferiszero.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/util/bufferiszero.c b/util/bufferiszero.c index c9a7ded016..eb8030a3f0 100644 --- a/util/bufferiszero.c +++ b/util/bufferiszero.c @@ -26,7 +26,8 @@ #include "qemu/bswap.h" #include "host/cpuinfo.h" -static bool (*buffer_is_zero_accel)(const void *, size_t); +typedef bool (*biz_accel_fn)(const void *, size_t); +static biz_accel_fn buffer_is_zero_accel; static bool buffer_is_zero_int_lt256(const void *buf, size_t len) { @@ -178,13 +179,15 @@ buffer_zero_avx2(const void *buf, size_t len) } #endif /* CONFIG_AVX2_OPT */ + + static unsigned __attribute__((noinline)) select_accel_cpuinfo(unsigned info) { /* Array is sorted in order of algorithm preference. */ static const struct { unsigned bit; - bool (*fn)(const void *, size_t); + biz_accel_fn fn; } all[] = { #ifdef CONFIG_AVX2_OPT { CPUINFO_AVX2, buffer_zero_avx2 }, @@ -231,7 +234,7 @@ bool test_buffer_is_zero_next_accel(void) #define INIT_ACCEL buffer_is_zero_int_ge256 #endif -static bool (*buffer_is_zero_accel)(const void *, size_t) = INIT_ACCEL; +static biz_accel_fn buffer_is_zero_accel = INIT_ACCEL; bool buffer_is_zero_ool(const void *buf, size_t len) {