Export a routine to provide the TSC_AUX MSR value and use this in vmm.
Also, drop an unnecessary set of braces. Requested by: kib Reviewed by: kib MFC after: 3 weeks
This commit is contained in:
parent
09f515da61
commit
3a3f1e9dfa
@ -217,6 +217,15 @@ init_via(void)
|
||||
wrmsr(0x1107, rdmsr(0x1107) | (1 << 28));
|
||||
}
|
||||
|
||||
/*
|
||||
* The value for the TSC_AUX MSR and rdtscp/rdpid.
|
||||
*/
|
||||
u_int
|
||||
cpu_auxmsr(void)
|
||||
{
|
||||
return (PCPU_GET(cpuid));
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize CPU control registers
|
||||
*/
|
||||
@ -283,7 +292,7 @@ initializecpu(void)
|
||||
|
||||
if ((amd_feature & AMDID_RDTSCP) != 0 ||
|
||||
(cpu_stdext_feature2 & CPUID_STDEXT2_RDPID) != 0)
|
||||
wrmsr(MSR_TSC_AUX, PCPU_GET(cpuid));
|
||||
wrmsr(MSR_TSC_AUX, cpu_auxmsr());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -365,9 +365,9 @@ void
|
||||
vmx_msr_guest_enter_tsc_aux(struct vmx *vmx, int vcpuid)
|
||||
{
|
||||
uint64_t guest_tsc_aux = vmx->guest_msrs[vcpuid][IDX_MSR_TSC_AUX];
|
||||
uint32_t cpuid = PCPU_GET(cpuid);
|
||||
uint32_t host_aux = cpu_auxmsr();
|
||||
|
||||
if (vmx_have_msr_tsc_aux(vmx) && (guest_tsc_aux != cpuid))
|
||||
if (vmx_have_msr_tsc_aux(vmx) && guest_tsc_aux != host_aux)
|
||||
wrmsr(MSR_TSC_AUX, guest_tsc_aux);
|
||||
}
|
||||
|
||||
@ -396,9 +396,9 @@ void
|
||||
vmx_msr_guest_exit_tsc_aux(struct vmx *vmx, int vcpuid)
|
||||
{
|
||||
uint64_t guest_tsc_aux = vmx->guest_msrs[vcpuid][IDX_MSR_TSC_AUX];
|
||||
uint32_t cpuid = PCPU_GET(cpuid);
|
||||
uint32_t host_aux = cpu_auxmsr();
|
||||
|
||||
if (vmx_have_msr_tsc_aux(vmx) && (guest_tsc_aux != cpuid))
|
||||
if (vmx_have_msr_tsc_aux(vmx) && guest_tsc_aux != host_aux)
|
||||
/*
|
||||
* Note that it is not necessary to save the guest value
|
||||
* here; vmx->guest_msrs[vcpuid][IDX_MSR_TSC_AUX] always
|
||||
@ -406,7 +406,7 @@ vmx_msr_guest_exit_tsc_aux(struct vmx *vmx, int vcpuid)
|
||||
* the guest writes to it (which is expected to be very
|
||||
* rare).
|
||||
*/
|
||||
wrmsr(MSR_TSC_AUX, cpuid);
|
||||
wrmsr(MSR_TSC_AUX, host_aux);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -627,6 +627,15 @@ init_transmeta(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The value for the TSC_AUX MSR and rdtscp/rdpid.
|
||||
*/
|
||||
u_int
|
||||
cpu_auxmsr(void)
|
||||
{
|
||||
return (PCPU_GET(cpuid));
|
||||
}
|
||||
|
||||
extern int elf32_nxstack;
|
||||
|
||||
void
|
||||
@ -751,7 +760,7 @@ initializecpu(void)
|
||||
}
|
||||
if ((amd_feature & AMDID_RDTSCP) != 0 ||
|
||||
(cpu_stdext_feature2 & CPUID_STDEXT2_RDPID) != 0)
|
||||
wrmsr(MSR_TSC_AUX, PCPU_GET(cpuid));
|
||||
wrmsr(MSR_TSC_AUX, cpu_auxmsr());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -115,6 +115,7 @@ typedef void alias_for_inthand_t(void);
|
||||
bool acpi_get_fadt_bootflags(uint16_t *flagsp);
|
||||
void *alloc_fpusave(int flags);
|
||||
void busdma_swi(void);
|
||||
u_int cpu_auxmsr(void);
|
||||
vm_paddr_t cpu_getmaxphyaddr(void);
|
||||
bool cpu_mwait_usable(void);
|
||||
void cpu_probe_amdc1e(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user