aboutsummaryrefslogtreecommitdiff
path: root/drivers/kvm
AgeCommit message (Collapse)Author
2007-07-20KVM: MMU: Fix cleaning up the shadow page allocation cacheAvi Kivity
__free_page() wants a struct page, not a virtual address. Signed-off-by: Avi Kivity <avi@qumranet.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-20KVM: MMU: Fix oopses with SLUBAvi Kivity
The kvm mmu uses page->private on shadow page tables; so does slub, and an oops result. Fix by allocating regular pages for shadows instead of using slub. Tested-by: S.Çağlar Onur <caglar@pardus.org.tr> Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-20KVM: x86 emulator: implement rdmsr and wrmsrAvi Kivity
Allow real-mode emulation of rdmsr and wrmsr. This allows smp Windows to boot, presumably for its sipi trampoline. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-20KVM: Fix memory slot management functions for guest smpAvi Kivity
The memory slot management functions were oriented against vcpu 0, where they should be kvm-wide. This causes hangs starting X on guest smp. Fix by making the functions (and resultant tail in the mmu) non-vcpu-specific. Unfortunately this reduces the efficiency of the mmu object cache a bit. We may have to revisit this later. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-20KVM: MMU: Store nx bit for large page shadowsAvi Kivity
We need to distinguish between large page shadows which have the nx bit set and those which don't. The problem shows up when booting a newer smp Linux kernel, where the trampoline page (which is in real mode, which uses the same shadow pages as large pages) is using the same mapping as a kernel data page, which is mapped using nx, causing kvm to spin on that page. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-20mm: Remove slab destructors from kmem_cache_create().Paul Mundt
Slab destructors were no longer supported after Christoph's c59def9f222d44bb7e2f0a559f2906191a0862d7 change. They've been BUGs for both slab and slub, and slob never supported them either. This rips out support for the dtor pointer from kmem_cache_create() completely and fixes up every single callsite in the kernel (there were about 224, not including the slab allocator definitions themselves, or the documentation references). Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2007-07-19i386: Allow KVM on i386 nonpaeAvi Kivity
Currently, CONFIG_X86_CMPXCHG64 both enables boot-time checking of the cmpxchg64b feature and enables compilation of the set_64bit() family. Since the option is dependent on PAE, and since KVM depends on set_64bit(), this effectively disables KVM on i386 nopae. Simplify by removing the config option altogether: the boot check is made dependent on CONFIG_X86_PAE directly, and the set_64bit() family is exposed without constraints. It is up to users to check for the feature flag (KVM does not as virtualiation extensions imply its existence). Signed-off-by: Avi Kivity <avi@qumranet.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-16KVM: Use CPU_DYING for disabling virtualizationAvi Kivity
Only at the CPU_DYING stage can we be sure that no user process will be scheduled onto the cpu and oops when trying to use virtualization extensions. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Tune hotplug/suspend IPIsAvi Kivity
The hotplug IPIs can be called from the cpu on which we are currently running on, so use on_cpu(). Similarly, drop on_each_cpu() for the suspend/resume callbacks, as we're in atomic context here and only one cpu is up anyway. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Keep track of which cpus have virtualization enabledAvi Kivity
By keeping track of which cpus have virtualization enabled, we prevent double-enable or double-disable during hotplug, which is a very fatal oops. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Clean up #includesAvi Kivity
Remove unnecessary ones, and rearange the remaining in the standard order. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Remove kvmfs in favor of the anonymous inodes sourceAvi Kivity
kvm uses a pseudo filesystem, kvmfs, to generate inodes, a job that the new anonymous inodes source does much better. Cc: Davide Libenzi <davidel@xmailserver.org> Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: SVM: Reliably detect if SVM was disabled by BIOSJoerg Roedel
This patch adds an implementation to the svm is_disabled function to detect reliably if the BIOS disabled the SVM feature in the CPU. This fixes the issues with kernel panics when loading the kvm-amd module on machines where SVM is available but disabled. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: VMX: Remove unnecessary code in vmx_tlb_flush()Avi Kivity
A vmexit implicitly flushes the tlb; the code is bogus. Noted by Shaohua Li. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: MMU: Fix Wrong tlb flush orderShaohua Li
Need to flush the tlb after updating a pte, not before. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: VMX: Reinitialize the real-mode tss when entering real modeAvi Kivity
Protected mode code may have corrupted the real-mode tss, so re-initialize it when switching to real mode. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Avoid useless memory write when possibleLuca Tettamanti
When writing to normal memory and the memory area is unchanged the write can be safely skipped, avoiding the costly kvm_mmu_pte_write. Signed-Off-By: Luca Tettamanti <kronos.it@gmail.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Fix x86 emulator writebackLuca Tettamanti
When the old value and new one are the same the emulator skips the write; this is undesirable when the destination is a MMIO area and the write shall be performed regardless of the previous value. This optimization breaks e.g. a Linux guest APIC compiled without X86_GOOD_APIC. Remove the check and perform the writeback stage in the emulation unless it's explicitly disabled (currently push and some 2 bytes instructions may disable the writeback). Signed-Off-By: Luca Tettamanti <kronos.it@gmail.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Add support for in-kernel pio handlersEddie Dong
Useful for the PIC and PIT. Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: VMX: Fix interrupt checking on lightweight exitGregory Haskins
With kernel-injected interrupts, we need to check for interrupts on lightweight exits too. Signed-off-by: Gregory Haskins <ghaskins@novell.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Adds support for in-kernel mmio handlersGregory Haskins
Signed-off-by: Gregory Haskins <ghaskins@novell.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Implement emulation of instruction "ret" (opcode 0xc3)Nitin A Kamble
Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Implement emulation of "pop reg" instruction (opcode 0x58-0x5f)Nitin A Kamble
For use in real mode. Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: VMX: Ensure vcpu time stamp counter is monotonousAvi Kivity
If the time stamp counter goes backwards, a guest delay loop can become infinite. This can happen if a vcpu is migrated to another cpu, where the counter has a lower value than the first cpu. Since we're doing an IPI to the first cpu anyway, we can use that to pick up the old tsc, and use that to calculate the adjustment we need to make to the tsc offset. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Initialize the BSP bit in the APIC_BASE msr correctlyAvi Kivity
Needs to be set on vcpu 0 only. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: VMX: Replace memset(<addr>, 0, PAGESIZE) with clear_page(<addr>)Shani Moideen
Signed-off-by: Shani Moideen <shani.moideen@wipro.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: SVM: Replace memset(<addr>, 0, PAGESIZE) with clear_page(<addr>)Shani Moideen
Signed-off-by: Shani Moideen <shani.moideen@wipro.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Flush remote tlbs when reducing shadow pte permissionsAvi Kivity
When a vcpu causes a shadow tlb entry to have reduced permissions, it must also clear the tlb on remote vcpus. We do that by: - setting a bit on the vcpu that requests a tlb flush before the next entry - if the vcpu is currently executing, we send an ipi to make sure it exits before we continue Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Keep an upper bound of initialized vcpusAvi Kivity
That way, we don't need to loop for KVM_MAX_VCPUS for a single vcpu vm. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Emulate hlt on real mode for IntelAvi Kivity
This has two use cases: the bios can't boot from disk, and guest smp bootstrap. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Move duplicate halt handling code into kvm_main.cAvi Kivity
Will soon have a thid user. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Enable guest smpAvi Kivity
As we don't support guest tlb shootdown yet, this is only reliable for real-mode guests. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Fix adding an smp virtual machine to the vm listAvi Kivity
If we add the vm once per vcpu, we corrupt the list if the guest has multiple vcpus. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Fix vcpu freeing for guest smpAvi Kivity
A vcpu can pin up to four mmu shadow pages, which means the freeing loop will never terminate. Fix by first unpinning shadow pages on all vcpus, then freeing shadow pages. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Remove unnecessary initialization and checks in mark_page_dirty()Nguyen Anh Quynh
Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Replace C code with call to ARRAY_SIZE() macro.Robert P. J. Day
Signed-off-by: Robert P. J. Day <rpjday@mindspring.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Lazy guest cr3 switchingAvi Kivity
Switch guest paging context may require us to allocate memory, which might fail. Instead of wiring up error paths everywhere, make context switching lazy and actually do the switch before the next guest entry, where we can return an error if allocation fails. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: MMU: Remove unused large page markerAvi Kivity
This has not been used for some time, as the same information is available in the page header. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: MMU: Don't cache guest access bits in the shadow page tableAvi Kivity
This was once used to avoid accessing the guest pte when upgrading the shadow pte from read-only to read-write. But usually we need to set the guest pte dirty or accessed bits anyway, so this wasn't really exploited. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: MMU: Simpify accessed/dirty/present/nx bit handlingAvi Kivity
Always set the accessed and dirty bit (since having them cleared causes a read-modify-write cycle), always set the present bit, and copy the nx bit from the guest. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: MMU: Remove cr0.wp tricksAvi Kivity
No longer needed as we do everything in one place. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: MMU: Make setting shadow ptes atomic on i386Avi Kivity
Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Make shadow pte updates atomicAvi Kivity
With guest smp, a second vcpu might see partial updates when the first vcpu services a page fault. So delay all updates until we have figured out what the pte should look like. Note that on i386, this is still not completely atomic as a 64-bit write will be split into two on a 32-bit machine. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: Move shadow pte modifications from set_pte/set_pde to set_pde_common()Avi Kivity
We want all shadow pte modifications in one place. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: MMU: Fold fix_write_pf() into set_pte_common()Avi Kivity
This prevents some work from being performed twice, and, more importantly, reduces the number of places where we modify shadow ptes. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: MMU: Fold fix_read_pf() into set_pte_common()Avi Kivity
Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: MMU: Pass the guest pde to set_pte_commonAvi Kivity
We will need the accessed bit (in addition to the dirty bit) and also write access (for setting the dirty bit) in a future patch. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: MMU: Move set_pte_common() to pte width dependent codeAvi Kivity
In preparation of some modifications. Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: MMU: Simplify fetch() a little bitAvi Kivity
Signed-off-by: Avi Kivity <avi@qumranet.com>
2007-07-16KVM: MMU: Use slab caches for shadow pages and their headersAvi Kivity
Use slab caches instead of a simple custom list. Signed-off-by: Avi Kivity <avi@qumranet.com>