qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Clean up and enhance of feature_word_description()
@ 2024-12-17 12:39 Xiaoyao Li
  2024-12-17 12:39 ` [PATCH 1/2] i386: Remove unused parameter "uint32_t bit" in feature_word_description() Xiaoyao Li
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Xiaoyao Li @ 2024-12-17 12:39 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Zhao Liu, qemu-devel

This series grabs two patches related to feature_word_description() from
two different old threads, they are simple and straightforward. 

Patch 1 is grabbed from [1] while patch 2 is grabbed from [2].

[1]: https://lore.kernel.org/qemu-devel/20230106083826.5384-3-lei4.wang@intel.com/
[2]: https://lore.kernel.org/qemu-devel/20220808085834.3227541-2-xiaoyao.li@intel.com/

Lei Wang (1):
  i386: Remove unused parameter "uint32_t bit" in
    feature_word_description()

Xiaoyao Li (1):
  target/i386: Print CPUID subleaf info for unsupported feature

 target/i386/cpu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] i386: Remove unused parameter "uint32_t bit" in feature_word_description()
  2024-12-17 12:39 [PATCH 0/2] Clean up and enhance of feature_word_description() Xiaoyao Li
@ 2024-12-17 12:39 ` Xiaoyao Li
  2024-12-17 16:29   ` Zhao Liu
  2024-12-17 12:39 ` [PATCH 2/2] target/i386: Print CPUID subleaf info for unsupported feature Xiaoyao Li
  2025-01-13  8:04 ` [PATCH 0/2] Clean up and enhance of feature_word_description() Xiaoyao Li
  2 siblings, 1 reply; 7+ messages in thread
From: Xiaoyao Li @ 2024-12-17 12:39 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Zhao Liu, qemu-devel

From: Lei Wang <lei4.wang@intel.com>

Parameter "uint32_t bit" is not used in function feature_word_description(),
so remove it.

Signed-off-by: Lei Wang <lei4.wang@intel.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
 target/i386/cpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 525339945920..d09e2f868c35 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5451,7 +5451,7 @@ static const TypeInfo max_x86_cpu_type_info = {
     .class_init = max_x86_cpu_class_init,
 };
 
-static char *feature_word_description(FeatureWordInfo *f, uint32_t bit)
+static char *feature_word_description(FeatureWordInfo *f)
 {
     assert(f->type == CPUID_FEATURE_WORD || f->type == MSR_FEATURE_WORD);
 
@@ -5490,6 +5490,7 @@ static void mark_unavailable_features(X86CPU *cpu, FeatureWord w, uint64_t mask,
     CPUX86State *env = &cpu->env;
     FeatureWordInfo *f = &feature_word_info[w];
     int i;
+    g_autofree char *feat_word_str = feature_word_description(f);
 
     if (!cpu->force_features) {
         env->features[w] &= ~mask;
@@ -5502,7 +5503,6 @@ static void mark_unavailable_features(X86CPU *cpu, FeatureWord w, uint64_t mask,
 
     for (i = 0; i < 64; ++i) {
         if ((1ULL << i) & mask) {
-            g_autofree char *feat_word_str = feature_word_description(f, i);
             warn_report("%s: %s%s%s [bit %d]",
                         verbose_prefix,
                         feat_word_str,
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] target/i386: Print CPUID subleaf info for unsupported feature
  2024-12-17 12:39 [PATCH 0/2] Clean up and enhance of feature_word_description() Xiaoyao Li
  2024-12-17 12:39 ` [PATCH 1/2] i386: Remove unused parameter "uint32_t bit" in feature_word_description() Xiaoyao Li
@ 2024-12-17 12:39 ` Xiaoyao Li
  2024-12-17 16:31   ` Zhao Liu
  2025-01-13  8:04 ` [PATCH 0/2] Clean up and enhance of feature_word_description() Xiaoyao Li
  2 siblings, 1 reply; 7+ messages in thread
From: Xiaoyao Li @ 2024-12-17 12:39 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Zhao Liu, qemu-devel

Some CPUID leaves have meaningful subleaf index. Print the subleaf info
in feature_word_description for CPUID features.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target/i386/cpu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index d09e2f868c35..3a697834e3ad 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5460,8 +5460,9 @@ static char *feature_word_description(FeatureWordInfo *f)
         {
             const char *reg = get_register_name_32(f->cpuid.reg);
             assert(reg);
-            return g_strdup_printf("CPUID.%02XH:%s",
-                                   f->cpuid.eax, reg);
+            return g_strdup_printf("CPUID.%02XH_%02XH:%s",
+                                   f->cpuid.eax,
+                                   f->cpuid.needs_ecx ? f->cpuid.ecx : 0, reg);
         }
     case MSR_FEATURE_WORD:
         return g_strdup_printf("MSR(%02XH)",
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] i386: Remove unused parameter "uint32_t bit" in feature_word_description()
  2024-12-17 12:39 ` [PATCH 1/2] i386: Remove unused parameter "uint32_t bit" in feature_word_description() Xiaoyao Li
