|
16 | 16 | #include <linux/export.h> |
17 | 17 | #include <linux/vmalloc.h> |
18 | 18 | #include <linux/uaccess.h> |
| 19 | +#include <asm/processor.h> |
19 | 20 | #include <asm/fpu/internal.h> /* For use_eager_fpu. Ugh! */ |
20 | 21 | #include <asm/user.h> |
21 | 22 | #include <asm/fpu/xstate.h> |
@@ -65,6 +66,11 @@ u64 kvm_supported_xcr0(void) |
65 | 66 |
|
66 | 67 | #define F(x) bit(X86_FEATURE_##x) |
67 | 68 |
|
| 69 | +/* These are scattered features in cpufeatures.h. */ |
| 70 | +#define KVM_CPUID_BIT_AVX512_4VNNIW 2 |
| 71 | +#define KVM_CPUID_BIT_AVX512_4FMAPS 3 |
| 72 | +#define KF(x) bit(KVM_CPUID_BIT_##x) |
| 73 | + |
68 | 74 | int kvm_update_cpuid(struct kvm_vcpu *vcpu) |
69 | 75 | { |
70 | 76 | struct kvm_cpuid_entry2 *best; |
@@ -376,6 +382,10 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, |
376 | 382 | /* cpuid 7.0.ecx*/ |
377 | 383 | const u32 kvm_cpuid_7_0_ecx_x86_features = F(PKU) | 0 /*OSPKE*/; |
378 | 384 |
|
| 385 | + /* cpuid 7.0.edx*/ |
| 386 | + const u32 kvm_cpuid_7_0_edx_x86_features = |
| 387 | + KF(AVX512_4VNNIW) | KF(AVX512_4FMAPS); |
| 388 | + |
379 | 389 | /* all calls to cpuid_count() should be made on the same cpu */ |
380 | 390 | get_cpu(); |
381 | 391 |
|
@@ -458,12 +468,14 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, |
458 | 468 | /* PKU is not yet implemented for shadow paging. */ |
459 | 469 | if (!tdp_enabled) |
460 | 470 | entry->ecx &= ~F(PKU); |
| 471 | + entry->edx &= kvm_cpuid_7_0_edx_x86_features; |
| 472 | + entry->edx &= get_scattered_cpuid_leaf(7, 0, CPUID_EDX); |
461 | 473 | } else { |
462 | 474 | entry->ebx = 0; |
463 | 475 | entry->ecx = 0; |
| 476 | + entry->edx = 0; |
464 | 477 | } |
465 | 478 | entry->eax = 0; |
466 | | - entry->edx = 0; |
467 | 479 | break; |
468 | 480 | } |
469 | 481 | case 9: |
|
0 commit comments