diff mbox

[16/22] KVM: nVMX: Add VMCS field type enumeration

Message ID 1529710522-28315-17-git-send-email-liran.alon@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Liran Alon June 22, 2018, 11:35 p.m. UTC
No functionality change.

Signed-off-by: Liran Alon <liran.alon@oracle.com>
Signed-off-by: Jim Mattson <jmattson@google.com>
---
 arch/x86/kvm/vmx.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 3327bd7fe81f..162e9517faa8 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -4510,9 +4510,21 @@  static inline int vmcs_field_width(unsigned long field)
 	return (field >> 13) & 0x3 ;
 }
 
+enum vmcs_field_type {
+	VMCS_FIELD_TYPE_CONTROL = 0,
+	VMCS_FIELD_TYPE_READ_ONLY_DATA = 1,
+	VMCS_FIELD_TYPE_GUEST = 2,
+	VMCS_FIELD_TYPE_HOST = 3
+};
+
+static inline int vmcs_field_type(unsigned long field)
+{
+	return (field >> 10) & 0x3;
+}
+
 static inline int vmcs_field_readonly(unsigned long field)
 {
-	return (((field >> 10) & 0x3) == 1);
+	return (vmcs_field_type(field) == VMCS_FIELD_TYPE_READ_ONLY_DATA);
 }
 
 static void init_vmcs_shadow_fields(void)