[COMMIT master] KVM: MMU: Add drop_large_spte() helper

2010-07-22 Thread Avi Kivity
From: Avi Kivity To clarify spte fetching code, move large spte handling into a helper. Signed-off-by: Avi Kivity Signed-off-by: Marcelo Tosatti diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 75cfb79..747af72 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -1492,6 +149

[COMMIT master] KVM: MMU: Add validate_direct_spte() helper

2010-07-22 Thread Avi Kivity
From: Avi Kivity Add a helper to verify that a direct shadow page is valid wrt the required access permissions; drop the page if it is not valid. Reviewed-by: Xiao Guangrong Signed-off-by: Avi Kivity Signed-off-by: Marcelo Tosatti diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 74

[COMMIT master] KVM: MMU: Validate all gptes during fetch, not just those used for new pages

2010-07-22 Thread Avi Kivity
From: Avi Kivity Currently, when we fetch an spte, we only verify that gptes match those that the walker saw if we build new shadow pages for them. However, this misses the following race: vcpu1vcpu2 walk change gpte walk in

[COMMIT master] KVM: x86: Call mask notifiers from pic

2010-07-22 Thread Avi Kivity
From: Gleb Natapov If pit delivers interrupt while pic is masking it OS will never do EOI and ack notifier will not be called so when pit will be unmasked no pit interrupts will be delivered any more. Calling mask notifiers solves this issue. Signed-off-by: Gleb Natapov Signed-off-by: Marcelo T

[COMMIT master] KVM: x86 emulator: fix xchg instruction emulation

2010-07-22 Thread Avi Kivity
From: Wei Yongjun If the destination is a memory operand and the memory cannot map to a valid page, the xchg instruction emulation and locked instruction will not work on io regions and stuck in endless loop. We should emulate exchange as write to fix it. Signed-off-by: Wei Yongjun Acked-by: Gl

[COMMIT master] KVM: MMU: fix mmu notifier invalidate handler for huge spte

2010-07-22 Thread Avi Kivity
From: Andrea Arcangeli The index wasn't calculated correctly (off by one) for huge spte so KVM guest was unstable with transparent hugepages. Signed-off-by: Andrea Arcangeli Reviewed-by: Reviewed-by: Rik van Riel Signed-off-by: Avi Kivity diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c

[COMMIT master] KVM: Document KVM_GET_SUPPORTED_CPUID2 ioctl

