Deleted Added
full compact
26c26
< * $FreeBSD: stable/10/sys/amd64/vmm/x86.c 276349 2014-12-28 21:27:13Z neel $
---
> * $FreeBSD: stable/10/sys/amd64/vmm/x86.c 276403 2014-12-30 08:24:14Z neel $
30c30
< __FBSDID("$FreeBSD: stable/10/sys/amd64/vmm/x86.c 276349 2014-12-28 21:27:13Z neel $");
---
> __FBSDID("$FreeBSD: stable/10/sys/amd64/vmm/x86.c 276403 2014-12-30 08:24:14Z neel $");
46a47,48
> #include "vmm_ktr.h"
> #include "vmm_util.h"
56a59,60
> SYSCTL_ULONG(_hw_vmm, OID_AUTO, bhyve_xcpuids, CTLFLAG_RW, &bhyve_xcpuids, 0,
> "Number of times an unknown cpuid leaf was accessed");
93a98,99
> VCPU_CTR2(vm, vcpu_id, "cpuid %#x,%#x", *eax, *ecx);
>
126a133,134
> cpuid_count(*eax, *ecx, regs);
> break;
128a137,150
> if (vmm_is_amd()) {
> /*
> * XXX this might appear silly because AMD
> * cpus don't have threads.
> *
> * However this matches the logical cpus as
> * advertised by leaf 0x1 and will work even
> * if the 'threads_per_core' tunable is set
> * incorrectly on an AMD host.
> */
> logical_cpus = threads_per_core *
> cores_per_package;
> regs[2] = logical_cpus - 1;
> }
131a154,155
> cpuid_count(*eax, *ecx, regs);
>
132a157,180
> * Hide SVM and Topology Extension features from guest.
> */
> regs[2] &= ~(AMDID2_SVM | AMDID2_TOPOLOGY);
>
> /*
> * Don't advertise extended performance counter MSRs
> * to the guest.
> */
> regs[2] &= ~AMDID2_PCXC;
> regs[2] &= ~AMDID2_PNXC;
> regs[2] &= ~AMDID2_PTSCEL2I;
>
> /*
> * Don't advertise Instruction Based Sampling feature.
> */
> regs[2] &= ~AMDID2_IBS;
>
> /* NodeID MSR not available */
> regs[2] &= ~AMDID2_NODE_ID;
>
> /* Don't advertise the OS visible workaround feature */
> regs[2] &= ~AMDID2_OSVW;
>
> /*
136d183
< cpuid_count(*eax, *ecx, regs);
141d187
< cpuid_count(*eax, *ecx, regs);
143,145c189,192
< * If the host TSCs are not synchronized across
< * physical cpus then we cannot advertise an
< * invariant tsc to a vcpu.
---
> * AMD uses this leaf to advertise the processor's
> * power monitoring and RAS capabilities. These
> * features are hardware-specific and exposing
> * them to a guest doesn't make a lot of sense.
146a194,207
> * Intel uses this leaf only to advertise the
> * "Invariant TSC" feature with all other bits
> * being reserved (set to zero).
> */
> regs[0] = 0;
> regs[1] = 0;
> regs[2] = 0;
> regs[3] = 0;
>
> /*
> * "Invariant TSC" can be advertised to the guest if:
> * - host TSC frequency is invariant
> * - host TSCs are synchronized across physical cpus
> *
153,154c214,215
< if (!smp_tsc)
< regs[3] &= ~AMDPM_TSC_INVARIANT;
---
> if (tsc_is_invariant && smp_tsc)
> regs[3] |= AMDPM_TSC_INVARIANT;