Skip to contentSkip to conversation

target/i386: Add ARCH_CAPABILITIES related bits into Icelake-Server CPU model

PATCH Superseded Xiaoyao Li 4 participants 7 messages Mar 16, 2020 – Mar 24, 2020

lore
Share & tools
lore

Xiaoyao Li

author
#0 lore raw

PATCH 1/1 target/i386: Add ARCH_CAPABILITIES related bits into Icelake-Server CPU model

Current Icelake-Server CPU model lacks all the features enumerated by MSR_IA32_ARCH_CAPABILITIES.

Add them, so that guest of "Icelake-Server" can see all of them.

---
 target/i386/cpu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
target/i386/cpu.c +6 -1
index 92fafa265914..5f09d114e1c2 100644
@@ -3425,7 +3425,12 @@ static X86CPUDefinition builtin_x86_defs[] = {
             CPUID_7_0_ECX_AVX512VNNI | CPUID_7_0_ECX_AVX512BITALG |
             CPUID_7_0_ECX_AVX512_VPOPCNTDQ | CPUID_7_0_ECX_LA57,
         .features[FEAT_7_0_EDX] =
-            CPUID_7_0_EDX_SPEC_CTRL | CPUID_7_0_EDX_SPEC_CTRL_SSBD,
+            CPUID_7_0_EDX_SPEC_CTRL | CPUID_7_0_EDX_ARCH_CAPABILITIES |
+            CPUID_7_0_EDX_SPEC_CTRL_SSBD,
+        .features[FEAT_ARCH_CAPABILITIES] =
+            MSR_ARCH_CAP_RDCL_NO | MSR_ARCH_CAP_IBRS_ALL |
+            MSR_ARCH_CAP_SKIP_L1DFL_VMENTRY | MSR_ARCH_CAP_MDS_NO |
+            MSR_ARCH_CAP_PSCHANGE_MC_NO | MSR_ARCH_CAP_TAA_NO,
         /* Missing: XSAVES (not supported by some Linux versions,
                 * including v4.1 to v4.12).
                 * KVM doesn't yet expose any XSAVES state save component,
Signature · 1 line
2.20.1
#1 lore raw
Quoted 19 lines · Xiaoyao Li

Current Icelake-Server CPU model lacks all the features enumerated by MSR_IA32_ARCH_CAPABILITIES.

Add them, so that guest of "Icelake-Server" can see all of them.

---
 target/i386/cpu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
target/i386/cpu.c +0 -0
index 92fafa265914..5f09d114e1c2 100644
@@ -3425,7 +3425,12 @@ static X86CPUDefinition builtin_x86_defs[] = {
             CPUID_7_0_ECX_AVX512VNNI | CPUID_7_0_ECX_AVX512BITALG |
             CPUID_7_0_ECX_AVX512_VPOPCNTDQ | CPUID_7_0_ECX_LA57,
         .features[FEAT_7_0_EDX] =

target/i386/cpu.c static X86CPUDefinition builtin_x86_defs[] = { · line 3436

Quoted 10 lines
target/i386/cpu.c +6 -1
-            CPUID_7_0_EDX_SPEC_CTRL | CPUID_7_0_EDX_SPEC_CTRL_SSBD,
+            CPUID_7_0_EDX_SPEC_CTRL | CPUID_7_0_EDX_ARCH_CAPABILITIES |
+            CPUID_7_0_EDX_SPEC_CTRL_SSBD,
+        .features[FEAT_ARCH_CAPABILITIES] =
+            MSR_ARCH_CAP_RDCL_NO | MSR_ARCH_CAP_IBRS_ALL |
+            MSR_ARCH_CAP_SKIP_L1DFL_VMENTRY | MSR_ARCH_CAP_MDS_NO |
+            MSR_ARCH_CAP_PSCHANGE_MC_NO | MSR_ARCH_CAP_TAA_NO,
         /* Missing: XSAVES (not supported by some Linux versions,
                 * including v4.1 to v4.12).
                 * KVM doesn't yet expose any XSAVES state save component,

Hi Xiaoyao,

you need to add them as a new version of the CPU model.

Paolo

author
#2 lore raw

PATCH v2 1/1 target/i386: Add ARCH_CAPABILITIES related bits into Icelake-Server CPU model

Current Icelake-Server CPU model lacks all the features enumerated by MSR_IA32_ARCH_CAPABILITIES.

Add them, so that guest of "Icelake-Server" can see all of them.

---
v2:
- Add it as a new version.

---
 target/i386/cpu.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
target/i386/cpu.c +13 -0
index 92fafa265914..5fba6a2ad6b3 100644
@@ -3496,6 +3496,19 @@ static X86CPUDefinition builtin_x86_defs[] = {
                     { /* end of list */ }
                 },
             },
