[COMMIT master] Fix segfault after device assignment hot remove

2010-05-16 Thread Avi Kivity
From: Alex Williamson alex.william...@redhat.com We keep a qlist of assigned devices for irq updates, but we forgot to remove entries from it if they're hot unplugged. This makes assigned_dev_update_irqs() a timebomb that goes off when the guest is rebooted. Signed-off-by: Alex Williamson

[COMMIT master] turn off kvmclock when resetting cpu

2010-05-16 Thread Avi Kivity
From: Glauber Costa glom...@redhat.com Currently, in the linux kernel, we reset kvmclock if we are rebooting into a crash kernel through kexec. The rationale, is that a new kernel won't follow the same memory addresses, and the memory where kvmclock is located in the first kernel, will be

[COMMIT master] test: emulator: lmsw may not clear cr0.pe

2010-05-16 Thread Avi Kivity
From: Avi Kivity a...@redhat.com Signed-off-by: Avi Kivity a...@redhat.com Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff --git a/kvm/user/test/x86/emulator.c b/kvm/user/test/x86/emulator.c index 5406062..e677e3a 100644 --- a/kvm/user/test/x86/emulator.c +++

[COMMIT master] test: Add test for xor acc, imm

2010-05-16 Thread Avi Kivity
From: Mohammed Gamal m.gamal...@gmail.com Adds test for xor acc, imm Signed-off-by: Mohammed Gamal m.gamal...@gmail.com Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff --git a/kvm/user/test/x86/realmode.c b/kvm/user/test/x86/realmode.c index 41e2aea..70a1e05 100644 ---

[COMMIT master] device-assignment: fix failure to exit on shared IRQ

2010-05-16 Thread Avi Kivity
From: Alex Williamson alex.william...@redhat.com Since c1699988, piix config space isn't programmed until the first system reset. This means that when we call assign_irq() from assigned_initfn(), we're going to get back an irq of 0x0, which unfortunately matches our initialization value, so we

[COMMIT master] test: Add test for sub acc,imm

2010-05-16 Thread Avi Kivity
From: Mohammed Gamal m.gamal...@gmail.com Adds tests fot sub acc, imm Signed-off-by: Mohammed Gamal m.gamal...@gmail.com Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff --git a/kvm/user/test/x86/realmode.c b/kvm/user/test/x86/realmode.c index bc4ed97..41e2aea 100644 ---

[COMMIT master] KVM: update mmu documetation for role.nxe

2010-05-16 Thread Avi Kivity
From: Gui Jianfeng guijianf...@cn.fujitsu.com There's no member cr4_nxe in struct kvm_mmu_page_role, it names nxe now. Update mmu document. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff --git a/Documentation/kvm/mmu.txt

[COMMIT master] KVM: x86: Call vcpu_load and vcpu_put in cpuid_update

2010-05-16 Thread Avi Kivity
From: Dongxiao Xu dongxiao...@intel.com cpuid_update may operate VMCS, so vcpu_load() and vcpu_put() should be called to ensure correctness. Signed-off-by: Dongxiao Xu dongxiao...@intel.com Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c

[COMMIT master] Merge remote branch 'tip/x86/fpu'

2010-05-16 Thread Avi Kivity
From: Marcelo Tosatti mtosa...@redhat.com Conflicts: arch/x86/kernel/process.c Signed-off-by: Marcelo Tosatti mtosa...@redhat.com -- To unsubscribe from this list: send the line unsubscribe kvm-commits in the body of a message to majord...@vger.kernel.org More majordomo info at

[COMMIT master] KVM: VMX: blocked-by-sti must not defer NMI injections

2010-05-16 Thread Avi Kivity
From: Jan Kiszka jan.kis...@siemens.com As the processor may not consider GUEST_INTR_STATE_STI as a reason for blocking NMI, it could return immediately with EXIT_REASON_NMI_WINDOW when we asked for it. But as we consider this state as NMI-blocking, we can run into an endless loop. Resolve this

[COMMIT master] KVM: VMX: Define new functions to wrapper direct call of asm code

2010-05-16 Thread Avi Kivity
From: Dongxiao Xu dongxiao...@intel.com Define vmcs_load() and kvm_cpu_vmxon() to avoid direct call of asm code. Also move VMXE bit operation out of kvm_cpu_vmxoff(). Signed-off-by: Dongxiao Xu dongxiao...@intel.com Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff --git

[COMMIT master] KVM: x86: add new KVMCLOCK cpuid feature

2010-05-16 Thread Avi Kivity
From: Glauber Costa glom...@redhat.com This cpuid, KVM_CPUID_CLOCKSOURCE2, will indicate to the guest that kvmclock is available through a new set of MSRs. The old ones are deprecated. Signed-off-by: Glauber Costa glom...@redhat.com Acked-by: Zachary Amsden zams...@redhat.com Signed-off-by:

[COMMIT master] KVM: VMX: VMCLEAR/VMPTRLD usage changes

