VMX: allow RTM advanced debugging to be used by guests
authorJan Beulich <jbeulich@suse.com>
Fri, 22 Aug 2014 12:31:18 +0000 (14:31 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 22 Aug 2014 12:31:18 +0000 (14:31 +0200)
All that is needed here is allowing the respective DebugCtl MSR bit to
be set by the guest.

At once - even if PV guests can't currently use it due to missing
DebugCtl MSR virtualization - make the respective adjustments to
debugreg.h.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
xen/arch/x86/hvm/vmx/vmx.c
xen/include/asm-x86/debugreg.h
xen/include/asm-x86/msr-index.h

index f2496c4a5765f4ad69920e2c8b2220c7b4e876b6..dc18a7268b5bc1af15c41187fba14b9a067463ef 100644 (file)
@@ -2246,6 +2246,8 @@ static int vmx_msr_write_intercept(unsigned int msr, uint64_t msr_content)
         int i, rc = 0;
         uint64_t supported = IA32_DEBUGCTLMSR_LBR | IA32_DEBUGCTLMSR_BTF;
 
+        if ( boot_cpu_has(X86_FEATURE_RTM) )
+            supported |= IA32_DEBUGCTLMSR_RTM;
         if ( msr_content & ~supported )
         {
             /* Perhaps some other bits are supported in vpmu. */
index 62007bb8eb6ecf2bc7d6f093d249c989a50e074e..a5b28383912e93ec3be9b1784cee509de3581392 100644 (file)
@@ -20,6 +20,7 @@
 #define DR_TRAP3        (0x8)           /* db3 */
 #define DR_STEP         (0x4000)        /* single-step */
 #define DR_SWITCH       (0x8000)        /* task switch */
+#define DR_NOT_RTM      (0x10000)       /* clear: #BP inside RTM region */
 
 /* Now define a bunch of things for manipulating the control register.
    The top two bytes of the control register consist of 4 fields of 4
@@ -62,6 +63,7 @@
 #define DR_CONTROL_RESERVED_ONE  (0x00000400ul) /* Reserved, read as one */
 #define DR_LOCAL_EXACT_ENABLE    (0x00000100ul) /* Local exact enable */
 #define DR_GLOBAL_EXACT_ENABLE   (0x00000200ul) /* Global exact enable */
+#define DR_RTM_ENABLE            (0x00000800ul) /* RTM debugging enable */
 #define DR_GENERAL_DETECT        (0x00002000ul) /* General detect enable */
 
 #define write_debugreg(reg, val) do {                       \
index 7247497ab4e937f81c69fd1f5480519bc0902b6c..da732b775da1b03207c23d425bc40923d305a4c1 100644 (file)
@@ -79,6 +79,7 @@
 #define IA32_DEBUGCTLMSR_BTINT         (1<<8) /* Branch Trace Interrupt */
 #define IA32_DEBUGCTLMSR_BTS_OFF_OS    (1<<9)  /* BTS off if CPL 0 */
 #define IA32_DEBUGCTLMSR_BTS_OFF_USR   (1<<10) /* BTS off if CPL > 0 */
+#define IA32_DEBUGCTLMSR_RTM           (1<<15) /* RTM debugging enable */
 
 #define MSR_IA32_LASTBRANCHFROMIP      0x000001db
 #define MSR_IA32_LASTBRANCHTOIP                0x000001dc