qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Zhenzhong Duan <zhenzhong.duan@intel.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, ehabkost@redhat.com
Subject: [PATCH] target/i386: Fix CPU feature dependency check
Date: Fri,  8 Jul 2022 13:42:27 +0800	[thread overview]
Message-ID: <20220708054227.195038-1-zhenzhong.duan@intel.com> (raw)

While in other call site "x-force-features" takes effect to keep
the CPU feature even though not supported for any reason.

This isn't consistent while expanding features, Fixed to keep user
explicitly enabled features if "x-force-features" is specified.

Fixes: 99e24dbdaa682 ("target/i386: introduce generic feature dependency mechanism")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
 target/i386/cpu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 6a57ef13af86..b64c0b37f0cb 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6206,6 +6206,9 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
                                       unavailable_features & env->user_features[d->to.index],
                                       "This feature depends on other features that were not requested");
 
+            if (cpu->force_features) {
+                unavailable_features &= ~env->user_features[d->to.index];
+            }
             env->features[d->to.index] &= ~unavailable_features;
         }
     }
-- 
2.25.1



                 reply	other threads:[~2022-07-08  5:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220708054227.195038-1-zhenzhong.duan@intel.com \
    --to=zhenzhong.duan@intel.com \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).