qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Zhao Liu <zhao1.liu@intel.com>
To: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Daniel P . Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, Xudong Hao <xudong.hao@intel.com>,
	Zhao Liu <zhao1.liu@intel.com>
Subject: [PATCH v2 06/11] i386/cpu: Allow unsupported avx10_version with x-force-features
Date: Mon, 15 Dec 2025 15:37:38 +0800	[thread overview]
Message-ID: <20251215073743.4055227-7-zhao1.liu@intel.com> (raw)
In-Reply-To: <20251215073743.4055227-1-zhao1.liu@intel.com>

The "force_features" ("x-force-features" property) forces setting
feature even if host doesn't support, but also reports the warning.

Given its function, it's useful for debug, so even if the AVX10
version is unsupported by host, force to set this AVX10 version if
x-force-features=on.

Tested-by: Xudong Hao <xudong.hao@intel.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
Changes since v1:
 * New patch.
---
 target/i386/cpu.c | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index c47e06cb79e7..41ff4058871a 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -9500,16 +9500,27 @@ static bool x86_cpu_filter_features(X86CPU *cpu, bool verbose)
         uint8_t version = x86_cpu_get_host_avx10_version();
 
         if (version < env->avx10_version) {
-            if (prefix) {
-                warn_report("%s: avx10.%d. Adjust to avx10.%d",
-                            prefix, env->avx10_version, version);
-            }
             /*
-             * Discrete feature bits have been checked and filtered based on
-             * host support. So it's safe to change version without reverting
-             * other feature bits.
+             * With x-force-features=on, CPUID_7_1_EDX_AVX10 will not be masked
+             * off, so there's no need to zero avx10 version.
              */
-            env->avx10_version = version;
+            if (!cpu->force_features) {
+                if (prefix) {
+                    warn_report("%s: avx10.%d. Adjust to avx10.%d",
+                                prefix, env->avx10_version, version);
+                }
+                /*
+                 * Discrete feature bits have been checked and filtered based
+                 * on host support. So it's safe to change version without
+                 * reverting other feature bits.
+                 */
+                env->avx10_version = version;
+            } else {
+                if (prefix) {
+                    warn_report("%s: avx10.%d.",
+                                prefix, env->avx10_version);
+                }
+            }
             have_filtered_features = true;
         }
     } else if (env->avx10_version) {
-- 
2.34.1



  parent reply	other threads:[~2025-12-15  7:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15  7:37 [PATCH v2 00/11] i386/cpu: Add new instructions & CPU model for Intel Diamond Rapids Zhao Liu
2025-12-15  7:37 ` [PATCH v2 01/11] i386/cpu: Add support for MOVRS in CPUID enumeration Zhao Liu
2025-12-15  7:37 ` [PATCH v2 02/11] i386/cpu: Add CPUID.0x1E.0x1 subleaf for AMX instructions Zhao Liu
2025-12-15  7:37 ` [PATCH v2 03/11] i386/cpu: Add support for AVX10_VNNI_INT in CPUID enumeration Zhao Liu
2025-12-15  7:37 ` [PATCH v2 04/11] i386/cpu: Support AVX10.2 with AVX10 feature models Zhao Liu
2025-12-15  7:37 ` [PATCH v2 05/11] i386/cpu: Add a helper to get host avx10 version Zhao Liu
2025-12-15  7:37 ` Zhao Liu [this message]
2025-12-15  7:37 ` [PATCH v2 07/11] i386/cpu: Allow cache to be shared at thread level Zhao Liu
2025-12-15  7:37 ` [PATCH v2 08/11] i386/cpu: Add an option in X86CPUDefinition to control CPUID 0x1f Zhao Liu
2025-12-15  7:37 ` [PATCH v2 09/11] i386/cpu: Define dependency for VMX_VM_ENTRY_LOAD_IA32_FRED Zhao Liu
2025-12-15  7:37 ` [PATCH v2 10/11] i386/cpu: Add CPU model for Diamond Rapids Zhao Liu
2025-12-15  7:37 ` [PATCH v2 11/11] dosc/cpu-models-x86: Add documentation for DiamondRapids Zhao Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251215073743.4055227-7-zhao1.liu@intel.com \
    --to=zhao1.liu@intel.com \
    --cc=berrange@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xudong.hao@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).