All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Eduardo Habkost" <ehabkost@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Claudio Fontana" <cfontana@suse.de>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [PATCH v5 1/4] target/i386/cpu: Introduce get_register_enum_32() helper
Date: Wed, 24 Feb 2021 23:46:40 +0100	[thread overview]
Message-ID: <20210224224643.3369940-2-philmd@redhat.com> (raw)
In-Reply-To: <20210224224643.3369940-1-philmd@redhat.com>

Introduce get_register_enum_32(), similar to get_register_name_32().

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 target/i386/cpu-internal.h | 4 ++++
 target/i386/cpu.c          | 7 ++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/target/i386/cpu-internal.h b/target/i386/cpu-internal.h
index be688cb393e..9df24c482ea 100644
--- a/target/i386/cpu-internal.h
+++ b/target/i386/cpu-internal.h
@@ -20,6 +20,8 @@
 #ifndef I386_CPU_INTERNAL_H
 #define I386_CPU_INTERNAL_H
 
+#include "qapi/qapi-types-machine.h"
+
 typedef enum FeatureWordType {
    CPUID_FEATURE_WORD,
    MSR_FEATURE_WORD,
@@ -55,6 +57,8 @@ typedef struct FeatureWordInfo {
 
 extern FeatureWordInfo feature_word_info[];
 
+X86CPURegister32 get_register_enum_32(FeatureWord w);
+
 void x86_cpu_expand_features(X86CPU *cpu, Error **errp);
 
 #ifndef CONFIG_USER_ONLY
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 219d7652524..ffa342171ba 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1476,6 +1476,11 @@ static const char *get_register_name_32(unsigned int reg)
     return x86_reg_info_32[reg].name;
 }
 
+X86CPURegister32 get_register_enum_32(FeatureWord w)
+{
+    return x86_reg_info_32[feature_word_info[w].cpuid.reg].qapi_enum;
+}
+
 /*
  * Returns the set of feature flags that are supported and migratable by
  * QEMU, for a given FeatureWord.
@@ -4548,7 +4553,7 @@ static void x86_cpu_get_feature_words(Object *obj, Visitor *v,
         qwi->cpuid_input_eax = wi->cpuid.eax;
         qwi->has_cpuid_input_ecx = wi->cpuid.needs_ecx;
         qwi->cpuid_input_ecx = wi->cpuid.ecx;
-        qwi->cpuid_register = x86_reg_info_32[wi->cpuid.reg].qapi_enum;
+        qwi->cpuid_register = get_register_enum_32(w);
         qwi->features = array[w];
 
         /* List will be in reverse order, but order shouldn't matter */
-- 
2.26.2



  reply	other threads:[~2021-02-24 22:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24 22:46 [PATCH v5 0/4] qapi: Restrict X86 features to X86 targets Philippe Mathieu-Daudé
2021-02-24 22:46 ` Philippe Mathieu-Daudé [this message]
2021-02-24 22:46 ` [PATCH v5 2/4] target/i386/cpu: Restrict x86_cpu_get_feature_words to sysemu Philippe Mathieu-Daudé
2021-02-24 22:46 ` [PATCH v5 3/4] qapi: Move X86 specific types to machine-target.json Philippe Mathieu-Daudé
2021-02-24 22:46 ` [PATCH v5 4/4] qapi/machine-target: Restrict X86 features to X86 targets Philippe Mathieu-Daudé
2021-03-09 22:27 ` [PATCH v5 0/4] qapi: " Philippe Mathieu-Daudé

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=20210224224643.3369940-2-philmd@redhat.com \
    --to=philmd@redhat.com \
    --cc=armbru@redhat.com \
    --cc=cfontana@suse.de \
    --cc=ehabkost@redhat.com \
    --cc=laurent@vivier.eu \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.