summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2008-01-30KVM: Portability: Move IO device definitions to its own header fileHollis Blanchard
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Acked-by: Carsten Otte <cotte@de.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Portability: Move address types to their own header fileHollis Blanchard
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Acked-by: Carsten Otte <cotte@de.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Extend ioapic code to support iosapicZhang Xiantao
iosapic supports an additional mmio EOI register compared to ioapic. Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Replace dest_Lowest_Prio and dest_Fixed with self-defined macrosZhang Xiantao
Change dest_Loest_Prio -> IOAPIC_LOWEST_PRIORITY dest_Fixed -> IOAPIC_FIXED the original names are x86 specific, while the ioapic code will be reused for ia64. Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Replace kvm_lapic with kvm_vcpu in ioapic/lapic interfaceZhang Xiantao
This patch replaces lapic structure with kvm_vcpu in ioapic.c, making ioapic independent of the local apic, as required by ia64. Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: SVM: Remove KVM specific defines for MSR_EFERCarlo Marcelo Arenas Belon
This patch removes the KVM specific defines for MSR_EFER that were being used in the svm support file and migrates all references to use instead the ones from the kernel headers that are used everywhere else and that have the same values. Signed-off-by: Carlo Marcelo Arenas Belon <carenas@sajinet.com.pe> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Export include/linux/kvm.h only if $ARCH actually supports KVMAvi Kivity
Currently, make headers_check barfs due to <asm/kvm.h>, which <linux/kvm.h> includes, not existing. Rather than add a zillion <asm/kvm.h>s, export kvm.h only if the arch actually supports it. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Correct kvm_init() error paths not freeing bad_pge.Zhang Xiantao
Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Portability: Move KVM_INTERRUPT vcpu ioctl to x86.cZhang Xiantao
Other archs doesn't need it. Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: x86 emulator: unify four switch statements into twoAvi Kivity
Unify the special instruction switch with the regular instruction switch, and the two byte special instruction switch with the regular two byte instruction switch. That makes it much easier to find an instruction or the place an instruction needs to be added in. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: x86 emulator: unify two switchesAvi Kivity
The rep prefix cleanup left two switch () statements next to each other. Unify them. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: x86 emulator: Move rep processing before instruction executionAvi Kivity
Currently rep processing is handled somewhere in the middle of instruction processing. Move it to a sensible place. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Add ifdef in irqchip struct for x86 only structuresJerone Young
This patch fixes a small issue where sturctures: kvm_pic_state kvm_ioapic_state are defined inside x86 specific code and may or may not be defined in anyway for other architectures. The problem caused is one cannot compile userspace apps (ex. libkvm) for other archs since a size cannot be determined for these structures. Signed-off-by: Jerone Young <jyoung5@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: x86 emulator: cmps instructionGuillaume Thouvenin
Add emulation for the cmps instruction. This lets OpenBSD boot on kvm. Signed-off-by: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: x86 emulator: Rename 'cr2' to 'memop'Sheng Yang
Previous patches have removed the dependency on cr2; we can now stop passing it to the emulator and rename uses to 'memop'. Signed-off-by: Sheng Yang <sheng.yang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: MMU: mark pages that were inserted to the shadow pages table as accessedIzik Eidus
Mark guest pages as accessed when removed from the shadow page tables for better lru processing. Signed-off-by: Izik Eidus <izike@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Remove misleading check for mmio during event injectionAvi Kivity
mmio was already handled in kvm_arch_vcpu_ioctl_run(), so no need to check again. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: x86 emulator: address size and operand size overrides are stickyAvi Kivity
Current implementation is to toggle, which is incorrect. Patch ported from corresponding Xen code. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: x86 emulator: Make a distinction between repeat prefixes F3 and F2Guillaume Thouvenin
cmps and scas instructions accept repeat prefixes F3 and F2. So in order to emulate those prefixed instructions we need to be able to know if prefixes are REP/REPE/REPZ or REPNE/REPNZ. Currently kvm doesn't make this distinction. This patch introduces this distinction. Signed-off-by: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Portability: Move unalias_gfn to arch dependent fileZhang Xiantao
Non-x86 archs don't need this mechanism. Move it to arch, and keep its interface in common. Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Acked-by: Carsten Otte <cotte@de.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: VMX: Remove the secondary execute control dependency on irqchipSheng Yang
The state of SECONDARY_VM_EXEC_CONTROL shouldn't depend on in-kernel IRQ chip, this patch fix this. Signed-off-by: Sheng Yang <sheng.yang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Enhance guest cpuid managementDan Kenigsberg
The current cpuid management suffers from several problems, which inhibit passing through the host feature set to the guest: - No way to tell which features the host supports While some features can be supported with no changes to kvm, others need explicit support. That means kvm needs to vet the feature set before it is passed to the guest. - No support for indexed or stateful cpuid entries Some cpuid entries depend on ecx as well as on eax, or on internal state in the processor (running cpuid multiple times with the same input returns different output). The current cpuid machinery only supports keying on eax. - No support for save/restore/migrate The internal state above needs to be exposed to userspace so it can be saved or migrated. This patch adds extended cpuid support by means of three new ioctls: - KVM_GET_SUPPORTED_CPUID: get all cpuid entries the host (and kvm) supports - KVM_SET_CPUID2: sets the vcpu's cpuid table - KVM_GET_CPUID2: gets the vcpu's cpuid table, including hidden state [avi: fix original KVM_SET_CPUID not removing nx on non-nx hosts as it did before] Signed-off-by: Dan Kenigsberg <danken@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Disallow fork() and similar games when using a VMAvi Kivity
We don't want the meaning of guest userspace changing under our feet. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: MMU: Rename 'release_page'Avi Kivity
Rename the awkwardly named variable. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: MMU: Rename variables of type 'struct kvm_mmu_page *'Avi Kivity
These are traditionally named 'page', but even more traditionally, that name is reserved for variables that point to a 'struct page'. Rename them to 'sp' (for "shadow page"). Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Remove gpa_to_hpa()Avi Kivity
Converting last uses along the way. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: MMU: Remove gva_to_hpa()Avi Kivity
No longer used. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: MMU: Simplify nonpaging_map()Avi Kivity
Instead of passing an hpa, pass a regular struct page. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: MMU: Introduce gfn_to_gpa()Avi Kivity
Converting a frame number to an address is tricky since the data type changes size. Introduce a function to do it. This fixes an actual bug when accessing guest ptes. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: MMU: Adjust page_header_update_slot() to accept a gfn instead of a gpaAvi Kivity
Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: MMU: Merge set_pte() and set_pte_common()Avi Kivity
Since set_pte() is now the only caller of set_pte_common(), merge the two functions. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: MMU: Remove set_pde()Avi Kivity
It is now identical to set_pte(). Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: MMU: Remove extra gaddr parameter from set_pte_common()Avi Kivity
Similar information is available in the gfn parameter, so use that. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: MMU: Move pse36 handling to the guest walkerAvi Kivity
Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: MMU: Introduce and use gpte_to_gfn()Avi Kivity
Instead of repretitively open-coding this. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: MMU: Code cleanupIzik Eidus
Signed-off-by: Izik Eidus <izike@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Don't bother the mmu if cr3 load doesn't change cr3Avi Kivity
If the guest requests just a tlb flush, don't take the vm lock and drop the mmu context pointlessly. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: MMU: Avoid unnecessary remote tlb flushes when guest updates a pteAvi Kivity
If all we're doing is increasing permissions on a pte (typical for demand paging), then there's not need to flush remote tlbs. Worst case they'll get a spurious page fault. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Add statistic for remote tlb flushesAvi Kivity
Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: MMU: Implement guest page fault bypass for nonpaeAvi Kivity
I spent an hour worrying why I see so many guest page faults on FC6 i386. Turns out bypass wasn't implemented for nonpae. Implement it so it doesn't happen again. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Split vcpu creation to avoid vcpu_load() before preemption setupAvi Kivity
Split kvm_arch_vcpu_create() into kvm_arch_vcpu_create() and kvm_arch_vcpu_setup(), enabling preemption notification between the two. This mean that we can now do vcpu_load() within kvm_arch_vcpu_setup(). Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Portability: Split kvm_set_memory_region() to have an arch calloutZhang Xiantao
Moving !user_alloc case to kvm_arch to avoid unnecessary code logic in non-x86 platform. Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Recalculate mmu pages needed for every memory region changeZhang Xiantao
Instead of incrementally changing the mmu cache size for every memory slot operation, recalculate it from scratch. This is simpler and safer. Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: x86 emulator: prefetch up to 15 bytes of the instruction executedAvi Kivity
Instead of fetching one byte at a time, prefetch 15 bytes (or until the next page boundary) to avoid guest page table walks. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: x86 emulator: retire ->write_std()Avi Kivity
Theoretically used to acccess memory known to be ordinary RAM, it was never implemented. It is questionable whether it is possible to implement it correctly. Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: MMU: Selectively set PageDirty when releasing guest memoryIzik Eidus
Improve dirty bit setting for pages that kvm release, until now every page that we released we marked dirty, from now only pages that have potential to get dirty we mark dirty. Signed-off-by: Izik Eidus <izike@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: MMU: Fix potential memory leak with smp real-modeIzik Eidus
When we map a page, we check whether some other vcpu mapped it for us and if so, bail out. But we should decrease the refcount on the page as we do so. Signed-off-by: Izik Eidus <izike@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Export include/asm-x86/kvm.hAvi Kivity
Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Portability: Move cpuid structures to <asm/kvm.h>Jerone Young
This patch moves structures: kvm_cpuid_entry kvm_cpuid from include/linux/kvm.h to include/asm-x86/kvm.h Signed-off-by: Jerone Young <jyoung5@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-01-30KVM: Portability: Move kvm_sregs and msr structures to <asm/kvm.h>Jerone Young
Move structures: kvm_sregs kvm_msr_entry kvm_msrs kvm_msr_list from include/linux/kvm.h to include/asm-x86/kvm.h Signed-off-by: Avi Kivity <avi@qumranet.com>