Commit 611c120f authored by Yang, Wei Y's avatar Yang, Wei Y Committed by Avi Kivity

KVM: Mask function7 ebx against host capability word9

This patch masks CPUID leaf 7 ebx against host capability word9.
Signed-off-by: default avatarYang, Wei <wei.y.yang@intel.com>
Signed-off-by: default avatarShan, Haitao <haitao.shan@intel.com>
Signed-off-by: default avatarLi, Xin <xin.li@intel.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent c68b734f
...@@ -2359,6 +2359,10 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, ...@@ -2359,6 +2359,10 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
F(ACE2) | F(ACE2_EN) | F(PHE) | F(PHE_EN) | F(ACE2) | F(ACE2_EN) | F(PHE) | F(PHE_EN) |
F(PMM) | F(PMM_EN); F(PMM) | F(PMM_EN);
/* cpuid 7.0.ebx */
const u32 kvm_supported_word9_x86_features =
F(SMEP);
/* all calls to cpuid_count() should be made on the same cpu */ /* all calls to cpuid_count() should be made on the same cpu */
get_cpu(); get_cpu();
do_cpuid_1_ent(entry, function, index); do_cpuid_1_ent(entry, function, index);
...@@ -2393,7 +2397,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, ...@@ -2393,7 +2397,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
} }
break; break;
} }
/* function 4 and 0xb have additional index. */ /* function 4 has additional index. */
case 4: { case 4: {
int i, cache_type; int i, cache_type;
...@@ -2410,8 +2414,22 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, ...@@ -2410,8 +2414,22 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
} }
break; break;
} }
case 7: {
entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
/* Mask ebx against host capbability word 9 */
if (index == 0) {
entry->ebx &= kvm_supported_word9_x86_features;
cpuid_mask(&entry->ebx, 9);
} else
entry->ebx = 0;
entry->eax = 0;
entry->ecx = 0;
entry->edx = 0;
break;
}
case 9: case 9:
break; break;
/* function 0xb has additional index. */
case 0xb: { case 0xb: {
int i, level_type; int i, level_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment