[PATCH for-10.0.x] Revert "i386/cpu: Move adjustment of CPUID_EXT_PDCM before feature_dependencies[] check"

Michael Tokarev posted 1 patch 1 month, 1 week ago
Failed in applying to current master (apply log)
target/i386/cpu.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
[PATCH for-10.0.x] Revert "i386/cpu: Move adjustment of CPUID_EXT_PDCM before feature_dependencies[] check"
Posted by Michael Tokarev 1 month, 1 week ago
This reverts commit 3d26cb65c27190e57637644ecf6c96b8c3d246a3
(v10.0.3-34-g3d26cb65c271) from 10.0.x branch.

The problem is that the change makes qemu 10.0.x non-migratable
to subsequent qemu versions, since it requires introducing a new
machine type.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/i386/cpu.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 58c62ff5b5..34b52ef7a1 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6851,6 +6851,9 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
             /* Fixup overflow: max value for bits 23-16 is 255. */
             *ebx |= MIN(num, 255) << 16;
         }
+        if (!cpu->enable_pmu) {
+            *ecx &= ~CPUID_EXT_PDCM;
+        }
         break;
     case 2:
         /* cache info: needed for Pentium Pro compatibility */
@@ -7840,10 +7843,6 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
         }
     }
 
-    if (!cpu->enable_pmu) {
-        env->features[FEAT_1_ECX] &= ~CPUID_EXT_PDCM;
-    }
-
     for (i = 0; i < ARRAY_SIZE(feature_dependencies); i++) {
         FeatureDep *d = &feature_dependencies[i];
         if (!(env->features[d->from.index] & d->from.mask)) {
-- 
2.47.3
Re: [PATCH for-10.0.x] Revert "i386/cpu: Move adjustment of CPUID_EXT_PDCM before feature_dependencies[] check"
Posted by Zhao Liu 1 month, 1 week ago
On Wed, Oct 08, 2025 at 04:47:14PM +0300, Michael Tokarev wrote:
> Date: Wed, 8 Oct 2025 16:47:14 +0300
> From: Michael Tokarev <mjt@tls.msk.ru>
> Subject: [PATCH for-10.0.x] Revert "i386/cpu: Move adjustment of
>  CPUID_EXT_PDCM before feature_dependencies[] check"
> X-Mailer: git-send-email 2.47.3
> 
> This reverts commit 3d26cb65c27190e57637644ecf6c96b8c3d246a3
> (v10.0.3-34-g3d26cb65c271) from 10.0.x branch.
> 
> The problem is that the change makes qemu 10.0.x non-migratable
> to subsequent qemu versions, since it requires introducing a new
> machine type.
> 
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> ---
>  target/i386/cpu.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>