| .. | .. |
|---|
| 491 | 491 | !boot_cpu_has(X86_FEATURE_AMD_SSBD)) |
|---|
| 492 | 492 | kvm_cpu_cap_set(X86_FEATURE_VIRT_SSBD); |
|---|
| 493 | 493 | |
|---|
| 494 | + if (cpu_feature_enabled(X86_FEATURE_SRSO_NO)) |
|---|
| 495 | + kvm_cpu_cap_set(X86_FEATURE_SRSO_NO); |
|---|
| 496 | + |
|---|
| 494 | 497 | /* |
|---|
| 495 | 498 | * Hide all SVM features by default, SVM will set the cap bits for |
|---|
| 496 | 499 | * features it emulates and/or exposes for L1. |
|---|
| .. | .. |
|---|
| 511 | 514 | int nent; |
|---|
| 512 | 515 | }; |
|---|
| 513 | 516 | |
|---|
| 514 | | -static struct kvm_cpuid_entry2 *do_host_cpuid(struct kvm_cpuid_array *array, |
|---|
| 515 | | - u32 function, u32 index) |
|---|
| 517 | +static struct kvm_cpuid_entry2 *get_next_cpuid(struct kvm_cpuid_array *array) |
|---|
| 516 | 518 | { |
|---|
| 517 | | - struct kvm_cpuid_entry2 *entry; |
|---|
| 518 | | - |
|---|
| 519 | 519 | if (array->nent >= array->maxnent) |
|---|
| 520 | 520 | return NULL; |
|---|
| 521 | 521 | |
|---|
| 522 | | - entry = &array->entries[array->nent++]; |
|---|
| 522 | + return &array->entries[array->nent++]; |
|---|
| 523 | +} |
|---|
| 524 | + |
|---|
| 525 | +static struct kvm_cpuid_entry2 *do_host_cpuid(struct kvm_cpuid_array *array, |
|---|
| 526 | + u32 function, u32 index) |
|---|
| 527 | +{ |
|---|
| 528 | + struct kvm_cpuid_entry2 *entry = get_next_cpuid(array); |
|---|
| 529 | + |
|---|
| 530 | + if (!entry) |
|---|
| 531 | + return NULL; |
|---|
| 523 | 532 | |
|---|
| 524 | 533 | entry->function = function; |
|---|
| 525 | 534 | entry->index = index; |
|---|
| .. | .. |
|---|
| 698 | 707 | entry->edx = edx.full; |
|---|
| 699 | 708 | break; |
|---|
| 700 | 709 | } |
|---|
| 701 | | - /* |
|---|
| 702 | | - * Per Intel's SDM, the 0x1f is a superset of 0xb, |
|---|
| 703 | | - * thus they can be handled by common code. |
|---|
| 704 | | - */ |
|---|
| 705 | 710 | case 0x1f: |
|---|
| 706 | 711 | case 0xb: |
|---|
| 707 | 712 | /* |
|---|
| 708 | | - * Populate entries until the level type (ECX[15:8]) of the |
|---|
| 709 | | - * previous entry is zero. Note, CPUID EAX.{0x1f,0xb}.0 is |
|---|
| 710 | | - * the starting entry, filled by the primary do_host_cpuid(). |
|---|
| 713 | + * No topology; a valid topology is indicated by the presence |
|---|
| 714 | + * of subleaf 1. |
|---|
| 711 | 715 | */ |
|---|
| 712 | | - for (i = 1; entry->ecx & 0xff00; ++i) { |
|---|
| 713 | | - entry = do_host_cpuid(array, function, i); |
|---|
| 714 | | - if (!entry) |
|---|
| 715 | | - goto out; |
|---|
| 716 | | - } |
|---|
| 716 | + entry->eax = entry->ebx = entry->ecx = 0; |
|---|
| 717 | 717 | break; |
|---|
| 718 | 718 | case 0xd: |
|---|
| 719 | 719 | entry->eax &= supported_xcr0; |
|---|
| .. | .. |
|---|
| 866 | 866 | entry->ebx = entry->ecx = entry->edx = 0; |
|---|
| 867 | 867 | break; |
|---|
| 868 | 868 | case 0x8000001e: |
|---|
| 869 | + /* Do not return host topology information. */ |
|---|
| 870 | + entry->eax = entry->ebx = entry->ecx = 0; |
|---|
| 871 | + entry->edx = 0; /* reserved */ |
|---|
| 869 | 872 | break; |
|---|
| 870 | 873 | /* Support memory encryption cpuid if host supports it */ |
|---|
| 871 | 874 | case 0x8000001F: |
|---|