qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Lei Wang <lei4.wang@intel.com>
To: pbonzini@redhat.com
Cc: qemu-devel@nongnu.org, imammedo@redhat.com, dgilbert@redhat.com,
	berrange@redhat.com, xiaoyao.li@intel.com,
	yang.zhong@linux.intel.com, lei4.wang@intel.com
Subject: [PATCH v3 5/6] i386: Initialize AMX CPUID leaves with corresponding env->features[] leaves
Date: Fri,  6 Jan 2023 00:38:25 -0800	[thread overview]
Message-ID: <20230106083826.5384-6-lei4.wang@intel.com> (raw)
In-Reply-To: <20230106083826.5384-1-lei4.wang@intel.com>

The AMX-related CPUID value, i.e., CPUID(0x1D,1):EAX, CPUID(0x1D,1):EBX,
CPUID(0x1D,1):ECX and CPUID(0x1E,0):EBX are hard-coded to Sapphire Rapids
without considering future platforms.

Replace these hard-coded values with env->features[], so QEMU can pass the
right value to KVM.

Signed-off-by: Lei Wang <lei4.wang@intel.com>
---
 target/i386/cpu.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index e638a31d34..946df29a3d 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -576,16 +576,16 @@ static CPUCacheInfo legacy_l3_cache = {
 #define INTEL_PT_PSB_BITMAP      (0x003f << 16) /* Support 2K,4K,8K,16K,32K,64K */
 
 /* CPUID Leaf 0x1D constants: */
-#define INTEL_AMX_TILE_MAX_SUBLEAF     0x1
-#define INTEL_AMX_TOTAL_TILE_BYTES     0x2000
-#define INTEL_AMX_BYTES_PER_TILE       0x400
-#define INTEL_AMX_BYTES_PER_ROW        0x40
-#define INTEL_AMX_TILE_MAX_NAMES       0x8
-#define INTEL_AMX_TILE_MAX_ROWS        0x10
+#define INTEL_SPR_AMX_TILE_MAX_SUBLEAF     0x1
+#define INTEL_SPR_AMX_TOTAL_TILE_BYTES     0x2000
+#define INTEL_SPR_AMX_BYTES_PER_TILE       0x400
+#define INTEL_SPR_AMX_BYTES_PER_ROW        0x40
+#define INTEL_SPR_AMX_TILE_MAX_NAMES       0x8
+#define INTEL_SPR_AMX_TILE_MAX_ROWS        0x10
 
 /* CPUID Leaf 0x1E constants: */
-#define INTEL_AMX_TMUL_MAX_K           0x10
-#define INTEL_AMX_TMUL_MAX_N           0x40
+#define INTEL_SPR_AMX_TMUL_MAX_K           0x10
+#define INTEL_SPR_AMX_TMUL_MAX_N           0x40
 
 void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1,
                               uint32_t vendor2, uint32_t vendor3)
@@ -5764,12 +5764,11 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
 
         if (count == 0) {
             /* Highest numbered palette subleaf */
-            *eax = INTEL_AMX_TILE_MAX_SUBLEAF;
+            *eax = INTEL_SPR_AMX_TILE_MAX_SUBLEAF;
         } else if (count == 1) {
-            *eax = INTEL_AMX_TOTAL_TILE_BYTES |
-                   (INTEL_AMX_BYTES_PER_TILE << 16);
-            *ebx = INTEL_AMX_BYTES_PER_ROW | (INTEL_AMX_TILE_MAX_NAMES << 16);
-            *ecx = INTEL_AMX_TILE_MAX_ROWS;
+            *eax = env->features[FEAT_1D_1_EAX];
+            *ebx = env->features[FEAT_1D_1_EBX];
+            *ecx = env->features[FEAT_1D_1_ECX];
         }
         break;
     }
@@ -5785,7 +5784,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
 
         if (count == 0) {
             /* Highest numbered palette subleaf */
-            *ebx = INTEL_AMX_TMUL_MAX_K | (INTEL_AMX_TMUL_MAX_N << 8);
+            *ebx = env->features[FEAT_1E_0_EBX];
         }
         break;
     }
-- 
2.34.1



  parent reply	other threads:[~2023-01-06  8:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-06  8:38 [PATCH v3 0/6] Support for new CPU model SapphireRapids Lei Wang
2023-01-06  8:38 ` [PATCH v3 1/6] i386: Introduce FeatureWordInfo for AMX CPUID leaf 0x1D and 0x1E Lei Wang
2023-02-06  7:45   ` Yuan Yao
2023-01-06  8:38 ` [PATCH v3 2/6] i386: Remove unused parameter "uint32_t bit" in feature_word_description() Lei Wang
2023-01-27 13:29   ` Igor Mammedov
2023-02-08 14:33   ` Xiaoyao Li
2023-01-06  8:38 ` [PATCH v3 3/6] i386: Introduce new struct "MultiBitFeatureInfo" for multi-bit features Lei Wang
2023-02-08 14:39   ` Xiaoyao Li
2023-01-06  8:38 ` [PATCH v3 4/6] i386: Mask and report unavailable multi-bit feature values Lei Wang
2023-02-06  7:43   ` Yuan Yao
2023-02-09  1:04     ` Wang, Lei
2023-02-09  3:29       ` Xiaoyao Li
2023-02-09  4:21         ` Wang, Lei
2023-02-09  5:59           ` Xiaoyao Li
2023-02-09  6:15             ` Wang, Lei
2023-02-09  9:26               ` Xiaoyao Li
2023-01-06  8:38 ` Lei Wang [this message]
2023-01-06  8:38 ` [PATCH v3 6/6] i386: Add new CPU model SapphireRapids Lei Wang
2023-02-02 10:40   ` Igor Mammedov
2023-02-03  6:02     ` Wang, Lei
2023-02-02 11:05 ` [PATCH v3 0/6] Support for " Igor Mammedov
2023-02-07  2:50   ` Wang, Lei
2023-03-06 12:49     ` Igor Mammedov
2023-02-08 14:53   ` Xiaoyao Li
2023-03-02 14:49   ` Robert Hoo

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=20230106083826.5384-6-lei4.wang@intel.com \
    --to=lei4.wang@intel.com \
    --cc=berrange@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xiaoyao.li@intel.com \
    --cc=yang.zhong@linux.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).