Page MenuHomeFreeBSD

D61795.1795271379.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D61795.1795271379.diff

diff --git a/sys/amd64/vmm/intel/vmx.c b/sys/amd64/vmm/intel/vmx.c
--- a/sys/amd64/vmm/intel/vmx.c
+++ b/sys/amd64/vmm/intel/vmx.c
@@ -3330,6 +3330,12 @@
host = true;
}
break;
+ case EXIT_REASON_CR_ACCESS:
+ if ((qual & 0xf) != 8) {
+ host = vmx_nested_cr_exit(vcpu, qual);
+ break;
+ }
+ /* FALLTHROUGH */
case EXIT_REASON_HLT:
case EXIT_REASON_INOUT:
case EXIT_REASON_RDMSR:
@@ -3359,9 +3365,6 @@
case EXIT_REASON_NMI_WINDOW:
host = vmx_nested_window_exit(vcpu, reason);
break;
- case EXIT_REASON_CR_ACCESS:
- host = vmx_nested_cr_exit(vcpu, qual);
- break;
case EXIT_REASON_EPT_FAULT:
/*
* L2 runs on L1's shadow page tables: this is a fault
diff --git a/sys/amd64/vmm/intel/vmx_nested.c b/sys/amd64/vmm/intel/vmx_nested.c
--- a/sys/amd64/vmm/intel/vmx_nested.c
+++ b/sys/amd64/vmm/intel/vmx_nested.c
@@ -135,10 +135,10 @@
#define PINBASED_L1_MAY \
(PINBASED_EXTINT_EXITING | PINBASED_NMI_EXITING | PINBASED_VIRTUAL_NMI)
#define PROCBASED_L1_MUST \
- (PROCBASED_MWAIT_EXITING | PROCBASED_MONITOR_EXITING | \
- PROCBASED_CR8_LOAD_EXITING | PROCBASED_CR8_STORE_EXITING)
+ (PROCBASED_MWAIT_EXITING | PROCBASED_MONITOR_EXITING)
#define PROCBASED_L1_HOST \
- (PROCBASED_HLT_EXITING | PROCBASED_IO_EXITING)
+ (PROCBASED_HLT_EXITING | PROCBASED_IO_EXITING | \
+ PROCBASED_CR8_LOAD_EXITING | PROCBASED_CR8_STORE_EXITING)
#define PROCBASED_L1_MAY \
(PROCBASED_L1_HOST | PROCBASED_IO_BITMAPS | \
PROCBASED_MSR_BITMAPS | \
@@ -1854,6 +1854,11 @@
switch (reason) {
case EXIT_REASON_HLT:
return ((proc & PROCBASED_HLT_EXITING) == 0);
+ case EXIT_REASON_CR_ACCESS:
+ /* MOV to or from CR8: L1's TPR, which the host keeps. */
+ return ((proc & ((qual & 0x10) != 0 ?
+ PROCBASED_CR8_STORE_EXITING :
+ PROCBASED_CR8_LOAD_EXITING)) == 0);
case EXIT_REASON_INOUT:
if ((proc & PROCBASED_IO_BITMAPS) == 0)
return ((proc & PROCBASED_IO_EXITING) == 0);
@@ -1897,10 +1902,11 @@
/*
* L2 has had a VM exit for an access to a control register. The ones for
- * CR3 and CR8 are L1's. One for CR0 or CR4 is L1's if the access changes a
- * bit that L1 owns (SDM 26.1.3). Otherwise the bit is one that the host
- * fixes: the access is done here, and it is a fault where a CPU does not
- * let L2 change the bit either. Returns false if the exit is L1's.
+ * CR3 are L1's; vmx_nested_host_exit() is asked about the ones for CR8. One
+ * for CR0 or CR4 is L1's if the access changes a bit that L1 owns (SDM
+ * 26.1.3). Otherwise the bit is one that the host fixes: the access is done
+ * here, and it is a fault where a CPU does not let L2 change the bit either.
+ * Returns false if the exit is L1's.
*/
bool
vmx_nested_cr_exit(struct vmx_vcpu *vcpu, uint64_t qual)

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 21, 2:29 PM (19 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41890618
Default Alt Text
D61795.1795271379.diff (2 KB)

Event Timeline