2010-05-16 Thread Avi Kivity
From: Dongxiao Xu dongxiao...@intel.com Originally VMCLEAR/VMPTRLD is called on vcpu migration. To support hosted VMM coexistance, VMCLEAR is executed on vcpu schedule out, and VMPTRLD is executed on vcpu schedule in. This could also eliminate the IPI when doing VMCLEAR. Signed-off-by: Dongxiao

[COMMIT master] Enable pvclock flags in vcpu_time_info structure

2010-05-16 Thread Avi Kivity
From: Glauber Costa glom...@redhat.com This patch removes one padding byte and transform it into a flags field. New versions of guests using pvclock will query these flags upon each read. Flags, however, will only be interpreted when the guest decides to. It uses the pvclock_valid_flags function

[COMMIT master] don't compute pvclock adjustments if we trust the tsc

2010-05-16 Thread Avi Kivity
From: Glauber Costa glom...@redhat.com If the HV told us we can fully trust the TSC, skip any correction Signed-off-by: Glauber Costa glom...@redhat.com Acked-by: Zachary Amsden zams...@redhat.com Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff --git a/arch/x86/include/asm/kvm_para.h

[COMMIT master] KVM: VMX: VMXON/VMXOFF usage changes

2010-05-16 Thread Avi Kivity
From: Dongxiao Xu dongxiao...@intel.com SDM suggests VMXON should be called before VMPTRLD, and VMXOFF should be called after doing VMCLEAR. Therefore in vmm coexistence case, we should firstly call VMXON before any VMCS operation, and then call VMXOFF after the operation is done.

[COMMIT master] Add a global synchronization point for pvclock

2010-05-16 Thread Avi Kivity
From: Glauber Costa glom...@redhat.com In recent stress tests, it was found that pvclock-based systems could seriously warp in smp systems. Using ingo's time-warp-test.c, I could trigger a scenario as bad as 1.5mi warps a minute in some systems. (to be fair, it wasn't that bad in most of them).

[COMMIT master] KVM: x86: export paravirtual cpuid flags in KVM_GET_SUPPORTED_CPUID

2010-05-16 Thread Avi Kivity
From: Glauber Costa glom...@redhat.com Right now, we were using individual KVM_CAP entities to communicate userspace about which cpuids we support. This is suboptimal, since it generates a delay between the feature arriving in the host, and being available at the guest. A much better mechanism

[COMMIT master] KVM: x86 emulator: Add missing decoder flags for sub instruction

2010-05-16 Thread Avi Kivity
From: Mohammed Gamal m.gamal...@gmail.com This adds missing decoder flags for sub instructions (opcodes 0x2c - 0x2d) Signed-off-by: Mohammed Gamal m.gamal...@gmail.com Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index

[COMMIT master] Fix tip/x86/fpu merge

2010-05-16 Thread Avi Kivity
From: Marcelo Tosatti mtosa...@redhat.com Code removed upstream sneaked in through the merge. Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 83ccfdf..8bcc21f 100644 --- a/arch/x86/kernel/process.c +++

[COMMIT master] KVM: Add cpuid.txt file

2010-05-16 Thread Avi Kivity
From: Glauber Costa glom...@redhat.com This file documents cpuid bits used by KVM. Signed-off-by: Glauber Costa glom...@redhat.com Acked-by: Zachary Amsden zams...@redhat.com Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff --git a/Documentation/kvm/cpuid.txt

[COMMIT master] KVM: VMX: Only reset MMU when necessary

2010-05-16 Thread Avi Kivity
From: Sheng Yang sh...@linux.intel.com Only modifying some bits of CR0/CR4 needs paging mode switch. Modify EFER.NXE bit would result in reserved bit updates. Signed-off-by: Sheng Yang sh...@linux.intel.com Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff --git a/arch/x86/kvm/x86.c

[COMMIT master] KVM: x86 emulator: Add test acc, imm instruction (opcodes 0xA8 - 0xA9)

2010-05-16 Thread Avi Kivity
From: Mohammed Gamal m.gamal...@gmail.com This adds test acc, imm instruction to the x86 emulator Signed-off-by: Mohammed Gamal m.gamal...@gmail.com Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index b43ac98..35dd57c 100644 ---

[COMMIT master] KVM: Don't allow lmsw to clear cr0.pe

2010-05-16 Thread Avi Kivity
From: Avi Kivity a...@redhat.com The current lmsw implementation allows the guest to clear cr0.pe, contrary to the manual, which breaks EMM386.EXE. Fix by ORing the old cr0.pe with lmsw's operand. Signed-off-by: Avi Kivity a...@redhat.com Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff

[COMMIT master] KVM: MMU: use proper cache object freeing function

2010-05-16 Thread Avi Kivity
From: Xiao Guangrong xiaoguangr...@cn.fujitsu.com Use kmem_cache_free to free objects allocated by kmem_cache_alloc. Signed-off-by: Xiao Guangrong xiaoguangr...@cn.fujitsu.com Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index