+            {
+                .version = 3,
+                .props = (PropValue[]) {
+                    { "arch-capabilities", "on" },
+                    { "rdctl-no", "on" },
+                    { "ibrs-all", "on" },
+                    { "skip-l1dfl-vmentry", "on" },
+                    { "mds-no", "on" },
+                    { "pschange-mc-no", "on" },
+                    { "taa-no", "on" },
+                    { /* end of list */ }
+                },
+            },
             { /* end of list */ }
         }
     },
Signature · 1 line
2.20.1
#3 lore raw

Hi Xiaoyao,

May be you can add .note for this new version.

for example:

+                .version = 3,
+                .note = "ARCH_CAPABILITIES",
+                .props = (PropValue[]) {
Quoted 41 lines · Xiaoyao Li

Current Icelake-Server CPU model lacks all the features enumerated by MSR_IA32_ARCH_CAPABILITIES.

Add them, so that guest of "Icelake-Server" can see all of them.

---
v2:
- Add it as a new version.

---
  target/i386/cpu.c | 13 +++++++++++++
  1 file changed, 13 insertions(+)
target/i386/cpu.c +13 -1
index 92fafa265914..5fba6a2ad6b3 100644
@@ -3496,6 +3496,19 @@ static X86CPUDefinition builtin_x86_defs[] = {
                      { /* end of list */ }
                  },
              },
+            {
+                .version = 3,
+                .props = (PropValue[]) {
+                    { "arch-capabilities", "on" },
+                    { "rdctl-no", "on" },
+                    { "ibrs-all", "on" },
+                    { "skip-l1dfl-vmentry", "on" },
+                    { "mds-no", "on" },
+                    { "pschange-mc-no", "on" },
+                    { "taa-no", "on" },
+                    { /* end of list */ }
+                },
+            },
              { /* end of list */ }
          }
      },
--

2.20.1

author
#4 lore raw
Quoted 9 lines · Tao Xu

Hi Xiaoyao,

May be you can add .note for this new version.

for example:

+                .version = 3,
+                .note = "ARCH_CAPABILITIES",
+                .props = (PropValue[]) {

Hi Paolo and Eduardo,

Need I spin a new version to add the .note ?
Maybe you can add it when queue?

Thanks,
-Xiaoyao

Quoted 42 lines · Xiaoyao Li
Quoted 41 lines

Current Icelake-Server CPU model lacks all the features enumerated by MSR_IA32_ARCH_CAPABILITIES.

Add them, so that guest of "Icelake-Server" can see all of them.

---
v2:
  - Add it as a new version.
---
  target/i386/cpu.c | 13 +++++++++++++

  1 file changed, 13 insertions(+)
target/i386/cpu.c +13 -0
index 92fafa265914..5fba6a2ad6b3 100644
@@ -3496,6 +3496,19 @@ static X86CPUDefinition builtin_x86_defs[] = {
                       { /* end of list */ }
                   },
               },
+            {
+                .version = 3,
+                .props = (PropValue[]) {
+                    { "arch-capabilities", "on" },
+                    { "rdctl-no", "on" },
+                    { "ibrs-all", "on" },
+                    { "skip-l1dfl-vmentry", "on" },
+                    { "mds-no", "on" },
+                    { "pschange-mc-no", "on" },
+                    { "taa-no", "on" },
+                    { /* end of list */ }
+                },
+            },
               { /* end of list */ }
           }
       },
Signature · 1 line
2.20.1
#5 lore raw
Quoted 7 lines · Xiaoyao Li
Quoted 6 lines · Tao Xu

Hi Xiaoyao,

May be you can add .note for this new version.

for example:

Quoted 8 lines
Quoted 3 lines

+                .version = 3,
+                .note = "ARCH_CAPABILITIES",
+                .props = (PropValue[]) {

Hi Paolo and Eduardo,

Need I spin a new version to add the .note ?
Maybe you can add it when queue?

Please send a follow up patch so we don't hold a bug fix because of something that's just cosmetic. I will queue this patch. We still need a new version of "target/i386: Add notes for versioned CPU models"[1], don't we?

[1] https://lore.kernel.org/qemu-devel/[email protected]/

Signature · 1 line
Eduardo
#6 lore raw
Quoted 17 lines · Eduardo Habkost
Quoted 7 lines · Xiaoyao Li
Quoted 6 lines · Tao Xu

Hi Xiaoyao,

May be you can add .note for this new version.

for example:

Quoted 8 lines
Quoted 3 lines

+                .version = 3,
+                .note = "ARCH_CAPABILITIES",
+                .props = (PropValue[]) {

Hi Paolo and Eduardo,

Need I spin a new version to add the .note ?
Maybe you can add it when queue?

Quoted 7 lines

Please send a follow up patch so we don't hold a bug fix because of something that's just cosmetic. I will queue this patch. We still need a new version of "target/i386: Add notes for versioned CPU models"[1], don't we?

[1] https://lore.kernel.org/qemu-devel/[email protected]/

I am sorry for misunderstanding your comments in that patch[1]. I will submit a new version of this patch.