From nobody Sat Nov 23 23:23:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=bytedance.com ARC-Seal: i=1; a=rsa-sha256; t=1728517812; cv=none; d=zohomail.com; s=zohoarc; b=JjIUiUmMX58hTYiC87TED4jTF9EMEUkKdkwES7o+2CECSeieFXCUpDWU8vrip9u8SyYFflGZAPTRB1N4Vkbp8eAl/v4gnYp09iF+TD5Cgz4QrW9O3bEdHYNochn6hbYCZUYOKPw3O3DYDA1BxaS6JLvKWMV69ICW6zN2PleVd8A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728517812; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6OLRasB0CC5bovyz2wxcoxtO2uT5qwr3ejcqOwE8FJE=; b=UBZ61zgWm+uN1wnCfK7sxpMJ/eGVsFttA9SA8SUB0R3SMSp94b9XKBVknhCgCtrQZNsyy7b1T7hatQTnD+9V5pNjxkBFzWMGHKNoExX200GLKGTf/E8H8gCOwqCMivfx/s1/se+5FmY9uMUVNHrcHEED3/Q1+LoI+B1me9RKRYU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728517812174286.27862406942893; Wed, 9 Oct 2024 16:50:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sygPA-0002zw-VJ; Wed, 09 Oct 2024 19:47:44 -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 1sygP6-0002yw-Uz for qemu-devel@nongnu.org; Wed, 09 Oct 2024 19:47:41 -0400 Received: from mail-qv1-xf2b.google.com ([2607:f8b0:4864:20::f2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sygP4-0006ba-VT for qemu-devel@nongnu.org; Wed, 09 Oct 2024 19:47:40 -0400 Received: by mail-qv1-xf2b.google.com with SMTP id 6a1803df08f44-6cbceb48613so2465476d6.2 for ; Wed, 09 Oct 2024 16:47:35 -0700 (PDT) Received: from DY4X0N7X05.bytedance.net ([2605:a7c0:0:301::44]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6cbe85d856fsm264386d6.72.2024.10.09.16.47.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 09 Oct 2024 16:47:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1728517654; x=1729122454; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6OLRasB0CC5bovyz2wxcoxtO2uT5qwr3ejcqOwE8FJE=; b=Gmz0Zcm10/Gd6Ei3dwkFi8UWXBfJRM0NEUa6y9QHs67FC7qLiLHZ+Mz0Sxqal+0+Qs EhQxh0K4AwqdeaxmFannjpNa0sjphZaD7JIhs7NGAV9UT7trIhG9RuTQN/JJsx+39vZR wmzgW9/aH5BSVFjeSYzUF65oInaPQNogqve+XcUSmQfwJrVOMse/opz1pre2vQPhuUYn B5kZB6jOfMeFU9ifJlw4jZQd2RmjHaMPKKfRd+2XNbp/Ry3RR51Na3xmGzu8J2lrz4L5 iaS1jkrg2wlcdkgM+ebtWdNQp1yzNFjV0j2Qm3foLEgzYGRXN8aM0ejPE5XjYH9V6nx+ c/BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728517654; x=1729122454; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6OLRasB0CC5bovyz2wxcoxtO2uT5qwr3ejcqOwE8FJE=; b=jgYQLJNIr9NiV74t200tZtHKYymY+KmnsC2qFNKNPhEq+MULZWjY3AFOAD19qrKvwR UU4aKrFsOLGF1CPMCU9ep3PNsaTHL23HHpG59qJZ6bcTaUd34yLQjQjmXPJNEbn5zatU RaReUEZj67Mdu0Lp5boDiDdNfWSkjNuh4BCOUkL27tE6UbaOK/Be7SOTBvyEKmDihNOA FS0QID/a2jaoVHJWVLna0lJ8U6HGaz4aOrc/VkmkUl3CSuc5OXfB94Jpxxuhbz4IMTZD CLT6RZqtcfTxYSUtPsvv0f1DmxmYgAcgwN5hu/j7L/+yMoZ9S3Br7FLJtoZa9Rrkaz69 SY+Q== X-Forwarded-Encrypted: i=1; AJvYcCXNi33B8pjC5H9A/pSg+fCd6c2qNZf0HM7bbOz8ENpj91p/6cmXzyQmE0o24ekJHzaxCVjRpEtTP+5k@nongnu.org X-Gm-Message-State: AOJu0YxlVwNkf/+n3L87UzUup8yUBHrcVWMFfbACRUqog5i/6yAoHzOV atNS2H3ArtT5EwqKSuKFPTK8DArTPs7XcRZcrlIRKF7Z0Z+z7V5DGwyY4a+jIws= X-Google-Smtp-Source: AGHT+IE97e9pilUf2xOw+kfKMNGuAbQW9PAJKWk1g1U2+F99rdMyWaBk+y6DKVGmyRbTzDLO16dSPA== X-Received: by 2002:a05:6214:3b87:b0:6cb:a355:10a9 with SMTP id 6a1803df08f44-6cbe4b05ff6mr25716966d6.34.1728517654104; Wed, 09 Oct 2024 16:47:34 -0700 (PDT) From: Yichen Wang To: "Dr. David Alan Gilbert" , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Xu , Fabiano Rosas , Eric Blake , Markus Armbruster , "Michael S. Tsirkin" , Cornelia Huck , qemu-devel@nongnu.org Cc: "Hao Xiang" , "Liu, Yuan1" , "Shivam Kumar" , "Ho-Ren (Jack) Chuang" , "Yichen Wang" Subject: [PATCH v6 01/12] meson: Introduce new instruction set enqcmd to the build system. Date: Wed, 9 Oct 2024 16:45:59 -0700 Message-Id: <20241009234610.27039-2-yichen.wang@bytedance.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20241009234610.27039-1-yichen.wang@bytedance.com> References: <20241009234610.27039-1-yichen.wang@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::f2b; envelope-from=yichen.wang@bytedance.com; helo=mail-qv1-xf2b.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @bytedance.com) X-ZM-MESSAGEID: 1728517814264116600 Content-Type: text/plain; charset="utf-8" From: Hao Xiang Enable instruction set enqcmd in build. Signed-off-by: Hao Xiang Signed-off-by: Yichen Wang --- meson.build | 14 ++++++++++++++ meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 3 +++ 3 files changed, 19 insertions(+) diff --git a/meson.build b/meson.build index 4ea1984fc5..a7b545cd88 100644 --- a/meson.build +++ b/meson.build @@ -2954,6 +2954,20 @@ config_host_data.set('CONFIG_AVX512BW_OPT', get_opti= on('avx512bw') \ int main(int argc, char *argv[]) { return bar(argv[0]); } '''), error_message: 'AVX512BW not available').allowed()) =20 +config_host_data.set('CONFIG_DSA_OPT', get_option('enqcmd') \ + .require(have_cpuid_h, error_message: 'cpuid.h not available, cannot ena= ble ENQCMD') \ + .require(cc.links(''' + #include + #include + #include + static int __attribute__((target("enqcmd"))) bar(void *a) { + uint64_t dst[8] =3D { 0 }; + uint64_t src[8] =3D { 0 }; + return _enqcmd(dst, src); + } + int main(int argc, char *argv[]) { return bar(argv[argc - 1]); } + '''), error_message: 'ENQCMD not available').allowed()) + # For both AArch64 and AArch32, detect if builtins are available. config_host_data.set('CONFIG_ARM_AES_BUILTIN', cc.compiles(''' #include diff --git a/meson_options.txt b/meson_options.txt index 5ee1d95c9c..2c02c654f0 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -123,6 +123,8 @@ option('avx2', type: 'feature', value: 'auto', description: 'AVX2 optimizations') option('avx512bw', type: 'feature', value: 'auto', description: 'AVX512BW optimizations') +option('enqcmd', type: 'feature', value: 'disabled', + description: 'ENQCMD optimizations') option('keyring', type: 'feature', value: 'auto', description: 'Linux keyring support') option('libkeyutils', type: 'feature', value: 'auto', diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 3bee1c56df..f6c7f1251e 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -96,6 +96,7 @@ meson_options_help() { printf "%s\n" ' auth-pam PAM access control' printf "%s\n" ' avx2 AVX2 optimizations' printf "%s\n" ' avx512bw AVX512BW optimizations' + printf "%s\n" ' enqcmd ENQCMD optimizations' printf "%s\n" ' blkio libblkio block device driver' printf "%s\n" ' bochs bochs image format support' printf "%s\n" ' bpf eBPF support' @@ -241,6 +242,8 @@ _meson_option_parse() { --disable-avx2) printf "%s" -Davx2=3Ddisabled ;; --enable-avx512bw) printf "%s" -Davx512bw=3Denabled ;; --disable-avx512bw) printf "%s" -Davx512bw=3Ddisabled ;; + --enable-enqcmd) printf "%s" -Denqcmd=3Denabled ;; + --disable-enqcmd) printf "%s" -Denqcmd=3Ddisabled ;; --enable-gcov) printf "%s" -Db_coverage=3Dtrue ;; --disable-gcov) printf "%s" -Db_coverage=3Dfalse ;; --enable-lto) printf "%s" -Db_lto=3Dtrue ;; --=20 Yichen Wang