[COMMIT master] KVM: MMU: Segregate shadow pages with different cr0.wp

2010-05-16 Thread Avi Kivity
From: Avi Kivity a...@redhat.com When cr0.wp=0, we may shadow a gpte having u/s=1 and r/w=0 with an spte having u/s=0 and r/w=1. This allows excessive access if the guest sets cr0.wp=1 and accesses through this spte. Fix by making cr0.wp part of the base role; we'll have different sptes for the

[COMMIT master] KVM: MMU: unalias gfn before sp-gfns[] comparison in sync_page

2010-05-16 Thread Avi Kivity
From: Xiao Guangrong xiaoguangr...@cn.fujitsu.com sp-gfns[] contain unaliased gfns, but gpte might contain pointer to aliased region. Signed-off-by: Xiao Guangrong xiaoguangr...@cn.fujitsu.com Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff --git a/arch/x86/kvm/paging_tmpl.h

[COMMIT master] KVM: x86: Clean up duplicate assignment

2010-05-16 Thread Avi Kivity
From: Sheng Yang sh...@linux.intel.com mmu.free() already set root_hpa to INVALID_PAGE, no need to do it again in the destory_kvm_mmu(). kvm_x86_ops-set_cr4() and set_efer() already assign cr4/efer to vcpu-arch.cr4/efer, no need to do it again later. Signed-off-by: Sheng Yang

[COMMIT master] KVM: PPC: Add missing vcpu_load()/vcpu_put() in vcpu ioctls

2010-05-16 Thread Avi Kivity
From: Avi Kivity a...@redhat.com Signed-off-by: Avi Kivity a...@redhat.com diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c index 11f226f..b998abf 100644 --- a/arch/powerpc/kvm/book3s.c +++ b/arch/powerpc/kvm/book3s.c @@ -1110,6 +1110,8 @@ int

[COMMIT master] KVM: s390: Centrally lock arch specific vcpu ioctls

2010-05-16 Thread Avi Kivity
From: Avi Kivity a...@redhat.com Signed-off-by: Avi Kivity a...@redhat.com diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index e80f55e..28cd8fd 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -363,9 +363,7 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu

[COMMIT master] KVM: x86: Add missing locking to arch specific vcpu ioctls

2010-05-16 Thread Avi Kivity
From: Avi Kivity a...@redhat.com Signed-off-by: Avi Kivity a...@redhat.com diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index bfe0730..7167109 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1854,6 +1854,7 @@ static int kvm_vcpu_ioctl_get_cpuid2(struct kvm_vcpu *vcpu, {

[COMMIT master] KVM: pass correct parameter to kvm_mmu_free_some_pages

2010-05-16 Thread Avi Kivity
From: Marcelo Tosatti mtosa...@redhat.com Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 604eb3f..fd2c8f4 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -2067,7 +2067,7 @@ static int mmu_alloc_roots(struct kvm_vcpu

[COMMIT master] KVM: x86: Check LMA bit before set_efer

2010-05-16 Thread Avi Kivity
From: Sheng Yang sh...@linux.intel.com kvm_x86_ops-set_efer() would execute vcpu-arch.efer = efer, so the checking of LMA bit didn't work. Signed-off-by: Sheng Yang sh...@linux.intel.com Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c

[COMMIT master] KVM: x86: Lock arch specific vcpu ioctls centrally

2010-05-16 Thread Avi Kivity
From: Avi Kivity a...@redhat.com Signed-off-by: Avi Kivity a...@redhat.com diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 75a6e8a..ce4e943 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1541,16 +1541,12 @@ static int __msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs

[COMMIT master] KVM: remove CAP_SYS_RAWIO requirement from kvm_vm_ioctl_assign_irq

2010-05-16 Thread Avi Kivity
From: Alex Williamson alex.william...@redhat.com Remove this check in an effort to allow kvm guests to run without root privileges. This capability check doesn't seem to add any security since the device needs to have already been added via the assign device ioctl and the io actually occurs

[COMMIT master] KVM: x86: cleanup unused local variable

2010-05-16 Thread Avi Kivity
From: Xiao Guangrong xiaoguangr...@cn.fujitsu.com fix: arch/x86/kvm/x86.c: In function ‘handle_emulation_failure’: arch/x86/kvm/x86.c:3844: warning: unused variable ‘ctxt’ Signed-off-by: Xiao Guangrong xiaoguangr...@cn.fujitsu.com Signed-off-by: Marcelo Tosatti mtosa...@redhat.com diff --git

[COMMIT master] KVM: Consolidate arch specific vcpu ioctl locking

2010-05-16 Thread Avi Kivity
From: Avi Kivity a...@redhat.com Now that all arch specific ioctls have centralized locking, it is easy to move it to the central dispatcher. Signed-off-by: Avi Kivity a...@redhat.com diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index caeed7b..a1d8750 100644 ---