@ 2024-12-17 16:29   ` Zhao Liu
  0 siblings, 0 replies; 7+ messages in thread
From: Zhao Liu @ 2024-12-17 16:29 UTC (permalink / raw)
  To: Xiaoyao Li; +Cc: Paolo Bonzini, qemu-devel

On Tue, Dec 17, 2024 at 07:39:31AM -0500, Xiaoyao Li wrote:
> Date: Tue, 17 Dec 2024 07:39:31 -0500
> From: Xiaoyao Li <xiaoyao.li@intel.com>
> Subject: [PATCH 1/2] i386: Remove unused parameter "uint32_t bit" in
>  feature_word_description()
> X-Mailer: git-send-email 2.34.1
> 
> From: Lei Wang <lei4.wang@intel.com>
> 
> Parameter "uint32_t bit" is not used in function feature_word_description(),
> so remove it.
> 
> Signed-off-by: Lei Wang <lei4.wang@intel.com>
> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
> Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
>  target/i386/cpu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

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



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] target/i386: Print CPUID subleaf info for unsupported feature
  2024-12-17 12:39 ` [PATCH 2/2] target/i386: Print CPUID subleaf info for unsupported feature Xiaoyao Li
@ 2024-12-17 16:31   ` Zhao Liu
  0 siblings, 0 replies; 7+ messages in thread
From: Zhao Liu @ 2024-12-17 16:31 UTC (permalink / raw)
  To: Xiaoyao Li; +Cc: Paolo Bonzini, qemu-devel

On Tue, Dec 17, 2024 at 07:39:32AM -0500, Xiaoyao Li wrote:
> Date: Tue, 17 Dec 2024 07:39:32 -0500
> From: Xiaoyao Li <xiaoyao.li@intel.com>
> Subject: [PATCH 2/2] target/i386: Print CPUID subleaf info for unsupported
>  feature
> X-Mailer: git-send-email 2.34.1
> 
> Some CPUID leaves have meaningful subleaf index. Print the subleaf info
> in feature_word_description for CPUID features.
> 
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  target/i386/cpu.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

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



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] Clean up and enhance of feature_word_description()
  2024-12-17 12:39 [PATCH 0/2] Clean up and enhance of feature_word_description() Xiaoyao Li
  2024-12-17 12:39 ` [PATCH 1/2] i386: Remove unused parameter "uint32_t bit" in feature_word_description() Xiaoyao Li
  2024-12-17 12:39 ` [PATCH 2/2] target/i386: Print CPUID subleaf info for unsupported feature Xiaoyao Li
@ 2025-01-13  8:04 ` Xiaoyao Li
  2025-05-28  8:43   ` Paolo Bonzini
  2 siblings, 1 reply; 7+ messages in thread
From: Xiaoyao Li @ 2025-01-13  8:04 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Zhao Liu, qemu-devel

On 12/17/2024 8:39 PM, Xiaoyao Li wrote:
> This series grabs two patches related to feature_word_description() from
> two different old threads, they are simple and straightforward.
> 
> Patch 1 is grabbed from [1] while patch 2 is grabbed from [2].

Ping...

> [1]: https://lore.kernel.org/qemu-devel/20230106083826.5384-3-lei4.wang@intel.com/
> [2]: https://lore.kernel.org/qemu-devel/20220808085834.3227541-2-xiaoyao.li@intel.com/
> 
> Lei Wang (1):
>    i386: Remove unused parameter "uint32_t bit" in
>      feature_word_description()
> 
> Xiaoyao Li (1):
>    target/i386: Print CPUID subleaf info for unsupported feature
> 
>   target/i386/cpu.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] Clean up and enhance of feature_word_description()
  2025-01-13  8:04 ` [PATCH 0/2] Clean up and enhance of feature_word_description() Xiaoyao Li
@ 2025-05-28  8:43   ` Paolo Bonzini
  0 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2025-05-28  8:43 UTC (permalink / raw)
  To: Xiaoyao Li; +Cc: Zhao Liu, qemu-devel

On 1/13/25 09:04, Xiaoyao Li wrote:
> On 12/17/2024 8:39 PM, Xiaoyao Li wrote:
>> This series grabs two patches related to feature_word_description() from
>> two different old threads, they are simple and straightforward.
>>
>> Patch 1 is grabbed from [1] while patch 2 is grabbed from [2].
> 
> Ping...

Applied, thanks---with a slightly fancier formatting for patch 2:

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 8589391023d..446924be90f 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5780,12 +5780,15 @@ static char *feature_word_description(FeatureWordInfo *f)
          {
              const char *reg = get_register_name_32(f->cpuid.reg);
              assert(reg);
-            return g_strdup_printf("CPUID.%02XH_%02XH:%s",
-                                   f->cpuid.eax,
-                                   f->cpuid.needs_ecx ? f->cpuid.ecx : 0, reg);
+            if (!f->cpuid.needs_ecx) {
+                return g_strdup_printf("CPUID[eax=%02Xh].%s", f->cpuid.eax, reg);
+            } else {
+                return g_strdup_printf("CPUID[eax=%02Xh,ecx=%02Xh].%s",
+                                       f->cpuid.eax, f->cpuid.ecx : 0, reg);
+            }
          }
      case MSR_FEATURE_WORD:
-        return g_strdup_printf("MSR(%02XH)",
+        return g_strdup_printf("MSR(%02Xh)",
                                 f->msr.index);
      }
  

Paolo



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-05-28  8:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-17 12:39 [PATCH 0/2] Clean up and enhance of feature_word_description() Xiaoyao Li
2024-12-17 12:39 ` [PATCH 1/2] i386: Remove unused parameter "uint32_t bit" in feature_word_description() Xiaoyao Li
2024-12-17 16:29   ` Zhao Liu
2024-12-17 12:39 ` [PATCH 2/2] target/i386: Print CPUID subleaf info for unsupported feature Xiaoyao Li
2024-12-17 16:31   ` Zhao Liu
2025-01-13  8:04 ` [PATCH 0/2] Clean up and enhance of feature_word_description() Xiaoyao Li
2025-05-28  8:43   ` Paolo Bonzini

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).