2010-07-22 Thread Avi Kivity
From: Avi Kivity Signed-off-by: Avi Kivity Signed-off-by: Marcelo Tosatti diff --git a/Documentation/kvm/api.txt b/Documentation/kvm/api.txt index 179cc51..5f5b649 100644 --- a/Documentation/kvm/api.txt +++ b/Documentation/kvm/api.txt @@ -968,6 +968,70 @@ struct kvm_xcrs { This ioctl would

[COMMIT master] Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git/

2010-07-22 Thread Avi Kivity
From: Marcelo Tosatti Conflicts: arch/x86/kvm/mmu.c Signed-off-by: Marcelo Tosatti -- 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 http://vger.kernel.org/majordomo-info.html

[COMMIT master] KVM: MMU: Add gpte_valid() helper

2010-07-22 Thread Avi Kivity
From: Avi Kivity Move the code to check whether a gpte has changed since we fetched it into a helper. Signed-off-by: Avi Kivity Signed-off-by: Marcelo Tosatti diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 893a75c..22159e6 100644 --- a/arch/x86/kvm/paging_tmpl.h ++

[COMMIT master] KVM: MMU: Simplify spte fetch() function

2010-07-22 Thread Avi Kivity
From: Avi Kivity Partition the function into three sections: - fetching indirect shadow pages (host_level > guest_level) - fetching direct shadow pages (page_level < host_level <= guest_level) - the final spte (page_level == host_level) Instead of the current spaghetti. A slight change from th

[COMMIT master] KVM: MMU: Eliminate redundant temporaries in FNAME(fetch)

2010-07-22 Thread Avi Kivity
From: Avi Kivity 'level' and 'sptep' are aliases for 'interator.level' and 'iterator.sptep', no need for them. Signed-off-by: Avi Kivity Signed-off-by: Marcelo Tosatti diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 284ab16..a09e04c 100644 --- a/arch/x86/kvm/paging_

[COMMIT master] KVM: x86: emulator: inc/dec can have lock prefix

2010-07-22 Thread Avi Kivity
From: Gleb Natapov Mark inc (0xfe/0 0xff/0) and dec (0xfe/1 0xff/1) as lock prefix capable. Signed-off-by: Gleb Natapov Signed-off-by: Marcelo Tosatti diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 255473f..b38bd8b 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emu

[COMMIT master] KVM: x86: never re-execute instruction with enabled tdp

2010-07-22 Thread Avi Kivity
From: Gleb Natapov With tdp enabled we should get into emulator only when emulating io, so reexecution will always bring us back into emulator. Signed-off-by: Gleb Natapov Signed-off-by: Marcelo Tosatti diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index fb08316..86c8102 100644 --- a/a

[COMMIT master] KVM: MMU: Use __set_spte to link shadow pages

2010-07-22 Thread Avi Kivity
From: Avi Kivity To avoid split accesses to 64 bit sptes on i386, use __set_spte() to link shadow pages together. (not technically required since shadow pages are __GFP_KERNEL, so upper 32 bits are always clear) Reviewed-by: Xiao Guangrong Signed-off-by: Avi Kivity Signed-off-by: Marcelo Tosa

[COMMIT master] KVM: MMU: Add link_shadow_page() helper

2010-07-22 Thread Avi Kivity
From: Avi Kivity To simplify the process of fetching an spte, add a helper that links a shadow page to an spte. Reviewed-by: Xiao Guangrong Signed-off-by: Avi Kivity Signed-off-by: Marcelo Tosatti diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index b93b94f..ae35853 100644 --- a/arch/x

[COMMIT master] KVM: Document MCE banks non-exposure via KVM_GET_MSR_INDEX_LIST

2010-07-22 Thread Avi Kivity
From: Avi Kivity Signed-off-by: Avi Kivity Signed-off-by: Marcelo Tosatti diff --git a/Documentation/kvm/api.txt b/Documentation/kvm/api.txt index d9b00f1..179cc51 100644 --- a/Documentation/kvm/api.txt +++ b/Documentation/kvm/api.txt @@ -126,6 +126,10 @@ user fills in the size of the indices

[COMMIT master] KVM: Convert mask notifiers to use irqchip/pin instead of gsi

2010-07-22 Thread Avi Kivity
From: Gleb Natapov Devices register mask notifier using gsi, but irqchip knows about irqchip/pin, so conversion from irqchip/pin to gsi should be done before looking for mask notifier to call. Signed-off-by: Gleb Natapov Signed-off-by: Marcelo Tosatti diff --git a/include/linux/kvm_host.h b/i

[COMMIT master] KVM: PIT: stop vpit before freeing irq_routing

2010-07-22 Thread Avi Kivity
From: Xiao Guangrong Fix: general protection fault: [#1] PREEMPT SMP DEBUG_PAGEALLOC .. Call Trace: [] ? kvm_set_irq+0xdd/0x24b [kvm] [] ? trace_hardirqs_off_caller+0x1f/0x10e [] ? sub_preempt_count+0xe/0xb6 [] ? put_lock_stats+0xe/0x27 ... RIP [] kvm_set_irq+0x17e/0x24b [kvm] This

[COMMIT master] KVM: Expose MCE control MSRs to userspace

2010-07-22 Thread Avi Kivity
From: Avi Kivity Userspace needs to reset and save/restore these MSRs. The MCE banks are not exposed since their number varies from vcpu to vcpu. Signed-off-by: Avi Kivity Signed-off-by: Marcelo Tosatti diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 39a264e..fb08316 100644 --- a/

[COMMIT master] test: add inc/dec emulation testing

2010-07-22 Thread Avi Kivity
From: Gleb Natapov Signed-off-by: Gleb Natapov Signed-off-by: Marcelo Tosatti diff --git a/kvm/test/x86/emulator.c b/kvm/test/x86/emulator.c index 6db1305..87ce9bc 100644 --- a/kvm/test/x86/emulator.c +++ b/kvm/test/x86/emulator.c @@ -220,6 +220,31 @@ jmpf: report("ljmp", res); } +void

[COMMIT master] test: add test for xchg instruction

2010-07-22 Thread Avi Kivity
From: Wei Yongjun This patch add test for xchg instruction. Signed-off-by: Wei Yongjun Signed-off-by: Marcelo Tosatti diff --git a/kvm/test/x86/emulator.c b/kvm/test/x86/emulator.c index 87ce9bc..db6a134 100644 --- a/kvm/test/x86/emulator.c +++ b/kvm/test/x86/emulator.c @@ -295,6 +295,56 @@ v

[COMMIT master] test: Add rmap_chain.flat to unittests config file

2010-07-22 Thread Avi Kivity
From: Lucas Meneghel Rodrigues So it can get executed automatically by KVM autotest. Signed-off-by: Lucas Meneghel Rodrigues Signed-off-by: Avi Kivity diff --git a/kvm/test/x86/unittests.cfg b/kvm/test/x86/unittests.cfg index 4a40989..f39c5bd 100644 --- a/kvm/test/x86/unittests.cfg +++ b/kvm/

[COMMIT master] Merge commit '9a62fb241c10327992a16bf99a131f98e70428a1' into upstream-merge

2010-07-22 Thread Avi Kivity
From: Avi Kivity * commit '9a62fb241c10327992a16bf99a131f98e70428a1': Sparc32: reserve addresses for unimplemented devices on SS-20 target-ppc: fix power mode checking on 7400/7410 target-mips: fix xtlb exception for loongson microblaze: Correct signal frame setup. Make default invocati

[COMMIT master] device-assignment: Better fd tracking

2010-07-22 Thread Avi Kivity
From: Alex Williamson Commit 909bfdba fixed a hole with not closing resource file descriptors but we need to be more careful about tracking which are real fds, otherwise we might close fd 0, which doesn't work out so well for stdio. Signed-off-by: Alex Williamson Acked-by: Donald Dutile Signed

[COMMIT master] Merge branch 'upstream-merge'

2010-07-22 Thread Avi Kivity
From: Marcelo Tosatti * upstream-merge: (118 commits) qemu-options: add documentation for stdio signal=on|off Update OpenBIOS images target-ppc: add vexptefp instruction softfloat: add float32_exp2() Update SeaBIOS pci/multi function bit: fix vt82c686.c. target-sh4: Add support for