From nobody Sat Nov 23 20:07:14 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=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1730215174; cv=none; d=zohomail.com; s=zohoarc; b=KH03D2SCvWzFRY9+Eeop1T+fkRHlKVro6NSDMZEZQC/cWk3DLMwYTv/sDjfobyP27j9t50/QwnTeKyw3oPC0tVGRAM4M56Y1CYtSj+2eufBtTf5eJt/QhJQZaR0wB33Z2HjpNgH1z03zUmXALnM1nSg09dgJ+kDqhB50m4qYtzQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730215174; 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=zyYC6UOZKU94Wwrtdw6/pO2lxILLRipgiNrFy5tbKJc=; b=WjYRYdFRNG5qkJybTAzJeRHTt82+7UMbotNJOx+sqjd/3VPdkLQxlibnGn4XycLNH0y4g0cXetnBgmkSJ6uK3n18Jtgs1ske0F41q6nOgZU/PYOAAMYceCTyZFbe2vN0Fio1qf2puZt5NNLNSfGb0CiSLDUlU+uaCTUz2KqWzME= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17302151743077.69496548428458; Tue, 29 Oct 2024 08:19:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5o0J-0006C7-FR; Tue, 29 Oct 2024 11:19:31 -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 1t5o07-0005l7-A0 for qemu-devel@nongnu.org; Tue, 29 Oct 2024 11:19:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t5o02-0000QH-C5 for qemu-devel@nongnu.org; Tue, 29 Oct 2024 11:19:18 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-76-I-oK3qVbMfWbbVFm0155jw-1; Tue, 29 Oct 2024 11:19:10 -0400 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-37d531a19a9so2909481f8f.1 for ; Tue, 29 Oct 2024 08:19:10 -0700 (PDT) Received: from [192.168.10.3] ([151.49.226.83]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38058b4000dsm12970876f8f.45.2024.10.29.08.19.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 08:19:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730215153; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zyYC6UOZKU94Wwrtdw6/pO2lxILLRipgiNrFy5tbKJc=; b=G8brQK35haXtwiTQP0Z7/i+EgZuyyTyZothYVibloH8cw5BibcvciSTbZXvHMNUMPQMUr2 DVNIyBWOlD6j4UnsVkP48TO8x7jD9J0/mwaoqVuwr6SnlT7McnhK7N3wEqi6CvliqYswfV mWu0ymLRJvDUAi0wPnkX8Ln785YA+yk= X-MC-Unique: I-oK3qVbMfWbbVFm0155jw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730215149; x=1730819949; 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=zyYC6UOZKU94Wwrtdw6/pO2lxILLRipgiNrFy5tbKJc=; b=O6yUl76vKQjx0iy5d6g4sDyl/zH2K8YLvmfQFSAiBo5jEuYMEA1eBRZNl0Z1npYBJ8 XpafE/Mit4ugB4G7zc/0DaeHiAp8dhWFSusQ+KUh+BHAMKdR+d0UeC9kJ5SZBFRCHEV8 4euOPgbM09GOhSEfBiZHtPGsCa095VmMEVxQnPD+2CVjxv4dq73Gz0u1aWaWMcYoCsRr 35PuJ+MgMUSMk+0G1z1eBpCe2Ws0qLQ+Kao5uDztRZPayBheyH8kaJiZygkgy/NPCSVX m+c6ZXgBmKQ28T+1J4VgJ2h8JzNnRzVOmcLctRI36xymnhPGnZ9+kJnyhvZ7bLR5pr/V GuVQ== X-Gm-Message-State: AOJu0YwJFelmqMNuvnrdGHI3Or0trmqrTHnqYhU8x8GZ+1OwbeQwD94Q RmadiqgElcDNAZGwJt+WqSX6r/607/x43j8x/kBe00rnpqfGPfE9u0oqvotzMuduJBrNVIRe11T A3xsWQ1r+w/l+YE6iZifvlykI3gdKJ7OHosOD5yUu2Tv7xtT3ISNF1kH34bZqnI6ZFjIFGOpcWa 2o/5SWR3gCYqp3ugEpQUnQ1HcKPG8d4HfZlbJGzlk= X-Received: by 2002:adf:ec89:0:b0:37d:3541:5643 with SMTP id ffacd0b85a97d-380612220ddmr8379152f8f.51.1730215148886; Tue, 29 Oct 2024 08:19:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEx2e7lV0kDVzVNOfkYZy74/XL+KH81n3/UeY0OMvCkCbttgiyJCL/PAWeqnxBDlQ5N/qwN/Q== X-Received: by 2002:adf:ec89:0:b0:37d:3541:5643 with SMTP id ffacd0b85a97d-380612220ddmr8379138f8f.51.1730215148431; Tue, 29 Oct 2024 08:19:08 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: tao1.su@linux.intel.com, zhao1.liu@intel.com, xiaoyao.li@intel.com Subject: [PATCH 3/8] target/i386: return bool from x86_cpu_filter_features Date: Tue, 29 Oct 2024 16:18:53 +0100 Message-ID: <20241029151858.550269-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241029151858.550269-1-pbonzini@redhat.com> References: <20241029151858.550269-1-pbonzini@redhat.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=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 @redhat.com) X-ZM-MESSAGEID: 1730215176674116600 Content-Type: text/plain; charset="utf-8" Prepare for filtering non-boolean features such as AVX10 version. Signed-off-by: Paolo Bonzini Reviewed-by: Zhao Liu --- target/i386/cpu.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 1ee4d988caf..c2f6045ec1c 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -5840,7 +5840,7 @@ static void x86_cpu_parse_featurestr(const char *type= name, char *features, } } =20 -static void x86_cpu_filter_features(X86CPU *cpu, bool verbose); +static bool x86_cpu_filter_features(X86CPU *cpu, bool verbose); =20 /* Build a list with the name of all features on a feature word array */ static void x86_cpu_list_feature_names(FeatureWordArray features, @@ -7558,7 +7558,7 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **err= p) * * Returns: 0 if all flags are supported by the host, non-zero otherwise. */ -static void x86_cpu_filter_features(X86CPU *cpu, bool verbose) +static bool x86_cpu_filter_features(X86CPU *cpu, bool verbose) { CPUX86State *env =3D &cpu->env; FeatureWord w; @@ -7610,6 +7610,8 @@ static void x86_cpu_filter_features(X86CPU *cpu, bool= verbose) mark_unavailable_features(cpu, FEAT_7_0_EBX, CPUID_7_0_EBX_INT= EL_PT, prefix); } } + + return x86_cpu_have_filtered_features(cpu); } =20 static void x86_cpu_hyperv_realize(X86CPU *cpu) @@ -7707,14 +7709,14 @@ static void x86_cpu_realizefn(DeviceState *dev, Err= or **errp) } } =20 - x86_cpu_filter_features(cpu, cpu->check_cpuid || cpu->enforce_cpuid); - - if (cpu->enforce_cpuid && x86_cpu_have_filtered_features(cpu)) { - error_setg(&local_err, - accel_uses_host_cpuid() ? + if (x86_cpu_filter_features(cpu, cpu->check_cpuid || cpu->enforce_cpui= d)) { + if (cpu->enforce_cpuid) { + error_setg(&local_err, + accel_uses_host_cpuid() ? "Host doesn't support requested features" : "TCG doesn't support requested features"); - goto out; + goto out; + } } =20 /* On AMD CPUs, some CPUID[8000_0001].EDX bits must match the bits on --=20 2.47.0