Commit 4c44e8d6 authored by Babu Moger's avatar Babu Moger Committed by Paolo Bonzini

KVM: SVM: Add new intercept word in vmcb_control_area

The new intercept bits have been added in vmcb control area to support
few more interceptions. Here are the some of them.
 - INTERCEPT_INVLPGB,
 - INTERCEPT_INVLPGB_ILLEGAL,
 - INTERCEPT_INVPCID,
 - INTERCEPT_MCOMMIT,
 - INTERCEPT_TLBSYNC,

Add a new intercept word in vmcb_control_area to support these instructions.
Also update kvm_nested_vmrun trace function to support the new addition.

AMD documentation for these instructions is available at "AMD64
Architecture Programmer’s Manual Volume 2: System Programming, Pub. 24593
Rev. 3.34(or later)"

The documentation can be obtained at the links below:
Link: https://www.amd.com/system/files/TechDocs/24593.pdf
Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537Signed-off-by: default avatarBabu Moger <babu.moger@amd.com>
Reviewed-by: default avatarJim Mattson <jmattson@google.com>
Message-Id: <159985251547.11252.16994139329949066945.stgit@bmoger-ubuntu>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent c62e2e94
...@@ -16,6 +16,7 @@ enum intercept_words { ...@@ -16,6 +16,7 @@ enum intercept_words {
INTERCEPT_EXCEPTION, INTERCEPT_EXCEPTION,
INTERCEPT_WORD3, INTERCEPT_WORD3,
INTERCEPT_WORD4, INTERCEPT_WORD4,
INTERCEPT_WORD5,
MAX_INTERCEPT, MAX_INTERCEPT,
}; };
...@@ -97,6 +98,12 @@ enum { ...@@ -97,6 +98,12 @@ enum {
INTERCEPT_MWAIT_COND, INTERCEPT_MWAIT_COND,
INTERCEPT_XSETBV, INTERCEPT_XSETBV,
INTERCEPT_RDPRU, INTERCEPT_RDPRU,
/* Byte offset 014h (word 5) */
INTERCEPT_INVLPGB = 160,
INTERCEPT_INVLPGB_ILLEGAL,
INTERCEPT_INVPCID,
INTERCEPT_MCOMMIT,
INTERCEPT_TLBSYNC,
}; };
......
...@@ -485,7 +485,8 @@ int nested_svm_vmrun(struct vcpu_svm *svm) ...@@ -485,7 +485,8 @@ int nested_svm_vmrun(struct vcpu_svm *svm)
vmcb12->control.intercepts[INTERCEPT_CR] >> 16, vmcb12->control.intercepts[INTERCEPT_CR] >> 16,
vmcb12->control.intercepts[INTERCEPT_EXCEPTION], vmcb12->control.intercepts[INTERCEPT_EXCEPTION],
vmcb12->control.intercepts[INTERCEPT_WORD3], vmcb12->control.intercepts[INTERCEPT_WORD3],
vmcb12->control.intercepts[INTERCEPT_WORD4]); vmcb12->control.intercepts[INTERCEPT_WORD4],
vmcb12->control.intercepts[INTERCEPT_WORD5]);
/* Clear internal status */ /* Clear internal status */
kvm_clear_exception_queue(&svm->vcpu); kvm_clear_exception_queue(&svm->vcpu);
......
...@@ -544,9 +544,10 @@ TRACE_EVENT(kvm_nested_vmrun, ...@@ -544,9 +544,10 @@ TRACE_EVENT(kvm_nested_vmrun,
); );
TRACE_EVENT(kvm_nested_intercepts, TRACE_EVENT(kvm_nested_intercepts,
TP_PROTO(__u16 cr_read, __u16 cr_write, __u32 exceptions, __u32 intercept1, TP_PROTO(__u16 cr_read, __u16 cr_write, __u32 exceptions,
__u32 intercept2), __u32 intercept1, __u32 intercept2, __u32 intercept3),
TP_ARGS(cr_read, cr_write, exceptions, intercept1, intercept2), TP_ARGS(cr_read, cr_write, exceptions, intercept1,
intercept2, intercept3),
TP_STRUCT__entry( TP_STRUCT__entry(
__field( __u16, cr_read ) __field( __u16, cr_read )
...@@ -554,6 +555,7 @@ TRACE_EVENT(kvm_nested_intercepts, ...@@ -554,6 +555,7 @@ TRACE_EVENT(kvm_nested_intercepts,
__field( __u32, exceptions ) __field( __u32, exceptions )
__field( __u32, intercept1 ) __field( __u32, intercept1 )
__field( __u32, intercept2 ) __field( __u32, intercept2 )
__field( __u32, intercept3 )
), ),
TP_fast_assign( TP_fast_assign(
...@@ -562,12 +564,13 @@ TRACE_EVENT(kvm_nested_intercepts, ...@@ -562,12 +564,13 @@ TRACE_EVENT(kvm_nested_intercepts,
__entry->exceptions = exceptions; __entry->exceptions = exceptions;
__entry->intercept1 = intercept1; __entry->intercept1 = intercept1;
__entry->intercept2 = intercept2; __entry->intercept2 = intercept2;
__entry->intercept3 = intercept3;
), ),
TP_printk("cr_read: %04x cr_write: %04x excp: %08x " TP_printk("cr_read: %04x cr_write: %04x excp: %08x "
"intercepts: %08x %08x", "intercepts: %08x %08x %08x",
__entry->cr_read, __entry->cr_write, __entry->exceptions, __entry->cr_read, __entry->cr_write, __entry->exceptions,
__entry->intercept1, __entry->intercept2) __entry->intercept1, __entry->intercept2, __entry->intercept3)
); );
/* /*
* Tracepoint for #VMEXIT while nested * Tracepoint for #VMEXIT while nested
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment