[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1/2] x86/viridian: Time Reference Count MSR
This viridian MSR is a read-only source of time (in units of 100ns) since the domain started. From: Paul Durrant <paul.durrant@xxxxxxxxxx> Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CC: Keir Fraser <keir@xxxxxxx> CC: Jan Beulich <JBeulich@xxxxxxxx> --- --- xen/arch/x86/hvm/viridian.c | 24 ++++++++++++++++-------- xen/include/asm-x86/perfc_defn.h | 1 + 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/hvm/viridian.c b/xen/arch/x86/hvm/viridian.c index a6721c3..f363037 100644 --- a/xen/arch/x86/hvm/viridian.c +++ b/xen/arch/x86/hvm/viridian.c @@ -17,13 +17,14 @@ #include <public/hvm/hvm_op.h> /* Viridian MSR numbers. */ -#define VIRIDIAN_MSR_GUEST_OS_ID 0x40000000 -#define VIRIDIAN_MSR_HYPERCALL 0x40000001 -#define VIRIDIAN_MSR_VP_INDEX 0x40000002 -#define VIRIDIAN_MSR_EOI 0x40000070 -#define VIRIDIAN_MSR_ICR 0x40000071 -#define VIRIDIAN_MSR_TPR 0x40000072 -#define VIRIDIAN_MSR_APIC_ASSIST 0x40000073 +#define VIRIDIAN_MSR_GUEST_OS_ID 0x40000000 +#define VIRIDIAN_MSR_HYPERCALL 0x40000001 +#define VIRIDIAN_MSR_VP_INDEX 0x40000002 +#define VIRIDIAN_MSR_TIME_REF_COUNT 0x40000020 +#define VIRIDIAN_MSR_EOI 0x40000070 +#define VIRIDIAN_MSR_ICR 0x40000071 +#define VIRIDIAN_MSR_TPR 0x40000072 +#define VIRIDIAN_MSR_APIC_ASSIST 0x40000073 /* Viridian Hypercall Status Codes. */ #define HV_STATUS_SUCCESS 0x0000 @@ -33,6 +34,7 @@ #define HvNotifyLongSpinWait 8 /* Viridian CPUID 4000003, Viridian MSR availability. */ +#define CPUID3A_MSR_REF_COUNT (1 << 1) #define CPUID3A_MSR_APIC_ACCESS (1 << 4) #define CPUID3A_MSR_HYPERCALL (1 << 5) #define CPUID3A_MSR_VP_INDEX (1 << 6) @@ -83,7 +85,8 @@ int cpuid_viridian_leaves(unsigned int leaf, unsigned int *eax, break; case 3: /* Which hypervisor MSRs are available to the guest */ - *eax = (CPUID3A_MSR_APIC_ACCESS | + *eax = (CPUID3A_MSR_REF_COUNT | + CPUID3A_MSR_APIC_ACCESS | CPUID3A_MSR_HYPERCALL | CPUID3A_MSR_VP_INDEX); break; @@ -305,6 +308,11 @@ int rdmsr_viridian_regs(uint32_t idx, uint64_t *val) *val = v->vcpu_id; break; + case VIRIDIAN_MSR_TIME_REF_COUNT: + perfc_incr(mshv_rdmsr_time_ref_count); + *val = hvm_get_guest_time(v) / 100; + break; + case VIRIDIAN_MSR_ICR: perfc_incr(mshv_rdmsr_icr); *val = (((uint64_t)vlapic_get_reg(vcpu_vlapic(v), APIC_ICR2) << 32) | diff --git a/xen/include/asm-x86/perfc_defn.h b/xen/include/asm-x86/perfc_defn.h index 5eaa417..bd251f5 100644 --- a/xen/include/asm-x86/perfc_defn.h +++ b/xen/include/asm-x86/perfc_defn.h @@ -118,6 +118,7 @@ PERFCOUNTER(mshv_call_long_wait, "MS Hv Notify long wait") PERFCOUNTER(mshv_rdmsr_osid, "MS Hv rdmsr Guest OS ID") PERFCOUNTER(mshv_rdmsr_hc_page, "MS Hv rdmsr hypercall page") PERFCOUNTER(mshv_rdmsr_vp_index, "MS Hv rdmsr vp index") +PERFCOUNTER(mshv_rdmsr_time_ref_count, "MS Hv rdmsr time reference count") PERFCOUNTER(mshv_rdmsr_icr, "MS Hv rdmsr icr") PERFCOUNTER(mshv_rdmsr_tpr, "MS Hv rdmsr tpr") PERFCOUNTER(mshv_rdmsr_apic_assist, "MS Hv rdmsr APIC assist") -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |