KVM: VMX: use correct vmcs_read/write for guest segment selector/base
authorChao Peng <chao.p.peng@linux.intel.com>
Tue, 21 Feb 2017 08:50:01 +0000 (03:50 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 21 Feb 2017 11:45:49 +0000 (12:45 +0100)
Guest segment selector is 16 bit field and guest segment base is natural
width field. Fix two incorrect invocations accordingly.

Without this patch, build fails when aggressive inlining is used with ICC.

Cc: stable@vger.kernel.org
Signed-off-by: Chao Peng <chao.p.peng@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx.c

index acf6013a0caf91b386762aa6effcbe71cc975da7..ef4ba71dbb66a50eab012c5f6e303a559bde1a71 100644 (file)
@@ -3905,7 +3905,7 @@ static void fix_rmode_seg(int seg, struct kvm_segment *save)
        }
 
        vmcs_write16(sf->selector, var.selector);
-       vmcs_write32(sf->base, var.base);
+       vmcs_writel(sf->base, var.base);
        vmcs_write32(sf->limit, var.limit);
        vmcs_write32(sf->ar_bytes, vmx_segment_access_rights(&var));
 }
@@ -8270,7 +8270,7 @@ static void kvm_flush_pml_buffers(struct kvm *kvm)
 static void vmx_dump_sel(char *name, uint32_t sel)
 {
        pr_err("%s sel=0x%04x, attr=0x%05x, limit=0x%08x, base=0x%016lx\n",
-              name, vmcs_read32(sel),
+              name, vmcs_read16(sel),
               vmcs_read32(sel + GUEST_ES_AR_BYTES - GUEST_ES_SELECTOR),
               vmcs_read32(sel + GUEST_ES_LIMIT - GUEST_ES_SELECTOR),
               vmcs_readl(sel + GUEST_ES_BASE - GUEST_ES_SELECTOR));