aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kvm/x86.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 73d342c69ed4..419c4512e270 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1972,6 +1972,23 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
1972 } 1972 }
1973 break; 1973 break;
1974 } 1974 }
1975 case KVM_CPUID_SIGNATURE: {
1976 char signature[12] = "KVMKVMKVM\0\0";
1977 u32 *sigptr = (u32 *)signature;
1978 entry->eax = 0;
1979 entry->ebx = sigptr[0];
1980 entry->ecx = sigptr[1];
1981 entry->edx = sigptr[2];
1982 break;
1983 }
1984 case KVM_CPUID_FEATURES:
1985 entry->eax = (1 << KVM_FEATURE_CLOCKSOURCE) |
1986 (1 << KVM_FEATURE_NOP_IO_DELAY) |
1987 (1 << KVM_FEATURE_CLOCKSOURCE2);
1988 entry->ebx = 0;
1989 entry->ecx = 0;
1990 entry->edx = 0;
1991 break;
1975 case 0x80000000: 1992 case 0x80000000:
1976 entry->eax = min(entry->eax, 0x8000001a); 1993 entry->eax = min(entry->eax, 0x8000001a);
1977 break; 1994 break;
@@ -2018,6 +2035,23 @@ static int kvm_dev_ioctl_get_supported_cpuid(struct kvm_cpuid2 *cpuid,
2018 for (func = 0x80000001; func <= limit && nent < cpuid->nent; ++func) 2035 for (func = 0x80000001; func <= limit && nent < cpuid->nent; ++func)
2019 do_cpuid_ent(&cpuid_entries[nent], func, 0, 2036 do_cpuid_ent(&cpuid_entries[nent], func, 0,
2020 &nent, cpuid->nent); 2037 &nent, cpuid->nent);
2038
2039
2040
2041 r = -E2BIG;
2042 if (nent >= cpuid->nent)
2043 goto out_free;
2044
2045 do_cpuid_ent(&cpuid_entries[nent], KVM_CPUID_SIGNATURE, 0, &nent,
2046 cpuid->nent);
2047
2048 r = -E2BIG;
2049 if (nent >= cpuid->nent)
2050 goto out_free;
2051
2052 do_cpuid_ent(&cpuid_entries[nent], KVM_CPUID_FEATURES, 0, &nent,
2053 cpuid->nent);
2054
2021 r = -E2BIG; 2055 r = -E2BIG;
2022 if (nent >= cpuid->nent) 2056 if (nent >= cpuid->nent)
2023 goto out_free; 2057 goto out_free;