| 1516 | #define CPUID_ACPI (1 << 22) |
| 1517 | |
| 1518 | static void kvm_set_cpuid(PCMachine *s) |
| 1519 | { |
| 1520 | struct kvm_cpuid2 *kvm_cpuid; |
| 1521 | int n_ent_max, i; |
| 1522 | struct kvm_cpuid_entry2 *ent; |
| 1523 | |
| 1524 | n_ent_max = 128; |
| 1525 | kvm_cpuid = mallocz(sizeof(struct kvm_cpuid2) + n_ent_max * sizeof(kvm_cpuid->entries[0])); |
| 1526 | |
| 1527 | kvm_cpuid->nent = n_ent_max; |
| 1528 | if (ioctl(s->kvm_fd, KVM_GET_SUPPORTED_CPUID, kvm_cpuid) < 0) { |
| 1529 | perror("KVM_GET_SUPPORTED_CPUID"); |
| 1530 | exit(1); |
| 1531 | } |
| 1532 | |
| 1533 | for(i = 0; i < kvm_cpuid->nent; i++) { |
| 1534 | ent = &kvm_cpuid->entries[i]; |
| 1535 | /* remove the APIC & ACPI to be in sync with the emulator */ |
| 1536 | if (ent->function == 1 || ent->function == 0x80000001) { |
| 1537 | ent->edx &= ~(CPUID_APIC | CPUID_ACPI); |
| 1538 | } |
| 1539 | } |
| 1540 | |
| 1541 | if (ioctl(s->vcpu_fd, KVM_SET_CPUID2, kvm_cpuid) < 0) { |
| 1542 | perror("KVM_SET_CPUID2"); |
| 1543 | exit(1); |
| 1544 | } |
| 1545 | free(kvm_cpuid); |
| 1546 | } |
| 1547 | |
| 1548 | /* XXX: should check overlapping mappings */ |
| 1549 | static void kvm_map_ram(PhysMemoryMap *mem_map, PhysMemoryRange *pr) |