mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-13 13:56:19 +00:00
hv: pass-thru PMU registers when no PROFILING_ON
Signed-off-by: Min He <min.he@intel.com>
This commit is contained in:
parent
d9d6ab05f0
commit
328c276152
@ -230,8 +230,10 @@ int32_t set_vcpuid_entries(struct acrn_vm *vm)
|
||||
break;
|
||||
|
||||
/* These features are disabled */
|
||||
#ifdef PROFILING_ON
|
||||
/* PMU is not supported */
|
||||
case 0x0aU:
|
||||
#endif /* PROFILING_ON */
|
||||
/* Intel RDT */
|
||||
case 0x0fU:
|
||||
case 0x10U:
|
||||
|
@ -110,6 +110,7 @@ static const uint32_t unsupported_msrs[NUM_UNSUPPORTED_MSRS] = {
|
||||
MSR_SGXOWNEREPOCH0,
|
||||
MSR_SGXOWNEREPOCH1,
|
||||
|
||||
#ifdef PROFILING_ON
|
||||
/* Performance Counters and Events: CPUID.0AH.EAX[15:8] */
|
||||
MSR_IA32_PMC0,
|
||||
MSR_IA32_PMC1,
|
||||
@ -138,6 +139,7 @@ static const uint32_t unsupported_msrs[NUM_UNSUPPORTED_MSRS] = {
|
||||
MSR_IA32_PERF_GLOBAL_OVF_CTRL,
|
||||
MSR_IA32_PERF_GLOBAL_STATUS_SET,
|
||||
MSR_IA32_PERF_GLOBAL_INUSE,
|
||||
#endif /* PROFILING_ON */
|
||||
|
||||
/* QOS Configuration disabled: CPUID.10H.ECX[2] */
|
||||
MSR_IA32_L3_QOS_CFG,
|
||||
|
@ -61,6 +61,14 @@ static int32_t hcall_profiling_ops(struct acrn_vm *vm, uint64_t cmd, uint64_t pa
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static int32_t hcall_profiling_ops(__unused struct acrn_vm *vm, __unused uint64_t cmd, __unused uint64_t param)
|
||||
{
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
#endif /* PROFILING_ON */
|
||||
|
||||
/**
|
||||
|
@ -1446,4 +1446,39 @@ void profiling_setup(void)
|
||||
dev_dbg(ACRN_DBG_PROFILING, "%s: exiting", __func__);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <hypervisor.h>
|
||||
|
||||
void profiling_vmenter_handler(__unused struct acrn_vcpu *vcpu) {}
|
||||
void profiling_pre_vmexit_handler(__unused struct acrn_vcpu *vcpu) {}
|
||||
void profiling_post_vmexit_handler(__unused struct acrn_vcpu *vcpu) {}
|
||||
|
||||
static void pmu_passthru_pmi_handler(__unused uint32_t irq, __unused void *data)
|
||||
{
|
||||
struct acrn_vcpu *vcpu = get_ever_run_vcpu(get_cpu_id());
|
||||
|
||||
msr_write(MSR_IA32_EXT_APIC_LVT_PMI, VECTOR_PMI|LAPIC_LVT_MASK);
|
||||
vlapic_set_local_intr(vcpu->vm, vcpu->vcpu_id, APIC_LVT_PMC);
|
||||
msr_write(MSR_IA32_EXT_APIC_LVT_PMI, VECTOR_PMI);
|
||||
}
|
||||
|
||||
void profiling_setup(void)
|
||||
{
|
||||
uint16_t cpu;
|
||||
int32_t retval;
|
||||
|
||||
cpu = get_cpu_id();
|
||||
if (cpu == BOOT_CPU_ID){
|
||||
retval = request_irq(PMI_IRQ,
|
||||
pmu_passthru_pmi_handler, NULL, IRQF_NONE);
|
||||
if (retval < 0) {
|
||||
pr_err("Failed to add PMI isr");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
msr_write(MSR_IA32_EXT_APIC_LVT_PMI, VECTOR_PMI);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user