x86/VPMU: Initialize VPMU's lvtpc vector
authorBoris Ostrovsky <boris.ostrovsky@oracle.com>
Tue, 24 Nov 2015 17:33:08 +0000 (18:33 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 24 Nov 2015 17:33:08 +0000 (18:33 +0100)
If a guest sets up performance counters so that they can generate
a PMC interrupt but does not initilaize APIC LVTPC register the
resulting interrupt will cause an APIC error.

Note that a guest deciding to clear LVTPC in order to unduce the error
will not be successful in achieving its goal: emulation code only
looks at the mask bit and always sets the vector to PMU_APIC_VECTOR.
Only the initial value of LVTPC (which is zero) that gets loaded into
APIC as result of PMC initialization is the problem.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
xen/arch/x86/cpu/vpmu.c

index 2f5156a7a07093ab08bb4508cd8596d4115a236d..d870dccf1b5e14698b075b91d3becb8a3d8bcae8 100644 (file)
@@ -480,6 +480,8 @@ void vpmu_initialise(struct vcpu *v)
         return; /* Don't bother restoring vpmu_count, VPMU is off forever */
     }
 
+    vpmu->hw_lapic_lvtpc = PMU_APIC_VECTOR | APIC_LVT_MASKED;
+
     if ( ret )
         printk(XENLOG_G_WARNING "VPMU: Initialization failed for %pv\n", v);