|
19 | 19 | #define KERNEL_DS 0x10
|
20 | 20 | #define KERNEL_TSS 0x18
|
21 | 21 |
|
22 |
| -#define MAX_NR_CPUID_ENTRIES 100 |
23 |
| - |
24 | 22 | vm_vaddr_t exception_handlers;
|
25 | 23 | bool host_cpu_is_amd;
|
26 | 24 | bool host_cpu_is_intel;
|
@@ -1195,65 +1193,6 @@ void xen_hypercall(uint64_t nr, uint64_t a0, void *a1)
|
1195 | 1193 | GUEST_ASSERT(!__xen_hypercall(nr, a0, a1));
|
1196 | 1194 | }
|
1197 | 1195 |
|
1198 |
| -const struct kvm_cpuid2 *kvm_get_supported_hv_cpuid(void) |
1199 |
| -{ |
1200 |
| - static struct kvm_cpuid2 *cpuid; |
1201 |
| - int kvm_fd; |
1202 |
| - |
1203 |
| - if (cpuid) |
1204 |
| - return cpuid; |
1205 |
| - |
1206 |
| - cpuid = allocate_kvm_cpuid2(MAX_NR_CPUID_ENTRIES); |
1207 |
| - kvm_fd = open_kvm_dev_path_or_exit(); |
1208 |
| - |
1209 |
| - kvm_ioctl(kvm_fd, KVM_GET_SUPPORTED_HV_CPUID, cpuid); |
1210 |
| - |
1211 |
| - close(kvm_fd); |
1212 |
| - return cpuid; |
1213 |
| -} |
1214 |
| - |
1215 |
| -void vcpu_set_hv_cpuid(struct kvm_vcpu *vcpu) |
1216 |
| -{ |
1217 |
| - static struct kvm_cpuid2 *cpuid_full; |
1218 |
| - const struct kvm_cpuid2 *cpuid_sys, *cpuid_hv; |
1219 |
| - int i, nent = 0; |
1220 |
| - |
1221 |
| - if (!cpuid_full) { |
1222 |
| - cpuid_sys = kvm_get_supported_cpuid(); |
1223 |
| - cpuid_hv = kvm_get_supported_hv_cpuid(); |
1224 |
| - |
1225 |
| - cpuid_full = allocate_kvm_cpuid2(cpuid_sys->nent + cpuid_hv->nent); |
1226 |
| - if (!cpuid_full) { |
1227 |
| - perror("malloc"); |
1228 |
| - abort(); |
1229 |
| - } |
1230 |
| - |
1231 |
| - /* Need to skip KVM CPUID leaves 0x400000xx */ |
1232 |
| - for (i = 0; i < cpuid_sys->nent; i++) { |
1233 |
| - if (cpuid_sys->entries[i].function >= 0x40000000 && |
1234 |
| - cpuid_sys->entries[i].function < 0x40000100) |
1235 |
| - continue; |
1236 |
| - cpuid_full->entries[nent] = cpuid_sys->entries[i]; |
1237 |
| - nent++; |
1238 |
| - } |
1239 |
| - |
1240 |
| - memcpy(&cpuid_full->entries[nent], cpuid_hv->entries, |
1241 |
| - cpuid_hv->nent * sizeof(struct kvm_cpuid_entry2)); |
1242 |
| - cpuid_full->nent = nent + cpuid_hv->nent; |
1243 |
| - } |
1244 |
| - |
1245 |
| - vcpu_init_cpuid(vcpu, cpuid_full); |
1246 |
| -} |
1247 |
| - |
1248 |
| -const struct kvm_cpuid2 *vcpu_get_supported_hv_cpuid(struct kvm_vcpu *vcpu) |
1249 |
| -{ |
1250 |
| - struct kvm_cpuid2 *cpuid = allocate_kvm_cpuid2(MAX_NR_CPUID_ENTRIES); |
1251 |
| - |
1252 |
| - vcpu_ioctl(vcpu, KVM_GET_SUPPORTED_HV_CPUID, cpuid); |
1253 |
| - |
1254 |
| - return cpuid; |
1255 |
| -} |
1256 |
| - |
1257 | 1196 | unsigned long vm_compute_max_gfn(struct kvm_vm *vm)
|
1258 | 1197 | {
|
1259 | 1198 | const unsigned long num_ht_pages = 12 << (30 - vm->page_shift); /* 12 GiB */
|
|
0 commit comments