From patchwork Wed Apr 24 22:57:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791548 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1093287wrq; Wed, 24 Apr 2024 15:58:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVj+6SVVFyIFEsYIBzju9leImYDfL8YHmlOEDzjKSWdiKKv9UCPfZsejHmI8tXy6T6qP/3qhgFxTePq/0gS0j3c X-Google-Smtp-Source: AGHT+IEWmPr9BgGtVLa1+7meIo0zODLWTeZodJrVECg3XiI1gi53J13CDDUDHYTSLnYO3yyzdLfL X-Received: by 2002:a05:690c:7489:b0:615:4e88:c036 with SMTP id jv9-20020a05690c748900b006154e88c036mr4292918ywb.41.1713999520079; Wed, 24 Apr 2024 15:58:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713999520; cv=none; d=google.com; s=arc-20160816; b=iFa8CJGYlwhcLQTrREAGG0z5+bxw5oU2VEV7MSl7kHQJOhJjB9WPWd1OH4Mi2AA/xf KQx0oOk85fpqJKKaJfvul1mcyC8SnWfZe8WwZzyKl+iTonT9oJQpXmV34uA5AaNZglqG pGI1UZn+VVsnNqX/VP1vLcW8xPrDQH2SghlJi6Okrw0qUHp3T8CUyYjZV4TYXoGLLt02 lsc0Y8ZJ+rLXgQ1/9iO7cxQG+03Wowy1agDKvrz83xXM0p6ZrBf2JBmJb2Fme4OH2V2L +D/4KN3q2HViqgQejOxGo1JXSxitnseVljudsXOoVC4PJmdCdpLGuBgwpnzgCdwXfJk4 EqyA== 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=QlsshB2hmmqqEykMGQpNGinskqJZnL9q2NoZDCm87FAILif5SYO40wpxVEXpMAWTmb Lf7axO3GBSunLVW6RtJI/rLPsh4zFGbV970wStx7ssMfpnOPRfw2bGM6T+KH27RUQaLi nbk93+GqqybJEB+DiqLsEmURs0h0c4xwLjVDspB4gJaSb1NZcLHxU1/eoXQ+6QgQHeb0 QFQPP6SWf4j2LuJxBSIGOaJsqi7GKb6txiAsabavulnN9+QKu9O9Fxh6Gq7gLV/59Xwv 40mcuEj2cFU/B7XpdEmtILrYwLINS6rkqoiuAJBH78i1BYVXbSvfTcOq7k8PHBtEDJ2E FTNg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gHMWaM+q; 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 dh5-20020a05622a4e0500b00434ecf9f456si14751063qtb.574.2024.04.24.15.58.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 15:58:40 -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=gHMWaM+q; 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 1rzlYP-0005Tf-8q; Wed, 24 Apr 2024 18:57: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 1rzlYK-0005Ph-5f for qemu-devel@nongnu.org; Wed, 24 Apr 2024 18:57:24 -0400 Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzlYI-0001oq-Pl for qemu-devel@nongnu.org; Wed, 24 Apr 2024 18:57:23 -0400 Received: by mail-oi1-x235.google.com with SMTP id 5614622812f47-3c730f599abso285706b6e.0 for ; Wed, 24 Apr 2024 15:57:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713999441; x=1714604241; 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=gHMWaM+qXHvRo+uYZtJMNwdm5fiwh2UowvoULAI+ApwsTRr/J3f0bS1yeFDrzQaEw9 rGQo4Q1BqDXdCrWupVV6s0IeeiHP5lSSlHyP8S0l16I6cP4FbyFaKv6TPJM5kkKLNdBc f6IpUzqXhzBMznDUkU35kqhQuoVrjZpmcUli1cjF+ZSpwnhTGqB/lgpdibFl29/DxVRl KmhGoSMtrgN2+BxzdrBASccE55bgsI8UMb2Alu2FOReGDKsh0WIddO2zlTBcYOOdEbNV oqwyb9ur/yg6Wy6YknuvY8xkiscveJQ0IIXY5xofZGwrnHokvg7EAY/nat1l5D3IHu+P 7dUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713999441; x=1714604241; 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=vD+EEmp+kw/84gKPZuKVo/m/WZIj6E4xyRn3x59oPwC9fVgf9iM8dzAyZwS3VJOibL 91PZ7kCRxMOTFdhd11TVBWdQo3KeSZZh8MDcXq4+pNzlMQgUwZoj/wgQ9lEXtI2iMPG7 SmVYRZDKyIO5MviRk2AFdTEz/R30bSrWb/D+wtRPzVhqEWackuCV7Fbye0AlhT4Q0/eR vQZm6FMWwwGGNQIrKOTYXeQgYWlHerBQUftfOOAVwIs1FlELhXUSQtqVQwKSznHZHyLH 1A+cLWLHCA2cDRxDod1p8wJwtHyiS5xAG5Fa9oTUOlKBn22xsdhBmmGEUjvEfcZi4p1o OEuA== X-Gm-Message-State: AOJu0YxN5sFkMmu9zoRU21DKWtfz4EsE5j4jXKVitj8yR+x7OIAaWrEH yNpQiSjbAk71TunovrgLxZHvD/IUJxBIilkXv4/4vxcgTR4AbDgWiA/D0z6ww5S652ruvzoY/9N D X-Received: by 2002:a05:6808:b2c:b0:3c6:e81:4272 with SMTP id t12-20020a0568080b2c00b003c60e814272mr3851579oij.10.1713999441420; Wed, 24 Apr 2024 15:57:21 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id gu26-20020a056a004e5a00b006ed9760b815sm11947413pfb.211.2024.04.24.15.57.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 15:57:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 07/10] util/bufferiszero: Introduce biz_accel_fn typedef Date: Wed, 24 Apr 2024 15:57:02 -0700 Message-Id: <20240424225705.929812-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240424225705.929812-1-richard.henderson@linaro.org> References: <20240424225705.929812-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::235; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x235.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 Reviewed-by: Philippe Mathieu-Daudé --- 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) {