Commit 671e4676076fb62860986decd44440d97bcc872d

Authored by Andre Przywara
Committed by Anthony Liguori
1 parent 6c1f42fe

remove CPUID host hacks

KVM provides an in-kernel feature to disable CPUID bits that are not
present in the current host. So there is no need here to duplicate this
work. Additionally allows 3DNow! on capable processors, since the
restriction seems to apply to QEMU/TCG only.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing 1 changed file with 5 additions and 22 deletions
target-i386/helper.c
... ... @@ -1643,28 +1643,11 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
1643 1643 *edx = env->cpuid_ext2_features;
1644 1644  
1645 1645 if (kvm_enabled()) {
1646   - uint32_t h_eax, h_edx;
1647   -
1648   - host_cpuid(index, 0, &h_eax, NULL, NULL, &h_edx);
1649   -
1650   - /* disable CPU features that the host does not support */
1651   -
1652   - /* long mode */
1653   - if ((h_edx & 0x20000000) == 0 /* || !lm_capable_kernel */)
1654   - *edx &= ~0x20000000;
1655   - /* syscall */
1656   - if ((h_edx & 0x00000800) == 0)
1657   - *edx &= ~0x00000800;
1658   - /* nx */
1659   - if ((h_edx & 0x00100000) == 0)
1660   - *edx &= ~0x00100000;
1661   -
1662   - /* disable CPU features that KVM cannot support */
1663   -
1664   - /* svm */
1665   - *ecx &= ~4UL;
1666   - /* 3dnow */
1667   - *edx &= ~0xc0000000;
  1646 + /* Nested SVM not yet supported in KVM */
  1647 + *ecx &= ~CPUID_EXT3_SVM;
  1648 + } else {
  1649 + /* AMD 3DNow! is not supported in QEMU */
  1650 + *edx &= ~(CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT);
1668 1651 }
1669 1652 break;
1670 1653 case 0x80000002:
... ...