Commit 64fb6d9aa01a523bcd70f836bf1374dcb22759a9

Authored by Linus Torvalds

Merge tag 'kvm-3.11-2' of git://git.kernel.org/pub/scm/virt/kvm/kvm

Pull more KVM changes from Gleb Natapov:
 "A fix for a bug that prevents some guests from working on old Intel
  CPUs and a patch that integrates ARM64 KVM, merged via ARM64 tree,
  into Kconfig."

* tag 'kvm-3.11-2' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: VMX: mark unusable segment as nonpresent
  arm64: KVM: Kconfig integration

Showing 4 changed files Side-by-side Diff

... ... @@ -270,6 +270,8 @@
270 270  
271 271 source "fs/Kconfig"
272 272  
  273 +source "arch/arm64/kvm/Kconfig"
  274 +
273 275 source "arch/arm64/Kconfig.debug"
274 276  
275 277 source "security/Kconfig"
arch/arm64/kernel/asm-offsets.c
... ... @@ -21,6 +21,7 @@
21 21 #include <linux/sched.h>
22 22 #include <linux/mm.h>
23 23 #include <linux/dma-mapping.h>
  24 +#include <linux/kvm_host.h>
24 25 #include <asm/thread_info.h>
25 26 #include <asm/memory.h>
26 27 #include <asm/cputable.h>
arch/arm64/kvm/Kconfig
  1 +#
  2 +# KVM configuration
  3 +#
  4 +
  5 +source "virt/kvm/Kconfig"
  6 +
  7 +menuconfig VIRTUALIZATION
  8 + bool "Virtualization"
  9 + ---help---
  10 + Say Y here to get to see options for using your Linux host to run
  11 + other operating systems inside virtual machines (guests).
  12 + This option alone does not add any kernel code.
  13 +
  14 + If you say N, all options in this submenu will be skipped and
  15 + disabled.
  16 +
  17 +if VIRTUALIZATION
  18 +
  19 +config KVM
  20 + bool "Kernel-based Virtual Machine (KVM) support"
  21 + select MMU_NOTIFIER
  22 + select PREEMPT_NOTIFIERS
  23 + select ANON_INODES
  24 + select KVM_MMIO
  25 + select KVM_ARM_HOST
  26 + select KVM_ARM_VGIC
  27 + select KVM_ARM_TIMER
  28 + ---help---
  29 + Support hosting virtualized guest machines.
  30 +
  31 + If unsure, say N.
  32 +
  33 +config KVM_ARM_HOST
  34 + bool
  35 + ---help---
  36 + Provides host support for ARM processors.
  37 +
  38 +config KVM_ARM_VGIC
  39 + bool
  40 + depends on KVM_ARM_HOST && OF
  41 + select HAVE_KVM_IRQCHIP
  42 + ---help---
  43 + Adds support for a hardware assisted, in-kernel GIC emulation.
  44 +
  45 +config KVM_ARM_TIMER
  46 + bool
  47 + depends on KVM_ARM_VGIC
  48 + ---help---
  49 + Adds support for the Architected Timers in virtual machines.
  50 +
  51 +endif # VIRTUALIZATION
... ... @@ -3404,15 +3404,22 @@
3404 3404 var->limit = vmx_read_guest_seg_limit(vmx, seg);
3405 3405 var->selector = vmx_read_guest_seg_selector(vmx, seg);
3406 3406 ar = vmx_read_guest_seg_ar(vmx, seg);
  3407 + var->unusable = (ar >> 16) & 1;
3407 3408 var->type = ar & 15;
3408 3409 var->s = (ar >> 4) & 1;
3409 3410 var->dpl = (ar >> 5) & 3;
3410   - var->present = (ar >> 7) & 1;
  3411 + /*
  3412 + * Some userspaces do not preserve unusable property. Since usable
  3413 + * segment has to be present according to VMX spec we can use present
  3414 + * property to amend userspace bug by making unusable segment always
  3415 + * nonpresent. vmx_segment_access_rights() already marks nonpresent
  3416 + * segment as unusable.
  3417 + */
  3418 + var->present = !var->unusable;
3411 3419 var->avl = (ar >> 12) & 1;
3412 3420 var->l = (ar >> 13) & 1;
3413 3421 var->db = (ar >> 14) & 1;
3414 3422 var->g = (ar >> 15) & 1;
3415   - var->unusable = (ar >> 16) & 1;
3416 3423 }
3417 3424  
3418 3425 static u64 vmx_get_segment_base(struct kvm_vcpu *vcpu, int seg)